Appearance
Vision: tools, pass/fail and counting
Last updated
License feature: Machine VisionA real inspection asks more than one question: four screws present, one lot code readable, the right colored cap fitted. Each question is a tool. This section covers what every tool has in common, the pass/fail rules, and the four simplest tools — Circles, Blobs (any shape), Presence and Color match. The others have their own sections: Pattern match and gauges, Barcodes, Text.
Choosing a tool
| Tool (as labeled) | Answers | Judged against | Use it when |
|---|---|---|---|
| Circles | How many | Expected count ± tolerance | The parts are round. Finds them by shape, so a partly hidden one still counts |
| Blobs (any shape) | How many | Expected count ± tolerance | Any other shape that stands out from the background |
| Presence | % of the region filled | A band (at least / at most) | Is something there — a screw in a hole, a cap on a bottle |
| Color match | % of the region that is the target color | A band | The right cap, the right label, the right wire |
| Pattern match | How well a taught feature matched (%), and where | A band | The right component is fitted; also locates the part for other tools |
| Caliper | A distance (px or mm) | A band | A width, gap or spacing |
| Circle gauge | A diameter (px or mm), and roundness | A band | A bore, a boss, a hole |
| Text (read & verify) | The printed text, and whether it is right | The expected text | A lot code, date code or part number |
| Barcodes & QR codes | What the codes say | A code must be read / must contain | Traceability labels, DataMatrix on parts |
Adding, copying and removing tools
- Add tool (in the Tools card) adds a Circles tool named Tool N with prefix
toolNto the program you are editing. - The copy icon (Duplicate this tool) inserts a copy after it, with prefix
<key>_copyand name "… copy". - The bin icon (Remove this tool) is disabled on the last tool: "An inspection needs at least one tool."
- Changing Tool resets the parameters to that type's defaults — a circle's sensitivity means nothing to a blob tool.
Fields every tool has
| Field | What it does | Rules |
|---|---|---|
| Name (top of the card) | A label shown on the page and on images | Up to 60 characters. Renaming does not rename tags |
| Tag prefix | Tags are published as <prefix>/count, <prefix>/pass … | Cleaned when you leave the field: lower case, anything but a–z, 0–9 and _ becomes _. A device-level tag name (pass, trigger, program …) is refused and the old prefix kept. A duplicate is renumbered on save (label_2). Changing it renames the tags, so anything bound to the old ones needs repointing |
| Tool | The tool type | Changing it resets parameters |
| Region of interest | Draw region / Whole frame | See Tuning |
| Looks through | Which camera the tool uses | Only shown with more than one camera. Changing it clears the region and any locator |
| Follow a located feature | Moves the region with a Pattern match tool on the same camera | Only shown when such a tool exists. See Pattern match and gauges |
| Pass / fail | The rule (below) | |
| Sliders | The tool's parameters (tables below) | Each shows its current value and a one-line hint |
| Publishes … | The exact tag paths this tool will create | Read-only |
Pass, fail and not judged
A tool only affects the verdict when Include this tool in the verdict is ticked. A tool that is not judged still reports its count, measurement or codes — it simply cannot fail the part.
| Tool kind | Passes when |
|---|---|
| Counting (Circles, Blobs) | The count is within Tolerance (+/-) of Expected count — 24 ± 1 passes 23, 24 and 25 |
| Measuring (Presence, Color match, Pattern match, Caliper, Circle gauge) | The value is ≥ At least (if set) and ≤ At most (if set). Limits are inclusive |
| Text (read & verify) | The text read equals It should say; or, with no expected text and Every character must be readable ticked, nothing came back as ? |
| Barcodes & QR codes | A code must contain is empty or found in the codes read (case-sensitive); and, if A code must be read is ticked, at least one code was read |
Three states, not two:
- Judged with nothing to judge against — a counting tool with Expected count 0, a measuring tool with both limit boxes empty, a text tool with no expected text and the "every character" box unticked, a barcode tool with neither option — reports as not judged. The card warns: "Judged with no expected count, so this tool reports as not judged. Set a target." / "Judged with no limits, so this tool reports as not judged. Set at least one."
- A tool that errored fails rather than reading not judged: something went wrong and the part has not been checked, which is not a pass.
- If no tool is judged, the device's
passtag is published with uncertain quality rather than reading true, and an alarm on it should not fire. Thejudgedtag says how many tools contributed.
The device's pass tag is true only when every judged tool passed. That is the tag to alarm on, and the one a reject gate or an andon should watch — not an individual count, which wobbles by one on detection noise.
Limits for measuring tools
- An empty box means no limit that way. 0 is a real limit, not "none".
- Set from this part reads the value on screen: for Presence, Color match and Pattern match it sets At least 10 points below the reading (not below 0) and leaves At most alone; for gauges it sets both limits 5% either side of the reading. It is a starting point, not an answer. Disabled until there is a reading ("Grab a frame first.").
- An upper limit catches a region drawn larger than the part.
Circles
Hough circle detection on a grayscale, blurred image.
| Slider | Default | Range | What it does |
|---|---|---|---|
| Min radius | 15 | 1–200 px | Ignore anything smaller. The cheapest way to stop shadows counting |
| Max radius | 60 | 2–400 px | Ignore anything larger, such as a tray edge |
| Edge threshold | 50 | 1–300 | Canny edge threshold (param1). Rarely needs changing |
| Sensitivity | 30 | 1–200 | Accumulator threshold (param2). Lower finds more circles, including ones that are not there. The one to reach for first |
| Min distance | 30 | 1–300 px | Minimum distance between centers. Stops one part being found twice |
| Blur | 9 | 3–31, odd | Smooths noise before detection. The slider steps by two |
Counting tools also have Expected count (≥ 0) and Tolerance (+/-) (≥ 0) under Pass / fail.
Blobs (any shape)
Separates foreground from background with a brightness threshold, cleans up, and counts connected shapes within an area window.
| Slider | Default | Range | What it does |
|---|---|---|---|
| Threshold | 0 | 0–255 | 0 lets the image choose (Otsu's method) — right under steady lighting, wrong the moment a shadow moves. Set a value when the lighting varies |
| Invert | 0 | 0–1 | 0 finds parts darker than the background; 1 for light parts on a dark background or a backlit setup |
| Min area | 200 | 0–50,000 px | Drops specks and noise |
| Max area | 0 | 0–200,000 px | 0 for no upper limit |
| Cleanup | 3 | 1–15, odd | Fills pinholes inside a part then drops specks between parts. 1 turns it off. Without it a part with a highlight on it can count as two |
| Blur | 5 | 3–31, odd | Smooths before thresholding |
The tool also publishes areaMin, areaMax and areaAvg — the sizes it actually counted, in pixels. A drifting average area is a part changing size, and worth trending.
Presence
Reports what percentage of the region is filled, not yes or no. A percentage can be watched while a good part is under the camera and the limits set from what it actually reads, and it degrades honestly — a half-seated cap reads 60% rather than flickering between present and absent.
| Slider | Default | Range | What it does |
|---|---|---|---|
| Threshold | 128 | 0–255 | Pixels darker than this (or lighter, with Invert) count as filled. 0 lets the image choose |
| Invert | 0 | 0–1 | 1 counts pixels lighter than the threshold |
| Cleanup | 3 | 1–15, odd | Removes specks. 1 turns it off |
| Blur | 5 | 3–31, odd | Smooths before thresholding |
It also publishes brightness (mean gray level 0–255) and contrast (standard deviation). When the fill collapses, they tell "the part is missing" from "the lamp is failing": both drop the fill, but only a failing lamp takes the brightness with it.
Tip: Keep a real threshold rather than 0. Automatic thresholding assumes two populations of brightness, and an empty fixture has only one — on a test image an empty tray read 44% filled and a tray with a part read 28%, which is backwards. The tool guards against this (a region with contrast below 8 is compared against mid-gray instead), but the dependable setting is a threshold between what a good part reads and what an empty fixture reads. The brightness and contrast readings are what you set it from.
Color match
Reports what percentage of the region is the target color. It works in hue rather than RGB, so a red cap stays red when the lamp dims.
| Slider | Default | Range | What it does |
|---|---|---|---|
| Target color | 0 | 0–179 | The hue to look for, on a 0–179 scale (half of the usual 0–360 degrees). 0 is red, about 30 yellow, 60 green, 120 blue |
| How close it must be | 10 | 1–90 | Hue distance that still counts. Wider catches shade variation; narrower tells two similar colors apart |
| Ignore below this saturation | 60 | 0–255 | Gray has no meaningful hue. Raise it if a shadow or a bare tray is matching |
| Ignore below this brightness | 40 | 0–255 | Near-black has no meaningful hue either |
| Blur | 5 | 3–31, odd | Smooths before matching |
Do not type a hue from memory. Put a good part under the camera, Grab one, and press Use the color in view: the card shows "Hue 4, saturation 180, brightness 150" for what is in the region, and the button copies the hue into Target color.
Hue is compared the short way round the circle, so red — which sits across the 179/0 join — matches correctly. A monochrome camera fails the tool with "This camera gives a monochrome image; color cannot be matched." rather than reporting 0%.
Worked example: cap check on a bottling line
Two tools on one camera, triggered by a part sensor.
- Tool 1, prefix
cap, Presence. Region round the neck. A capped bottle reads 85%, an uncapped one 12% at Threshold 110. At least 60. Judged. - Tool 2, prefix
color, Color match. Same region. Use the color in view on a red cap gives hue 2. How close it must be 8. A red cap reads 70%, a blue one 0%. At least 50. Judged. - Save. Alarm on
passgoing false; trendcap/brightnessto catch a failing lamp.