A shiny bottle cap under a bare ring light or an overhead lamp hands an edge-based circle finder exactly what it wants: closed bright highlights with crisp gradients, and faint, broken cap edges. The algorithm is not failing; the image is. If you count caps, confirm presence or check closure seating on a tray of bottles, this troubleshooting guide walks the fix in the order that pays back: why the false circles appear, which light turns every cap into a uniform disc, how to size that light and the lens over it, and why a fixed-radius template then beats circle fitting. One worked example — a 6 × 4 tray of 28 mm twist-off caps on a 30 mm pitch — carries the arithmetic from magnification to strobe length.
Why does the circle finder lock onto glare instead of the caps?
Specular highlights form closed bright blobs with strong gradients on all sides, which is precisely the evidence a circle fit needs, so your Hough transform or edge fitter is working correctly on bad input: the image, not the algorithm, is failing.
The causes, most likely first:
A light at the mirror angle. Put your eye where the lens is and look at the tray: every bright thing you see reflected in a cap is in the picture too. The law of reflection sends light from the ring, the ceiling tube or a white sleeve straight into the camera, and a curved crown sweeps that angle continuously, so the glare band slides with every bottle. The same geometry decides bright field versus dark field lighting, and near-on-axis light on a curved specular surface is its worst case.
Ambient light you do not control. Switch the station light off and grab one frame; any highlight that survives is ambient, and it will wander as lamps age and skylights change.
One-sided illumination. Light from a single sector leaves the cap edge bright on one side and dark on the other, so the fitter closes partial arcs across the glare and returns radii between the cap and the highlight. Camera, light and part positions fix this — lighting geometry for image contrast covers the placements.
Low contrast on a small target. In one failing snapshot a cap spans a 35 pixel radius — about 220 pixels of edge — while the highlight core sits saturated at 255 and the true edge rises only a few gray levels above the neck. The transform votes for the glare with far more confidence than for the cap.
The one test that separates all four: draw a line profile across the brightest cap. Healthy input shows a flat plateau on the disc, a clean step of at least 60 gray levels, and a background with no spikes. Glare breaks all three, and no threshold repairs it.
What light turns a shiny cap into a uniform bright disc?
A diffuse dome light does it: it surrounds the cap with even light from every azimuth, so the curved specular crown reflects brightness toward the lens from all of its facets at once and the cap images as one flat, featureless disc.
The dome wall is the light source, and a convex mirror always shows you part of whatever surrounds it. From every point on the crown some part of that bright wall reflects into the lens, so brightness evens out and highlights disappear — the cloudy-day effect. Matte surroundings reflect only a fraction of the dome diffusely and stay dark, which is exactly the contrast you want: bright disc, dark field, nothing at 255.
Two placement rules keep the disc clean. Sit the cap deep enough that the shadow of the camera hole does not fall on it — that center dark spot is the classic dome artifact, and the camera-hole dark spot fix gives the geometry. And give the dome margin, because a dome narrower than about twice the lit width starves the outer caps of side light and the glare returns at the tray edges. For depth on curved and mirrored surfaces, see dome lights for shiny, curved and wrinkled parts.
For one lane of caps or a small cluster the compact class is enough. The LS-DOM-0085 is a Ø166 mm dome light with a Ø116 mm emitting area.
- Size
- 100-200 mm
- Voltage
- 24 V
Dome or coaxial light: which fits which cap?
Curved caps belong under a dome, flat caps under coaxial: coaxial light returns to the camera only from surfaces perpendicular to the lens axis, so a curved crown shows a bright center with dark edges that move with tilt.
A coaxial unit places a half-mirror at 45° in front of the lens. Light enters from the side, turns down the axis, and only a target that is flat and square to that axis sends it back to the sensor. A flat foil lid lights evenly and every engraving reads dark; a crowned metal cap throws the light off at angles that change with each bottle's tilt, so its rim flickers frame to frame — poison for a fixed template. On mirror-flat lids, watch for the hotspot a coaxial point source leaves behind.
| Cap style | Light that wins | Image you get | Main risk |
|---|---|---|---|
| Curved metal crown cap | Dome | Flat bright disc, dark bottle mouth | Camera-hole shadow when too close |
| Domed plastic closure | Dome | Bright disc, quiet knurl | Edge glare if the dome is undersized |
| Flat foil lid or flat cap | Coaxial | Even bright lid, marks read dark | Hot spot if the lid is mirror-flat |
| Matte plastic cap | Directional ring at 30-45° | Shaded but stable silhouette | Dome returns too little light |
Most lines start from a diffused ring because it is already on the bracket. A diffuser softens the LED points into an annulus but cannot fill a curved specular crown; the LS-RNG-0143 is a 100 mm ring light with a diffuser at 30°, and it is a common starting point rather than a fix. For flat closures the coaxial candidate is the LS-CXL-0019, an 80 x 80 mm narrow-angle coaxial light.
- Size
- 50-100 mm
- Voltage
- 24 V
The decision in one line: crowns and domed closures go on the dome, flat lids go to the coaxial lights range, matte caps go directional. The three parts side by side:
| Specification | LS-RNG-0143 | LS-DOM-0085 | LS-CXL-0019 |
|---|---|---|---|
| Wavelength | red: 620-635 nm; blue: 465-470 nm; green: 525-530 nm | Red: 620-630 nm; Blue: 460-475 nm; Green: 520-530 nm; infrared and UV: made to the wavelength you state in the cart note | – |
| Cable length | 0.5 m | 500 mm | 500 mm |
| Pin assignment | 1: + (red), 2: not connected, 3: − (black) | 1: (+), 2: NC, 3: (-) | – |
| Cooling | Natural air cooling | – | Fan (fan and light powered independently) |
| Lifespan | 50,000 h (red), 30,000 h (white), to 50 % of the initial brightness | – | 50000 h (to 50% of factory default luminance) |
| Inner diameter (mm) | 55 | 35 mm | – |
| Outer diameter (mm) | 100 | 166 | – |
| Price | $169.00 | from $409.00 | $369.00 |
Values as printed in each product's data sheet; open a part for its drawing and full specifications.
How big a dome and which lens for a tray of touching caps?
For a tray, the dome's emitting width should be at least twice the width you light — 180 mm of tray needs a 360 mm dome or more — and the lens follows from the field of view, never the other way round.
Dome first. If light from every azimuth cannot reach the outer caps, they behave as if they sat under a partial ring, and glare reappears at the tray edges. One dome from the 400 mm class covers the whole tray in a single shot; the alternative is two shots under a 200 mm class dome. The LS-DOM-0062 is a 3.0 dome light with a 194 mm outer diameter, which lights about half of this tray per exposure.
- Size
- 100-200 mm
- Voltage
- 24 V
Then the lens, on the worked tray: 6 × 4 bottles standing touch to touch, 28 mm twist-off caps on a 30 mm pitch, so the caps occupy 180 mm × 120 mm and a 200 mm × 150 mm field of view leaves margin for tray positioning. Camera: 2048 × 1536 pixels at 3.45 µm, which is 7.1 mm × 5.3 mm of sensor.
A 12 mm lens at a 350 mm working distance delivers the field. Scale the other way: 200 mm / 2048 px = 0.098 mm per pixel, so a 28 mm cap spans 28 / 0.098 = 286 px across — a 143 px radius for the template, with ±8 px of tolerance for tilt and crown height. The same tray runs through the lens focal length calculator if your camera differs.
That failing 35 pixel-radius snapshot was under-magnified as well as glare-broken: 28 mm across 70 px is 0.4 mm per pixel, so the same 2048 pixel camera was staring at roughly an 820 mm field of view — more than four times too wide for this tray.
Why does a fixed-radius template now beat circle fitting?
Because every cap images at nearly the same radius once the camera is fixed, a single fixed-radius template turns the search into a correlation match that ignores faint arcs, and it keeps working when cap brightness varies; a 35 pixel radius template is enough to lock a cap.
With the tray stopped at a known distance, radius stops being a free variable: it is 143 px for every cap, ±8 px for tilt. A normalized-correlation template of the disc scores high on caps and low on everything else, with no accumulator thresholds for glare to poison. Circle fitting earns its keep when radius or count is unknown — caps in random positions, mixed bottle sizes on one line — and then it runs on the corrected image: live feed circle detection with a circle Hough transform covers the set-up, and reading center and radius from the Hough result array covers the output.
A blob check cross-validates the template: threshold midway between cap and background gray and keep blobs within 15% of π × 143² ≈ 64,000 px². And because the bottles touch on a fixed pitch, the caps sit on a lattice, so a missing cap is an empty node rather than a failed fit — the FAQ gives that check with its grid number.
Decision: stopped tray, one cap size — template match plus lattice check. Random positions, mixed sizes — Hough on the dome-lit image.
How fast an exposure and which f-number hold the edge?
At 0.098 mm per pixel, a tray moving 150 mm per second blurs 7.7 pixels during a 5 ms exposure, so either stop the tray and expose 2 to 5 ms, or strobe the dome for 100 µs and cut the blur to about 0.15 pixel.
The arithmetic for the moving case: 150 mm/s × 5 ms = 0.75 mm of travel, and 0.75 / 0.098 = 7.7 px of smear. The disc survives but its edge gradient halves and the fitted radius wanders between frames. Strobed at 100 µs the tray covers 0.015 mm, about 0.15 px, and the flash outruns the room: for its 100 µs the dome is hundreds of times brighter than the ceiling, so ambient light drops out of the image. Keep a shroud anyway.
Aperture: f/5.6. Depth of field at this magnification, with the circle of confusion set to two pixels (2 × 3.45 µm = 6.9 µm):
Crowns within ±5 mm of nominal — fill-height variation, a skewed crate — sit well inside that 64 mm, so one focus setting covers the tray. Opening below f/4 buys nothing at this magnification, and stopping past f/8 spends light on depth of field you already have.
What should I check before ordering the light?
Check four numbers before you order: the widest area you must light, the dome emitting width at twice that figure, the cap diameter in pixels your lens delivers, and the controller current needed to strobe at your exposure.
- Lit width versus dome width. 180 mm of tray means a 360 mm dome, or split the tray into two shots. Undersizing is the mistake that brings the glare back at the edges.
- Cap size in pixels. 200 px across is the floor for counting and presence; the 286 px of this example supports radius work. Measure a corner cap, not just the center one.
- Gray separation. A line profile across the dimmest cap needs a 60 gray-level step and no pixel at 255 on the disc.
- Camera hole versus lens. The dome aperture must clear the lens barrel plus any polarizer ring you may add later.
- Strobe budget. The controller channel must source the dome current at a 100 µs pulse with headroom; every light in the dome lights range runs on 24 V, so size the supply for the channel.
With the numbers set, the lighting finder filters by size and colour, and the light step of the configurator turns the choice into a parts list.
The configurator matches a camera, lens, light, light controller and cables to each other, step by step, and lists only parts that fit what you already picked.
When is a dome the wrong light for this job?
A dome is the wrong fix for matte plastic caps, for trays wider than roughly 400 mm, and for continuously moving product: matte caps scatter the light instead of mirroring it, and a dome big enough for a moving line costs more than the alternatives.
Matte caps need direction, not diffusion — a standard ring at 30-45° from the ring lights range gives a stable shaded disc where a dome gives a murk. For glare on plastic you cannot reposition, crossed polarizers on lens and light remove the specular bounce for about two stops of exposure. On a continuously moving conveyor, line scan takes over and long domes suit the geometry — the catalog carries the LS-DOM-0021, a dome light 931.4 mm long. And when the question is the whole bottle rather than its cap, start from bottle recognition lighting or glass bottle defect detection.
More lighting decisions like this one are indexed under machine vision lighting. Bring the tray width, cap diameter and camera model to the contact page and we will size the dome, lens and strobe in one pass.
Questions
Can I fix the false circles by tuning the Hough thresholds instead of the lighting?
Not for long. Glare blobs and real cap edges land in the same accumulator range, so a threshold that rejects the highlights also rejects the fainter true edges on the next batch of bottles, when the finish or the fill height changes. Threshold tuning is a lab-trial tool; production stability comes from lighting that removes the highlights outright.
Will a diffuser on my existing ring light be enough?
Sometimes, for flat matte caps: a diffuser ring turns point LEDs into a soft annulus and shrinks hot spots. It cannot fix a curved specular crown, because light still arrives from one narrow cone of angles, and the cap's facets aim most of it away from the lens. If a diffuser ring cleans the image in a bench trial, keep it; if a bright patch still slides across the crown, that is the signal to move to a dome.
How many pixels across should a bottle cap be?
Two hundred pixels diameter is the floor for counting and presence, three hundred for fitting a radius or checking ovality. Below about one hundred pixels the edge position wanders a pixel or two, and a one pixel edge error is two percent of a fifty pixel radius, so the fit follows the noise. In the tray example a 28 mm cap covers 286 px, which leaves the fixed-radius template a comfortable margin.
Does cross polarization help on bottle caps?
Crossed polarizers remove specular glare from plastic and metal caps alike, but they work by removing exactly the reflection that makes a shiny cap bright, so the cap often reads as a dark disc on a mid-gray field — usable for counting, weak for cap quality checks. They also cost roughly two stops of exposure, so strobe headroom shrinks. A dome reaches bright cap on dark background directly, with almost no light thrown away.
Can the bottle array itself confirm which caps are missing?
Yes, and it is the strongest confirmation. Once the pitch is known, a cap belongs at every lattice point: threshold the bright discs, then check occupancy at each expected position. With a 30 mm pitch at 0.098 mm per pixel that is a 306 px grid, and any empty node is a missing cap without a single circle fit. Run it beside the template match — the two disagree on a tilted cap, which is exactly the frame to review.


