Food Quality Vault learning network
Food Quality VaultLearning Hub
Quick Answer

In brief: Explains how optical sorters inspect bulk grains, nuts, fruit and vegetables at speed. CCD or CMOS cameras judge size, shape, texture and color, while near-infrared hyperspectral sensors can reveal internal rot, mycotoxin mold or plastics matching product color. Compressed-air ejectors fire milliseconds after detection to divert defects. Lenses, background plates and LED lighting need daily cleaning and calibration to keep accuracy.

Home / Pillar 9 / Module 9.7

Module 9.7: Optical Sorting and Vision Inspection

CCD cameras, NIR infrared sorting, laser ejector mechanisms, and discoloration and foreign defect removal in bulk foods.

By Nair Ajeet, Lead Author, Food Quality Vault Editorial Team · · Editorial governance

Food Quality Vault Updated November 2026 Reference context: SQF & Vision

What you will learn: Optical Sorting in Food

An optical sorter makes a decision about every piece of product in a few milliseconds and acts on it with a pulse of air. This module looks at how lighting and sensors are designed, what limits resolution and speed, how ejection timing is calculated, how machine-learning classification is changing sorting and how to tune a sorter for hazard removal rather than grade. The programme-level view is covered in Module 3.9. This guide now also covers what sorters find and miss, false rejects, validation and managing the reject stream in sections 8 to 14, so everything on this topic is in one place.

1. From light to decision

Every sorter follows the same chain: illuminate, image, classify, eject. Light falls on the product, and the reflected, transmitted or fluoresced light is recorded by sensors. Software converts the image to features such as colour, shape, size and spectral signature, and compares them with a model of what is acceptable. If a piece fails, a valve fires a timed pulse of compressed air to deflect it.

The chain has to run within milliseconds, for tens of thousands of pieces per second, which puts strict demands on every stage. A weak link anywhere, such as dim lighting, a slow camera or a mis-timed valve, reduces overall performance, however good the rest of the machine is.

2. Lighting and sensors

Lighting is as important as the cameras. LED illumination, usually in several wavelengths, gives stable and long-lasting light, which keeps colour thresholds consistent. The geometry matters: lights on both sides of the product reduce shadows, and a background plate with a colour that contrasts with the product, often chosen to match the product in colour so that only defects appear, simplifies the decision.

Sensors fall into groups. Line-scan colour cameras build an image as the product moves past, with pixel sizes in the range of roughly 0.1 to 0.3 mm on the product, which sets the smallest defect visible. Near-infrared and short-wave infrared sensors respond to molecular bonds, moisture and fat, and so tell plastics, glass and organic material apart even when they look alike. Laser scanners add information on gloss and surface structure. Hyperspectral cameras record many narrow wavelength bands for each pixel, and are used for hard problems such as separating similar plastics or detecting early rot.

Figure 9.7 — Optical Sorting, CCD Cameras, NIR Hyperspectral Scanning, and Pneumatic Ejector Workflow

1. Free Fall Feed High-Speed Chute Stream 2. CCD & NIR Scan Color & Hyperspectral 3. Digital Analysis Defect Identification 4. Pneumatic Jet Precise Air Ejection

3. Speed, resolution and throughput

A sorter has limited data bandwidth. Faster product movement reduces the time each piece spends in view, and so the number of lines scanned across it. Doubling the speed halves the lines. A higher camera resolution increases the data per piece, and the processor has to keep up. Manufacturers balance these by choosing line rates, typically several thousand to tens of thousands of lines per second, and product speeds of a few metres per second.

Throughput also depends on how well the product is presented. The sorter needs a single layer of well-separated pieces, since overlapping pieces hide defects. Vibratory feeders and chute designs create the layer, and overloading it, to raise capacity, is the most common reason for poor sorting.

4. Ejection timing: a worked example

The valve must fire at the instant the target passes its nozzle. The system knows the distance between the camera line and the ejector, and the speed of the product, and computes a delay. For a belt moving at 3 m/s with 150 mm between the camera and the ejector, the delay is 0.15 ÷ 3 = 0.05 s, or 50 ms.

The tolerance is tight. If the timing is off by 1 ms, the target has moved 3 mm, since 3 m/s × 0.001 s = 3 mm. A small nut or a piece of glass could be missed entirely, and good pieces next to it could be ejected instead. The valve also has its own response time, usually a fraction of a millisecond to about a millisecond, and the air pulse takes time to reach the target. Calibration measures these delays, and recalibration is needed when belt speed, air pressure or valve wear changes. Air pressure is typically of the order of 4 to 6 bar, and must be stable, dry and oil-free.

5. Classification: thresholds and learning

Early sorters compared each piece with colour and size thresholds set by an operator. Modern machines increasingly use machine-learning classifiers trained on thousands of labelled images of good product and defects. A trained model can handle complex judgements, such as separating a natural dark mark from a mould spot, or a shell fragment from a nut piece, better than a fixed threshold.

