Seal inspection of food packaging

Hyperspectral machine vision and grayscale-based machine vision for the detection of bubbles and impurities in the seal seam of plastic packaging for sausage and ham

A renowned ham manufacturer approached us with the request to ensure that their food packaging contains exclusively what belongs inside.

Since even the smallest impurities in the seal seam that are invisible to the human eye can lead to leaking packaging and spoilage of the goods, resulting in costly product recalls, a camera-based inspection was to be implemented moving forward.

The tasks “detection of bubbles” and “detection of impurities” represent very different technical challenges. Particularly with regard to impurities, differentiation by type and composition is necessary. The most common defect occurs when food, in this case meat or sausage, gets into the area of the seal seam during the sealing process. If this area is subsequently sealed, the trapped material prevents reliable adhesion of the seam. Grease and liquids are particularly problematic because they are often barely visible to the naked eye and are partly transparent. For the reliable detection of such critical impurities, hyperspectral machine vision is used.

The detection of air pockets (bubbles) is also very important, as multiple small bubbles can merge into a single large bubble. In the worst case, this creates a continuous tunnel or passage along the seal seam, which can lead to a complete loss of seal integrity.

Technological approaches to seal seam inspection: Visible light, high resolution, and hyperspectral analysis in comparison

Classic, contrast-based machine vision: For all non-transparent impurities, conventional machine vision based on contrast differences is ideally suited. In these cases, cameras in the visible light spectrum are used. This method can be applied universally as long as the impurities are sufficiently visible. For these cases, we use line scan cameras from Teledyne.

Special case of bubble detection: Bubbles present a special challenge because they usually only show contrast in their edge region. Therefore, high-resolution cameras in the visible light spectrum are required to detect them. Additionally, targeted machine vision is necessary to reliably identify bubbles as such. Based on the size of the bubbles and the distance between neighboring bubbles, a decision can then be made as to whether a product should be sorted out.

Hyperspectral machine vision: Hyperspectral cameras are specifically trained to recognize certain chemical compounds such as water or fat—precisely those often transparent impurities that are hardly detectable with classic machine vision. However, these systems are limited to the respective trained substances and cannot capture other impurities.

Scalable AI-supported inspection solution for maximum seal seam security

Current projects are being enhanced through the use of artificial intelligence. The AI analyzes not only the seal seam itself but also adjacent areas—for example, whether there is unwanted material to the right or left of the seam. Such indicators can point to potential compromises in the sealing and contribute significantly to early defect detection.

The possible solutions are modular and can be flexibly adapted to individual requirements and security demands, ranging from a cost-effective entry-level system to comprehensive high-end monitoring:

  • Basic level: Detection of larger foreign objects
  • + Bubble detection: Tracing of air pockets using high-resolution machine vision
  • + Fat/water detection: Hyperspectral analysis for transparent impurities
  • + Detection of further chemical impurities: Using advanced hyperspectral analysis
  • + AI-based analysis: Additional security through smart pattern recognition in the entire seal seam area.

Hyperspectral imaging for invisible risks

For our customer's specific application, the choice fell on hyperspectral machine vision, as this technology also enables the detection of impurities that lie outside the visible light spectrum—in this case, product residues or melted fat in the area of the heat-sealed food packaging. Such residues usually remain hidden from the human eye and conventional inspection systems. Hyperspectral cameras, on the other hand, identify materials based on their biological and chemical signature even through printed plastic films, thus enabling reliable detection of bubbles, inclusions, and critical contamination.

In the implemented application, a hyperspectral camera (HSI) is installed about one meter above the conveyor belt, capturing six packaging units per second. The recorded image data is analyzed in the evaluation software pvSealInspect developed by phil-vision. In the first step, the seal seam is separated from the rest of the packaging area so that it can subsequently be examined selectively and with high precision for irregularities.

Additionally, a label recognition module should be integrated into the application. A monochrome camera with white illumination is used for reading barcodes and plain text, seamlessly integrated into the overall system.

Efficient integration and GPU-optimized processing of hyperspectral data

The integration of the SPECIM FX camera we selected was straightforward. The real challenge lay in processing the high-resolution 12-bit spectral images, which we specifically optimized for GPU-based computation. In doing so, we extract specific spectral signatures based on the chemical composition of the materials. For better interpretation, these are converted into RGB colors, which significantly simplifies the segmentation of defects and enables precise classification of contamination or material deviations.

Transparent evaluation and defect classification for maximum process reliability

The test results are displayed visually using color coding: green indicates flawless packaging (OK), red marks defective units (NOK). Below this display, continuous statistics appear showing the total number of packages inspected along with a breakdown of good and bad parts.

Packages identified as defective are further categorized into "poor seal" and "bad label". Additionally, the percentage defect rate relative to total production is displayed – an important key metric for quality monitoring and process optimization. To detect potential systemic errors early, the system also continuously records the last 100 OK and NOK results for each position on the conveyor. This allows recurring errors at specific locations (e.g., due to faulty feeding) to be identified quickly.

The definition of what exactly constitutes a defect is flexible and customizable: in the present application, packaging is only ejected if multiple bubbles or foreign bodies such as grease are detected in the seal seams. Individual bubbles below a defined minimum size, however, are tolerated and not counted as an exclusion criterion.

Diverse potentials for hyperspectral technology in the food industry

Patrick Gailer, responsible for this application at phil-vision, draws a positive conclusion from the project. "With this first HSI application, we were able to gather extensive experience. The insights gained open up numerous further application possibilities, not only in automated production lines of the food industry, but also in freshness checks of various natural products such as meat, fish, cheese, vegetables, or fruit. Their use is also conceivable in the detection of various foreign bodies such as plastic particles, wood, paper, or hair in packaged foods."

Particularly noteworthy is the ability of hyperspectral cameras to precisely analyze material compositions, such as moisture, fat content, protein content, or purity. This creates almost limitless possibilities for use in food quality control.

As part of the project, a specially developed software solution was also implemented. This first analyzes in which spectral ranges anomalies occur and then prepares the image data for further processing using classical machine vision methods or AI-based algorithms."

Your idea — our solution

Challenge us!

We are happy to provide you a free consultation on any type of inquiry, no matter how unusual it may be.

Call us at +49 89 125094350, or send us your requirements directly by email. Alternatively, you can use the button in the menu bar to book an appointment directly for a free initial consultation.