News

Hyperspectral imaging: solving the same-color foreign object sorting challenge

Hyperspectral imaging: solving the same-color foreign object sorting challenge

Different objects that appear the same color under visible light can look completely different in the near-infrared.

A red impurity mixed in with dried chilies, a clod of dirt close in color to peanuts hidden among peanut kernels, and lymph node tissue on pork—these scenarios share one common feature: under visible light, the foreign matter and the product are almost exactly the same color. They cannot be seen with the naked eye, and ordinary color sorters cannot tell them apart.

This is one of the toughest problems in the food and agricultural product sorting industry: same-color foreign objects.

Traditional color sorters rely on RGB cameras to spot color differences, but fail outright when contaminants are the "same color." X-ray systems can detect metal and stone, yet they are powerless against low-density foreign objects such as plastic, wood, and rubber. Metal detectors can only find metal. So is there a technology that can pick out all these foreign objects "wearing camouflage"?

The answer is: hyperspectral imaging technology.


What is a "same-color foreign object"?

“Same-color foreign matter” is not a strict academic term but an industry shorthand in industrial sorting for a particular type of contaminant. It refers to foreign matter whose color, brightness, and texture closely resemble those of the target product in the visible wavelength range (400–700 nm), so that visible-light-based detection methods cannot distinguish it effectively.

Note a few keywords:

"Visible band": a color match holds only under visible light; in another band, the two may be completely different. That is the fundamental premise behind what hyperspectral imaging can solve.

“Highly similar” — not identical, but so close that the three broad channels of a standard RGB camera cannot capture the difference. The human eye is actually more sensitive than an RGB camera, but on high-speed production lines, its reaction speed and consistency fall far short.

"Visible-light-based inspection methods fail"—including manual visual sorting, standard industrial cameras, and conventional color sorters. Their common limitation is that they only see the narrow visible portion of the spectrum.

Same-color foreign objects are common across industries:

These foreign objects pose different hazards: stones and glass can damage processing equipment, plastic and rubber are food safety risks, and hair and synthetic fibers affect product quality. But they have one thing in common: under visible light, they "look too much like" the product.

Camouflage by same-colored foreign objects works only in the visible spectrum.

Why ordinary color sorters can't handle it: the “blind spot” of visible light

To understand the advantages of hyperspectral technology, you first need to understand the limitations of traditional color sorters.

The most common device on industrial sorting lines today is the RGB camera-based color sorter. It works on a simple principle: a high-speed camera captures images of the product, analyzes the RGB color value of each pixel, and compares it with a preset color range; anything outside the range is blown away by an air valve.

This approach works very well for differently colored foreign objects—for example, black rice in white rice or black contaminants in yellow plastic. Because the color difference is large, an RGB camera can spot them at a glance. Color sorters have greatly improved sorting efficiency over the past few decades; there is no doubt about that.

But when the foreign object is the same color, the RGB camera runs into a fundamental physical limit:

First, RGB has only three broad bands. The red, green, and blue channels of an ordinary camera each cover a broad band of about 100–150 nm, roughly dividing the entire visible range into three blocks. If two substances have similar integrated reflectance across these three broad channels, an RGB camera cannot distinguish them.

Second, visible light reflects only "color," not "composition." The color of a substance is mainly determined by surface pigments and electron transitions, while many foreign objects (such as plastic, stone, and glass) have no distinct characteristic absorption in the visible range; their color is determined only by surface scattering and impurities. As a result, a piece of red plastic and a red chili pepper may "look exactly the same" under visible light, yet their chemical compositions are completely different.

Third, RGB cannot penetrate surfaces. For example, mold inside nuts or same-colored metal: visible light can only see surface color and cannot detect the interior.

What about other technologies?

X-ray works well for detecting high-density foreign objects (metal, stone, glass), but its contrast for low-density foreign objects such as plastic, wood, rubber, and paper is very low, making them difficult to distinguish. X-ray also raises radiation safety concerns, and both equipment and maintenance costs are high.

Metal detectors can detect only metal and are completely ineffective against nonmetallic foreign objects.

Near-infrared single-point spectroscopy can measure composition, but only at one point. It provides no spatial distribution information, cannot locate the position or size of foreign matter, and is not suitable for full inspection on high-speed production lines.

So the core challenge in detecting foreign matter of the same color is this: we need a technology that can "see composition" (distinguish between material types), "see location" (pinpoint where the foreign matter is), and "run fast" (keep up with production line speed).

Hyperspectral imaging satisfies all three conditions at once.

Core principle: visible light has the "same color"; near-infrared has a "different spectrum".

The underlying logic of detecting same-color foreign objects with hyperspectral imaging can be summed up in ten characters: same color in visible light, different spectra in near-infrared.

To elaborate:

Two substances appear similar in color in the visible range (400–700 nm) because their reflectance curves have similar shapes in this band—there are no distinct characteristic absorption peaks, and their overall reflectance levels are about the same. But this does not mean they are similar across all wavelength bands.

