A robot cell has been picking one part and filling a two-layer tray with it. The part now arrives in two orientations — one face light, one face dark, at random — and the top layer may contain only parts placed dark face up. The conveyors under the four robots run in opposite directions, so giving two robots the bottom layer and two the top fights the material flow. This guide takes the other route: classify each part by the mean gray value of its blob, give the two variants separate item types, and let every robot pick to match the type of the next place target. You will size the imaging, set up the items and the layers, and verify the sort before release.
The decision: match the item type on every pick
Do not divide the robots between the layers. Divide the parts between the layers, and let any robot pick either. The tray manager already knows the layer sequence; what it needs from vision is a type on every candidate part.
Give the light-face variant item type 1 and the dark-face variant item type 2. Bind layer 1 of the tray to type 1 and layer 2 to type 2. Keep strict fill order switched on so the bottom layer completes first — but be clear about what strictness does: it sequences the layers, it does not check content. A robot holding a light-face part will start the top layer one cell early unless a type gate stops it. The gate is one question asked before every pick: what type does the next place target need?
This is the same pattern as barcode verification before picking — identity is confirmed at the source, and the place side refuses what does not match. It also survives the loss of a robot, because the remaining three keep filling both layers; a robot-per-layer split cannot. Related cell-level decisions are collected in the vision systems topic page.
Classify the face by mean gray value
Run one blob search that finds the part either way up, then take the mean gray value inside each blob. The mean is the right feature: it is one number, it does not care how the part is rotated, and averaging over thousands of pixels suppresses sensor noise to nothing. A histogram adds little for a flat face, because both faces image as a single peak and the mean locates each peak exactly. Blob detection is the standard tool family for this step.
Classify light when the mean sits above the threshold, dark when it sits below, and reject outright inside a ±5 level dead band. A part classified on the boundary flips between presentations; a part read as neither rides past and is picked up on a later pass.
Three checks decide whether a mean will work on your part. If the variants also differ in size, gate on dimensions as well — the approach in part identification by dimensions. If the faces are curved and shiny, a specular highlight drags the mean around; light them the way dome lights for shiny, curved and wrinkled parts describes, or the mean measures the highlight, not the face. If the belt background varies along the conveyor, segment with local mean adaptive thresholding before you take the blob mean.
Numbers to commit to, on the 0-255 scale: a gap of 40 gray levels between the face means supports a fixed threshold, 60 or more also gives you a warning band, and below 25 you fix the lighting first, because no classifier separates what the light does not distinguish.
Freeze the light and the exposure
A fixed threshold only holds while image brightness is fixed. Lock the exposure time, lock the gain, and switch off auto exposure; on a color camera switch off auto white balance too. The brightness those auto functions remove is exactly the signal you classify on. If part of the process forces auto exposure, set an auto exposure brightness target for inspection instead of letting it float, and re-check your threshold against that target. Ambient light on the belt is the other half of the problem, and it is the whole subject of monochrome color sorting under changing ambient light.
Geometry matters as much as settings. Mount two diffused bar lights from opposite sides at 30 to 45 degrees, so a part rotating on the belt sees the same brightness at any yaw angle. One hard light from one side makes brightness track part orientation rather than face — the classic way this sort fails. Shroud the station from overhead factory light and strobe the bars with the exposure, so the part is frozen and ambient light contributes nothing.
One diffused white bar per side, at 24 V, covers most belt widths:
- Size
- 200-400 mm
- Type
- Diffused
- Voltage
- 24 V
For strobed exposures near 1 ms on wide conveyors, step up to a high-luminance bar so the image reaches working brightness inside the strobe pulse. The LS-BAR-0400, 312 x 30 mm at 24 V, is that class of light. Browse the whole range in bar lights or the light finder.
What you need
- A mono camera over the pick conveyor, seeing the full belt width plus margin — area scan cameras, or smart cameras for a self-contained station.
- Two opposing diffused bar lights, strobed, or a dome when the faces are curved.
- A tray manager that carries an item type on every place item and lets the robot program query it.
- 50 parts of each face for teaching and testing, and a shroud for the station.
A compact single-belt station runs without a host: a smart camera with its own polarized white light, such as the LS-SMC-0063 — 1.6 MP, 60 fps, 16 mm lens — classifies on board and reports the type over GigE.
- Interface
- GigE
- Resolution
- Up to 3 MP
Where one head must switch light color between surfaces, this smart camera carries a multi-color light source and a global shutter:
- Interface
- GigE
- Resolution
- 5 MP
- Sensor format
- 1/1.45"
- Shutter
- Global
And where the same head will later read print or measure edges, a 20 MP USB3 mono camera leaves room to crop:
| Specification | LS-SMC-0063 | MV-SC6050C-08M-XBN | MV-CS200-10UM |
|---|---|---|---|
| Data interface | GigE | Gigabit Ethernet (1000 Mbit/s) | USB3.0, compatible with USB2.0 |
| Resolution | 1440x1080 | 2432 × 2048 | 5472 × 3648 |
| Max. frame rate | 60 fps | 80 fps | 19.2 fps @ 5472 × 3648 Mono 8 |
| Digital I/O | RS232, 2 Opto-isolated inputs, 3 Opto-isolated outputs | 17-pin M12 connector provides power and I/O, including opto-isolated input × 2 (Line 0/1), opto-isolated output × 2 (Line 4/5), configurable non-isolated input/output × 2 (Line 2/3), RS-232 × 1, and light source output (max. 30 W) × 1 | 6-pin P7 connector provides power and I/O, including opto-isolated input × 1 (Line 0), opto-isolated output × 1(Line 1), bi-directional non-isolated I/O × 1 (Line 2) |
| Power supply | 9-26 V DC 2 A | 24 VDC | 9 VDC to 24 VDC, supports USB3.0 power supply |
| Power consumption | <18 W | External light source and built-in light source cannot be used at the same time; Avg. 12 W @ 24 VDC (with no external light source and the built-in light source disabled); Avg. 42 W @ 24 VDC (with external light source); Avg. 16.6 W @ 24 VDC (built-in light source is enabled); Max. 18 W @ 24 VDC (with no external light source and the built-in light source disabled); Max. 48 W @ 24 VDC (with external light source or the built-in light source enabled) | Typ. 2.3 W @ 5 VDC (USB3.0 provides power supply) |
| Weight | <350 g | Approx. 750 g (1.7 lb.) | Approx. 80 g (0.18 lb.) |
| Ingress protection | IP65 | IP67 (under proper installation of waterproof lens cap) | IP40 (under proper lens installation and wiring) |
| Humidity | 20%-95%, no condensation | 20% RH to 95% RH (no condensation) | 20% RH to 95% RH (no condensation) |
| Sensor type | – | CMOS, global shutter | CMOS, rolling shutter |
| Pixel size | – | 3.45 μm × 3.45 μm | 2.4 μm × 2.4 μm |
| Sensor size | – | 1/1.45" | 1" |
| Price | $1,110.00 | $3,449.00 · quoted | $759.00 |
Values as printed in each product's data sheet; open a part for its drawing and full specifications.
Both families are filterable in the camera finder.
Worked example: light and dark faces on a 300 mm belt
Inputs, each from the line or from a measurement:
- Belt: 300 mm of usable width, parts landing anywhere across it.
- Part: cylindrical, 40 mm face diameter, measured with calipers.
- Camera: 1.6 MP in 4:3, about 1440 x 1090 pixels, mounted to see the full belt width.
- Belt speed 120 mm/s; strobed exposure 1 ms.
- Test run of 50 parts per face under the production light: light face mean 148, dark face mean 62.
Scale and blob size:
- 1440 px across 300 mm = 4.8 px/mm.
- The face spans 40 x 4.8 = 192 px, so a circular blob holds 0.785 x 192² ≈ 28,900 pixels.
- Motion during exposure: 120 mm/s x 0.001 s = 0.12 mm, which is 0.12 x 4.8 ≈ 0.6 px of blur — under the 1 px rule, so the 1 ms exposure stands. At 240 mm/s the same exposure gives 1.2 px; halve the exposure and raise strobe output rather than accept the blur.
Put your own figures through the resolution calculator:
Threshold and margin:
- threshold = (148 + 62) / 2 = 105
- margin = (148 - 62) / 2 = 43 levels per face
- Pixel noise near 4 levels per pixel moves the blob mean by 4 / √28,900 ≈ 0.02 levels. Sensor noise is irrelevant here; lighting drift decides the sort.
- Both faces drift together under ambient change, so classification holds until common drift approaches ±40 levels. The alarm you set at ±10 trips far earlier.
Throughput: the tray holds 12 cells per layer in a 4 x 3 pattern. With faces arriving 50/50, expect to present about 24 parts to gather the 12 dark-face-up parts for the top layer, while the bottom layer takes the 12 light faces among them. Size the infeed buffer for two layers of parts, not one.
The decision, in one table:
| Mean gray (0-255) | Classification | Item type | Goes to | Codes |
|---|---|---|---|---|
| 110 and above | light face up | 1 | layer 1 | accept 1 / reject 3 |
| 100 and below | dark face up | 2 | layer 2 | accept 2 / reject 4 |
| 101 to 109 | neither | none | rides past | logged as reject |
With a 43-level margin and a ±5 dead band, this is a commitment, not a hope: release testing must show zero misclassifications on 200 mixed parts. If you also want the face confirmed at place time, SMT component orientation measurement is the same up-or-down judgment at higher precision.
Step by step: items, layers and the pick logic
- Teach one blob model that finds the part in either orientation, with the blob mean gray value as its classification feature.
- Create two item models on that search: light face = item type 1, dark face = item type 2.
- Assign distinct codes: light accepts with 1 and rejects with 3; dark accepts with 2 and rejects with 4. Downstream stations route on these codes.
- In the tray editor, bind layer 1 to item type 1 and layer 2 to item type 2, and keep strict fill order on.
- Add the type query to the pick routine. Most tray managers expose the next place target's type as a call.
- Constrain the pick to that type: vision releases only a candidate whose classified type equals the requested one.
- On no match, the robot waits for the next part — never place a wrong type to protect cycle time.
- Reject parts read as neither, with their code, and let them ride past; do not retry them in the same pass.
- At place, let the tray manager re-check the type; a mismatch raises an exception and routes the part out.
- Log the gray mean with every pick, and alarm when the running mean of either class moves 10 levels from its taught value.
The query and the constrained pick, in outline:
place_type = next_place_target_type(tray)
part = find_part(vision, item_type = place_type)
if part found:
pick_and_place(part)
else:
wait for the next part
When a PLC sequences the cell instead of the tray manager, PLC ladder logic for vision-guided part sorting implements the same request-and-match handshake in ladder.
Verify before you release
- Feed 200 parts in randomized 50/50 order. Zero misclassifications is the pass bar: at a 43-level margin, a miss is a lighting fault, not statistics.
- Complete two trays, invert the top layer, and confirm every part shows the dark face.
- Disturb the station on purpose — switch off one bar (the drift alarm must trip before any miss), open the shroud, feed one edge-on part.
- Restart the cell mid-tray; layer types and fill order must survive the power cycle.
- Close the loop downstream with post-placement vision inspection after conveyor picking, so a wrong-face placement is caught even if a check lets one through.
When the usual answers are wrong
- Robots per layer. On opposing conveyors, the upstream robots receive parts first but must wait for the layer beneath them, idling half the cell; losing any robot stops the tray. Type matching per pick has neither problem.
- Strict fill order alone. Strictness sequences layers; it never inspects content. The day a light-face part reaches the top layer, strict order places it.
- Auto exposure or auto white balance. Both re-bias the image every frame, so the fixed threshold drifts silently until the sort inverts. Lock them.
- One hard side light. Brightness then tracks yaw: a light face rotated 90 degrees can read darker than a dark face square to the light. Two opposing diffused bars remove the effect.
- No dead band. Parts near the threshold flip between presentations; rejecting ±5 levels costs a pass, flipping costs a wrong layer.
- Textured faces. When the two faces differ as textures rather than shades, a scalar mean is the wrong feature; that is the case for classifying irregular objects by appearance.
The same missing gate is why vision sorting sends parts to the wrong chute on conveyor sorters: routing that trusts position over verified type leaks under every disturbance.
Checklist: two variants into a two-layer tray
Imaging
- Face-mean gap at least 40 gray levels, measured under the production light — the number the whole sort stands on.
- Exposure, gain and white balance locked; drift alarm at ±10 levels on the running mean of each class.
- Two opposing diffused bars, strobed; shroud fitted; blur under 1 px at line speed.
Configuration
- Item types 1 and 2 taught in one shift; accept and reject codes 1/3 and 2/4 assigned.
- Layer 1 bound to type 1, layer 2 to type 2; strict fill order on — sequencing content is the type gate's job.
- The pick asks the next place target's type; no match waits, and a neither-class part rides past.
Release
- 200-part mixed test at zero misses; two trays inverted and confirmed dark side up.
- Place re-checks type; a mismatch stops the placement and routes the part out.
- Zone sharing re-validated after any routing change.
Build the station in the configurator, starting at the camera, or send one snapshot of each face through the contact page and we will mark where your threshold lands.
Questions
Do I need to dedicate robots to each tray layer?
No. Bind each layer to an item type and let every robot query the type of the next place target before picking. Any robot then fills any layer, which keeps the line running when conveyors oppose each other or a robot is down. Dedicating robots to layers only works when material flow happens to match layer order; on opposing conveyors the upstream robots must wait for the layer beneath, idling half the cell.
What gray value threshold should separate the two faces?
Measure both faces under the production light, then set the threshold halfway between the two means: with means of 148 and 62 on the 0-255 scale, the threshold is 105 and each face sits 43 levels from it. Commit to a fixed threshold when the gap is at least 40 levels; below 25, change the lighting, because no software setting separates what the light does not. Re-measure after any change of lamp, lens or exposure.
How many pixels does the part need for a stable mean?
Far fewer than you need for guidance. The mean averages pixel noise down: over a blob of about 28,900 pixels, noise of 4 levels per pixel contributes about 0.02 levels to the mean, so classification is limited by lighting drift, not resolution. Let pick accuracy set the pixel count; the face only needs enough pixels that the blob tool segments it cleanly, in practice a few hundred pixels of blob area.
Will ambient light or a dirty lens break the sort?
Slow, common shifts move both faces together, so the midpoint threshold tolerates them until the gap closes: with a 43-level margin, drift of up to about ±40 levels still sorts correctly. Strobing the light and shrouding the belt cut the drift at its source, and an alarm on the running gray mean of each class warns long before a miss. A dirty lens reduces contrast gradually — track the margin, not just pass counts.
What happens when the wrong part reaches a place position?
The type check fails and the controller raises an exception instead of placing. Route that part to a rework position and log its reject code — the accept and reject codes you assigned per item type exist exactly for this. A wrong-face part in the top layer is the failure the sort was built to prevent, so the place step must refuse and stop, never warn and continue.
Can the bottom layer take either face instead of only light faces?
Yes, when the arrival mix allows it. Letting layer 1 accept both faces is safe while dark-face parts arrive in surplus; once dark parts are under about 40 percent of arrivals, a light-typed bottom layer and a dark-typed top layer starve one another and trays stop completing. The safe default is to type both layers and let unmatched parts ride past; relax layer 1 only after logging the real face split for a full shift.


