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 does a machine vision system do?

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.

The five parts of a vision station: 1 lights, 2 lens, 3 camera, 4 processor and software, 5 line I/O. A photo eye triggers the station as a pack arrives. Two lights shine on the pack, and the lens and camera above it take the picture. The processor runs the software and tells the PLC, which fires the reject downstream.

What five parts does every vision station need?

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.

How does a picture become a pass or a 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.

What kinds of images can a vision system take?

Gray-scale picture of a round, scored tablet, with a zoomed patch of its edge showing one brightness number per pixel, from 0 (black) to 255 (white)

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 picture of a blue and yellow capsule, with the red, green and blue values of one pixel on each half

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.

The same tablet as a binary picture after a cutoff of 128, with the zoomed patch now holding only 0 (black) or 1 (white)

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.

2D top-down view of a can end: the rim shows as a bright ring, and a rim dent from an impact is a V-shaped notch where the edge leaves the dashed nominal circle

Rim dent (2D, top-down)

A 2D camera looking straight down sees the rim's outline. A rim dent from an impact shows as a V-shaped notch where the edge leaves its round path, so the check can flag it without measuring height.

Rule-based tools or deep learning: which fits the job?

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 do cameras do well, and where do 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.

FAQ

Questions about machine vision basics

QWhat does a vision system need?

A camera, a lens, a light, software that makes the decision, and a connection to the line so bad product is rejected.

QIs machine vision the same as a barcode scanner?

A scanner only reads codes. A vision system can also check labels, print, fill level, position and defects, and can read codes as part of that.

QHow fast is it?

Each check typically takes milliseconds, so it keeps up with most packaging lines.

QDoes it need deep learning?

Most checks do not. Rule-based checks cover codes, labels and presence. Deep learning helps when defects vary a lot.

Ask JM Automated Solutions about your line.

Tell us about the system