In the near-infrared range (700–2500 nm), the situation is completely different. Absorption in the near-infrared region is mainly determined by the overtone and combination vibrations of hydrogen-containing groups (O-H, C-H, N-H) in molecules. Substances with different chemical compositions differ in the types, quantities, and bonding patterns of their hydrogen-containing groups, so they exhibit distinctly different characteristic absorption peaks in the near-infrared region.

Here's a simple example:

Red plastic vs. red chili peppers. In the visible region, both appear red and have similar RGB values, making them indistinguishable to a color sorter. But in the near-infrared region:

The main components of chili peppers are water, sugars, cellulose, and vitamin C—all rich in O-H and C-H bonds—with a series of characteristic absorption peaks near 970 nm (water), 1200 nm (sugar), 1450 nm (water), 1940 nm (water), and 2100 nm (sugar/starch).

Red plastics (such as PP, PE, and PET) consist mainly of hydrocarbon polymers. C–H bonds dominate, with characteristic C–H absorption near 1200 nm, 1400 nm, 1700 nm, and 2300 nm, but almost no water absorption peaks (970 nm, 1450 nm, and 1940 nm), because plastics contain no water.

So, just by looking at the depth of either of the two water absorption peaks at 970 nm or 1450 nm, you can immediately distinguish chili peppers from red plastic — chili peppers have a clear water absorption dip, while plastic is almost flat.

This is the key to hyperspectral detection of same-color foreign matter: it looks at composition, not color. When visible light fails, the characteristic absorption peaks in the near-infrared are the most precise "material ID."

More importantly, hyperspectral imaging integrates images and spectra: it can tell you not only whether a foreign object is present, but also where it is, how large it is, and what material it is made of. Hyperspectral data forms a three-dimensional cube: the first two dimensions are spatial position (the image), and the third is spectral wavelength. Each pixel has a complete spectral curve, so material types can be determined pixel by pixel. The pixels belonging to foreign objects can then be clustered spatially to obtain their location, shape, and size.

This means hyperspectral imaging can not only detect foreign objects but also distinguish what type they are: plastic or wood? PET or PVC? glass or stone? This information is valuable for subsequent removal strategies and traceability analysis.

Hyperspectral application cases

To address the most difficult black-on-black foreign material sorting problem in black melon seed processing, SPECU has implemented a dedicated inline sorting solution based on its in-house 400–1000 nm industrial hyperspectral inspection system. The solution targets three core hard-to-detect contaminants mixed with black melon seeds—black twigs, black stones, and black PE plastic fragments—and is now in stable industrial use.

During harvesting and processing, black melon seeds are highly prone to contamination with field debris such as dried twigs, small black stones, and fragments. These foreign objects are entirely black and closely match the appearance of black melon seeds. Traditional RGB color sorters cannot detect them, X-ray inspection is ineffective against lightweight plastic and dried twigs, and manual sorting has a very high miss rate. As a result, finished products exceed impurity limits and struggle to meet premium shipment and export quality inspection standards. Traditional color sorters and manual sorting cannot remove black same-color foreign matter, leading to excessive impurities and high customer complaint rates; products cannot enter premium supermarket or export supply chains, creating an urgent need for a high-precision, non-destructive sorting solution.

Leveraging the core phenomenon of metamerism, the hyperspectral system extracts differentiated spectral fingerprints for black melon seeds (organic oil and moisture signatures), stones (inorganic minerals), twigs (wood fibers), and PE plastic (polymers). Combined with a machine learning classification model, it achieves pixel-level material discrimination and accurately distinguishes foreign objects that look the same but differ in composition.

Extract characteristic spectra to accurately distinguish the spectral differences among four material types—seeds, wood impurities, inorganic stones, and polymer plastics—and build a dedicated algorithmic sorting model.

Industry value and technical boundaries

In various sorting applications, sorting by color relies on vision, while sorting same-colored materials relies on spectroscopy.

Conventional equipment can only address “visible impurities,” whereas hyperspectral technology addresses hidden, same-color impurities that cannot be seen, distinguished, or removed, making it highly applicable across industries.

At the same time, objectively define the technical boundaries: this solution works best for same-color foreign matter made of a different material. If the foreign matter and the good product have exactly the same material and composition and differ only in appearance, a vision algorithm can be added to assist detection.


What is called “indistinguishable” is always a limitation of the detection dimension, not an absence of difference in the substance itself.

The naked eye and ordinary cameras can see only visible-light colors in the 400–700 nm range; hyperspectral imaging, by contrast, can reveal the molecular composition and underlying nature of materials. Moving from “identifying color by eye” to “identifying quality by spectrum,” hyperspectral technology is reshaping sorting standards in industrial processing, fully overcoming the long-standing industry challenge of same-color foreign objects, and providing core technical support for safe food production and for improving both quality and efficiency in high-end agricultural products.