Guides

How machine vision works

The camera, light, lens, and software that check product on a line, and how each picture becomes a pass or a reject.

What a vision system does

A machine vision system takes a picture of each unit as it passes a fixed point on the line, measures the feature it was set up to measure, and tells the line what to do with that unit. The question is narrow and decided ahead of time: is the cap seated, can the lot code be read, are there twelve pieces in the tray. Because the question stays fixed, the system answers it the same way on every unit and every shift.

Lights shine on a pack on the conveyor. A lens and camera above it send the picture to a processor, which signals the PLC and the reject. 3 Camera 2 Lens 1 Light 4 Processor software PLC 5 Line I/O Reject Product

Five parts every station needs

Light

Engineered lighting decides more results than any other part. It makes the fault stand out, and a shield or enclosure keeps the picture the same from the first shift to the third, whatever the room lights or a dock door are doing. See Lighting and optics for inspection.

Lens

The lens focuses the scene onto the sensor. With the sensor size, it sets how far the camera sits from the product, how wide the view is, and how much depth stays sharp. The imaging calculator works out the focal length and the size of one pixel on the part.

Camera

A grid of light-sensitive pixels, plus electronics that set the exposure and send the picture out. More pixels across the same view means finer detail on the part.

Processor and software

Runs the inspection steps on every picture. It can sit inside the camera, in a vision controller, or in an industrial PC.

Connections to the line

A trigger, usually a photo eye or an encoder count, tells the camera the unit is in place. The result goes to the PLC and the reject. The picture and the result go to storage for quality records.

From picture to pass or fail

01

Capture

The trigger fires. The light flashes for a short exposure that freezes motion, and the camera sends the frame.

02

Clean up

Filters even out brightness, reduce noise, or sharpen edges so the feature reads clearly. Many checks skip this step.

03

Locate

The software finds the product and the area to check, so the tools land in the right place when a pack arrives a little off center or turned.

04

Measure

Tools turn pixels into numbers: a fill height in millimeters, a piece count, the text of a lot code, the size of a dark spot on a seal.

05

Decide

Each number is compared with limits set from real good and bad samples. A fail sends a reject signal timed to the moment that unit reaches the reject, and the image and reason are saved.

Setting the limits takes most of the commissioning time. Limits that are too tight cause false rejects and slow the line. Limits that are too loose let faults ship. Both are tuned with real product from the line.

Four kinds of images

Gray-scale

Each pixel holds one brightness number, usually 0 for black to 255 for white. Most line checks use it: presence, position, fill, print, and codes.

Color

Each pixel holds red, green, and blue values. Use it when color is the fault: the wrong flavor sleeve, a missing colored tablet, a burned edge on a baked product.

Binary

Software turns a gray-scale picture into pure black and white at a chosen cutoff. Counts and outline checks run fast on it while the contrast between product and background stays strong.

3D

Each point holds a height or distance in place of a brightness. Use it when the fault is shape: a dented can, a cap riding high, a crushed corner. Some 3D cameras return a grid; others return a cloud of X, Y, Z points.

Rule-based tools and deep learning

Rule-based tools

How it is set up
An engineer picks tools such as edges, measurements, pattern matching, code reading, and text reading, then sets limits.
Where it fits
Faults that can be measured: fill height, count, position, missing parts, codes, and text.
What it needs
Clear, steady images and known limits.
Explaining a reject
Each reject traces to a value outside a limit.
After a product change
Adjust a tool or a limit.

Deep learning

How it is set up
A neural network learns from labeled pictures of good and bad product.
Where it fits
Faults that vary in look: cosmetic marks, wrinkles, natural product with irregular shapes.
What it needs
Many correctly labeled images of each fault and of good product. Labeling usually takes longer than training.
Explaining a reject
The network gives a score. Its internal reasoning stays hidden.
After a product change
Collect and label new pictures, then retrain.

When rule-based tools can do the work with reasonable effort, they are usually simpler to run and maintain. Many stations use both: rules to locate the product and read codes, and a trained network to judge appearance.

Where cameras do well, and where they need help

01

Strong

  • Every unit checked at full line speed.
  • The same judgment on every shift.
  • Measurements in numbers, with a saved image for each reject.
  • Barcodes, 2D codes, and printed text read on the line.
  • Each result logged, so drift shows up early.
02

Needs help

  • Faults out of the camera's line of sight: inside a sealed pack, under a label, behind another unit.
  • Seal integrity that shows only under a pressure or dye test.
  • Shiny, clear, or wet surfaces, which need lighting designed for them.
  • Details smaller than a few pixels in the chosen view.
  • Product, lighting, or camera position that changes after setup. The limits then need a fresh check.

Start with your line.

Tell us about the system