Learning systems bring a new requirement: control of the model. The training set should include the contaminants of concern, with realistic variation. The model needs version control, with a record of when it was changed and by whom, and validation after each change with seeded contaminants. A model that was retrained on new data and not revalidated is an uncontrolled change in a critical control.

  • Keep a library of labelled defect and contaminant samples for each product.
  • Version every recipe and model, and restrict who can change them.
  • Revalidate after retraining, new product varieties or a change of season.

6. Tuning for safety rather than grade

A sorter can be set to remove cosmetic defects or to remove hazards, and the two aims pull in different directions. Sorting for grade can tolerate losing some good product. Sorting for foreign material may need a higher sensitivity, a second pass or the combination of two sensor types, even when it rejects more good product. Plants should define the hazard targets first, such as stones and glass above a specified size, and set the machine to meet those, then treat cosmetic grading as a second objective.

Example scenario (illustrative)

A nut processor’s sorter removes 98 percent of seeded stones and shell in weekly tests. After a belt replacement, the stone recovery falls to 80 percent without any alarm. The new belt runs 4 percent faster, but the ejection delay was never updated, so the air pulses arrive slightly behind the target. Recalibrating the timing restores recovery to 98 percent. The plant adds a calibration check to its belt-change procedure and a seeded test after any mechanical change.

7. Maintenance and verification routines

Sorters stay accurate only if the physical parts are kept in condition. Clean camera windows and lights on a schedule, because a thin layer of dust gradually dims the image. Check the colour calibration against reference targets, replace lamps or LED modules that have aged, test every ejector valve and check the compressed air for water and oil. Combine these routines with a seeded challenge at set intervals, and keep a log of each test, so that a slow decline in performance is seen before it becomes a failure.

8. What an optical sorter does

In a typical chute sorter, product slides or falls in a thin, single-layer stream past an inspection zone. Cameras and sometimes lasers view each piece against a background, software decides in a few milliseconds whether it is acceptable and, if not, a valve fires a burst of compressed air that deflects it into a reject stream. In belt sorters the product travels on a conveyor and is ejected at the end. Throughput ranges from a few hundred kilograms to many tonnes per hour.

Unlike metal detectors and X-ray, which look for objects that differ in physical density, optical sorters see colour, shape, size, texture and chemical signature. They therefore find a different set of problems: discoloured, mouldy or insect-damaged pieces, shells, stones, glass, plastic and other foreign material of a different colour from the product.

9. Sensors: from colour to chemistry

  • RGB colour cameras. High-resolution CCD or CMOS cameras record each piece in colour and compare it with an accept range. They find colour defects and foreign material that differs visibly from the product.
  • Near-infrared (NIR) and short-wave infrared (SWIR). These sensors respond to the chemical composition of surfaces, notably moisture, fat and the molecular bonds in plastics. They can separate pieces that look the same in colour but differ in material, such as a clear plastic fragment among white beans or a piece of glass among rice.
  • Lasers. Laser scanners detect surface properties such as gloss and structure, and fluorescence under laser or UV illumination reveals some types of damage and contamination.
  • Hyperspectral imaging. Records a full spectrum for every pixel, and allows sorters to discriminate between very similar materials.

A sorter’s value depends on the chosen sensors being matched to the contaminants you worry about. An RGB-only machine will miss a clear plastic fragment in a transparent product.

10. What optical sorting finds and misses

Typical targets are stones, glass, plastic, wood, shell, stalk and string in nuts, grains, pulses, dried fruit, frozen vegetables and potatoes, and product defects such as rot, mould, insect damage and discoloration. For some commodities, sorting by fluorescence or colour removes kernels with visible mould damage, which has been shown to reduce aflatoxin content in lots of maize and nuts substantially, although it does not replace testing and supplier control.

Limits are real. A sorter sees only the surface visible to its cameras, so an object hidden in a piece of product or under another piece is missed. Foreign material the same colour, shape and chemical signature as the product will pass. High loading, with pieces overlapping or bouncing, reduces accuracy. And sorters do not see inside sealed packs.

11. Ejection accuracy and the cost of false rejects

Two numbers describe performance. The first is how many defects and foreign objects are removed, the recovery rate for each target type. The second is how much good product is removed along with them. Because the air jet ejects a small zone of product around the target, some good product is taken as well, and the ratio of good to bad in the reject stream shows the efficiency. A reject stream that is 95 percent good product is a sign of poor tuning, or of sensitivity set too high.

Plants usually accept a trade-off, tuned by product value. For a low-value commodity, some losses can be tolerated if the hazard is serious. For an expensive nut, even small losses add up, and rework of the reject stream through a second sorter, which cleans up the reject and recovers good product, is common.

12. Validation and routine verification

Validation uses seeded test material: known quantities of the contaminants of concern, such as stones, glass, coloured plastic, wood pieces and defects typical for the product, mixed into the normal feed. After a run, the plant counts how many were found in the reject stream and how many remained in the accepted product. The recovery rate for each type of contaminant is recorded and compared with the target, for example 95 percent or higher for the relevant sizes.

