Objective:
This application note examines how hyperspectral imaging (HSI) technology improves food quality and safety inspection, specifically focusing on detecting contaminants in coffee beans. Using our advanced VNIR, NIR, and SWIR imaging systems, this study explores how HSI technology detects foreign materials and contaminants to ensure quality and safety in food processing.
Overview of Food Quality and Safety Challenges
Food manufacturers face challenges in identifying contaminants, such as foreign objects, to maintain quality standards. Detecting non-coffee materials within coffee beans, like wooden sticks, shells, and stones, is critical to ensure quality and safety.
Hyperspectral Imaging allows for detailed contaminant detection by capturing spectral data across each pixel, differentiating between coffee beans and potential contaminants based on spectral features. The technology’s non-destructive nature is a major advantage for the food industry because it inspects products without altering or damaging them.
Hyperspectral Imaging in Food Quality Inspection
For this study, two types of coffee beans and several contaminants were measured using our specialized VNIR, NIR, and SWIR hyperspectral cameras, each offering a distinct spectral range and resolution.
The contaminants tested included wooden sticks, shells, and stones. Spectral responses were recorded for each camera configuration to evaluate their effectiveness in distinguishing these contaminants from coffee beans.

Figure 1: Photo of the sample and contaminants
Compared to traditional vision systems, the added value of hyperspectral imaging is clear:
- Both the coffee beans and contaminants were roasted, resulting in very similar colors. This makes an RGB camera alone unsuitable for distinguishing between them.
- The coffee beans and contaminants also have similar densities, rendering X-ray imaging ineffective.
- Hyperspectral imaging, however, reveals the chemical composition of the materials, making it the most suitable method for this application.
Sample Measurements and Data Analysis
The spectral data from the VNIR (Visible and Near-Infrared) sensor did not reveal distinct features to reliably separate coffee beans from contaminants, with minimal differentiation observed in the spectra.

VNIR spectra of coffee beans

VNIR spectra of contaminants
Figure 2: VNIR spectra of coffee beans and contaminants.
As expected, a PLS-DA model does not perform well for sorting the contaminants from the coffee beans when restricting analysis to this spectral range.

Figure 3: Prediction based on the VNIR related model (orange for beans and purple for contaminants).
NIR Imaging Module
The NIR (Near-Infrared) sensor captured more distinguishing spectral features, particularly around specific molecular absorption bands. These peaks aligned with coffee-specific spectra, enhancing the ability to differentiate contaminants.

NIR spectra of coffee beans

NIR spectra of contaminants
Figure 4: NIR spectra of coffee beans and contaminants.
We also emphasize that spectral differences can be enhanced using appropriate pre-processing techniques. Additionally, a spectral region of interest (ROI) covering only the relevant range can be defined, showcasing another advantage of our integrated imaging system.

Figure 5: NIR related spectra of contaminants (purple) and beans (orange) after pre-processing.
Modeling results showed good separation between coffee beans and contaminants.

Figure 6: Prediction based on the NIR related model (orange for beans and purple for contaminants).
SWIR Imaging Module
The SWIR (Short-Wave Infrared) camera displayed the most comprehensive spectral features. It encompasses the spectral range of the standard NIR sensor while extending further into the infrared spectrum. This added range enabled the model to include more caffeine-related spectral markers, enhancing contaminant detection accuracy.

SWIR spectra of coffee beans

SWIR spectra of contaminants
Figure 7: SWIR spectra of coffee beans and contaminants.

Figure 8: Prediction based on the SWIR related model (orange for beans and purple for contaminants).
Conclusion
Based on the results, both the NIR and SWIR cameras effectively identified contaminants, with the SWIR sensor providing slightly higher accuracy due to its extended range. However, considering cost efficiency, excellent ROI definition, and seamless compatibility with our unified software platform, we recommend the NIR camera setup for contaminant detection in industrial coffee processing.
Implementing hyperspectral imaging in food processing enhances product safety, minimizes waste, and improves quality control standards, offering manufacturers a reliable, fully integrated tool to detect contaminants and ensure the highest quality standards.