Routine verification repeats a simplified challenge at set intervals, such as every shift or weekly, with recorded results. Settings are controlled: the sensitivity, the ejection timing and the recipe are locked, with changes requiring authorisation and revalidation. Operators should not adjust sensitivity to improve throughput or reduce rejects without approval.

  • Keep a library of retained test samples for each product and contaminant type.
  • Test after any change to the recipe, product, cameras, valves or software.
  • Check air pressure, valve function and lens cleanliness each shift.
  • Review the content of the reject stream regularly, to learn what is being found.

13. Keeping the sorter working

Optical sorters depend on clean optics and clean air. Dust on camera windows, lighting or background plates lowers sensitivity gradually, so lenses are cleaned on a schedule. The compressed air must be dry and oil-free, since moisture and oil block valves and soil the lenses. Ejector valves wear and should be tested, with a record of any that fail. Calibration to reference targets keeps the colour and size thresholds stable as lamps age.

Example scenario (illustrative)

A frozen-vegetable plant checks its sorter weekly by feeding in 50 pieces of green plastic and 50 stones of 5 to 8 mm. For months the sorter removes all of them. A customer then complains of a piece of clear plastic film in a bag of peas. The seeded test used only green and grey pieces, which the colour camera sees easily. Transparent film was never tested, and the machine has no NIR sensor. The plant adds clear film and translucent pieces to its test set, finds that the recovery is only 40 percent, and upgrades to a model with a short-wave infrared sensor.

14. Managing the reject stream

What the sorter rejects needs a plan. Many plants pass the reject stream through a second sorter, which recovers good product and concentrates the defects. The final reject is inspected at intervals to record what was found, then discarded or sent to a non-food route in a labelled container. Do not blend rejected material back into good product without validated rework steps. Sample the accepted stream as well, since a defect that appears there shows the sorter is missing it.

Key takeaways: Optical Sorting in Food

Optical sorting works through lighting, sensors, classification and timed ejection, each of which has physical limits. Control timing and air quality, control models and recipes like any critical setting, validate with seeded contaminants and set the machine to remove hazards first, grade second.

Frequently Asked Questions

What determines the smallest defect a sorter can see?

The pixel size of its cameras on the product, commonly 0.1 to 0.3 mm, together with line rate, lighting and the contrast between the defect and the product.

Why does ejection timing need to be so precise?

At 3 m/s, a timing error of 1 ms moves the target by 3 mm, which can cause the air jet to miss a small defect and reject good product beside it.

What does a short-wave infrared sensor do?

It responds to chemical bonds, moisture and fat, so it can tell materials apart that look alike in visible light, such as plastics and glass among organic product.

Why does a machine-learning sorting model need change control?

Retraining can change what the sorter accepts and rejects, so the model should be versioned and revalidated with seeded contaminants like any critical setting.

What does an NIR sensor add to an optical sorter?

It responds to chemical composition, so it can separate pieces that look the same in colour but differ in material, such as clear plastic among white beans.

Why is validation done with seeded contaminants?

Real contamination is rare, so plants add known quantities of stones, glass, plastic and defects to the feed and measure what fraction the sorter removes.

How can a sorter remove too much good product?

The air ejector removes a zone around the target, and sensitivity set too high rejects acceptable pieces. The proportion of good product in the reject stream shows how well it is tuned.

Can optical sorting replace mycotoxin testing?

No. It can reduce toxin levels by removing visibly damaged kernels, but testing and supplier control are still required.

Lesson details: Optical Sorting in Food

Facts about this module
MeasureDetail
PillarPillar 9: Foreign Object Control
PositionModule 9.7 of 10 in this pillar
Reading timeabout 13 minutes at 200 words per minute
Practice quiz120 questions in four tiers; you can test yourself after reading
Last updated

Key terms: Optical Sorting in Food

Optical sorter
An automated system using cameras and lighting to inspect bulk product and eject defects or foreign objects at high speed.
NIR hyperspectral imaging
Imaging that reads how items reflect infrared light to find rot, mycotoxin mold or plastics matching product color.
Pneumatic ejector
A valve array that fires a compressed air blast to deflect a defective particle into the reject bin.
Near-infrared (NIR) spectroscopy
A sensing method that reads water and chemical absorption, letting sorters tell food from look-alike foreign matter such as wood, plastic or stones.
Pneumatic air-jet ejection
A micro-valve manifold that releases a high-pressure air pulse within milliseconds to blow an identified defect into a reject hopper.

Sources and further reading

Nair Ajeet, Lead Author at Food Quality VaultNair Ajeet, author profile

About the author

Nair Ajeet · Lead Author, Food Quality Vault Editorial Team

Lead QC & ISO Certification Planner with more than 10 years in food safety and quality control. MSc Food Science, ASQ Certified Food Safety and Quality Auditor (CFSQA), HACCP Level 4. Experience in fresh-produce inspection, receiving QC, warehouse quality management and production QC. Read the full profile · LinkedIn

Technical Evidence & Practical Application

  1. FDA — HACCP Principles and Application Guidelines
  2. FDA — Food Code 2022 and updates
  3. Codex Alimentarius — General Principles of Food Hygiene (CXC 1-1969)