Optics & lighting

Component counting: lighting and ROI boundaries

Choose contrast that preserves separation, exclude tray features and define how border-touching components are handled in the count.

Send samples for engineering review
Component counting: lighting and ROI boundaries
Engineering illustration, not a photograph or measured result.

Inspection task

A counting mask must preserve each component without turning tray ribs into parts. Compare backlight for opaque silhouettes with diffuse overhead light when the tray cannot transmit light. Place the ROI beyond every valid component outline but decide explicitly what happens when a component crosses its boundary. An arbitrary crop can change the count without changing the physical contents.

Prerequisites and sample controls

State the expected number and what constitutes one physical component. Prepare correctly filled, short-filled and touching-part samples, with independently counted answers. The baseline counts separated connected regions, not hidden objects. A connected region can contain several touching parts, while a single shiny part can break into several regions. Keep these limitations in the sample definition before choosing a counting threshold.

Choose the camera route

Use an area-scan camera when the full tray fits in one triggered frame. Choose monochrome for silhouette contrast and color only for an actual color requirement. Motion during feeding calls for verified global-shutter timing or a settled capture position. A line-scan route needs motion reconstruction; it is not an automatic improvement for a stationary tray.

Run the controlled procedure

Use the same original parts when comparing light arrangements, and keep the camera, exposure and lens position fixed. Establish the region of interest in original-image coordinates and include every allowed loading position. A crop removes irrelevant background but cannot recover an invisible target. Check the full image before accepting a smaller ROI, especially when the fixture or part can move.

  1. Capture the same tray under two accessible light geometries.
  2. Inspect bright holes and dark bridges in the binary mask.
  3. Place a component across each ROI border as a failure control.
  4. Freeze light and ROI before adjusting component area filters.

Process map

Full-image inspection precedes ROI and area filtering. Light should preserve visible separation before regions are counted.

  1. Full image
  2. Light control
  3. ROI
  4. Visible target
Engineering illustration, not a photograph or measured result.
View full-size diagram

Record the evidence

For each arrangement, record eligible regions, excluded tray regions and border-crossing flags. In the stated 3-part example, keep the physical expected count at 3. A mask count of 3 is insufficient if a rib was counted and one part was missed.

Build a mask audit from physical part identity rather than final totals. Label the actual parts in the raw image using a separate annotation layer, then associate each eligible mask region with one of those parts. Where a region spans more than one label, record a merge; where several regions map to one part, record a split. Keep tray-only regions in a separate artifact class. Repeat this mapping for each light arrangement using the same physical tray contents. A correct total can contain a merge and an extra artifact that cancel numerically, so the audit must explain every individual contribution. Check internal holes and thin tips as well as outer silhouettes. A lighting arrangement that closes gaps or produces fragmented reflections should be rejected or explicitly bounded before any count rule is accepted.

Illustrative recording sheet; enter your own results
ControlRequired observationDecision boundary
N3: 3 separated parts3 eligible regions expected in this exampleCompare with independent physical count
N2: 2 separated parts2 eligible regions expected in this exampleShort fill; do not change the expected 3
T3: 3 touching partsRegion count may differ from 3Review; connected regions are not physical objects

Diagnose failed cases

Closing can join touching parts; opening can erase a small part or break a thin feature. Inspect before/after masks for each proposed kernel. Do not accept a morphological change solely because its final count happens to match the expectation.

Failure isolation

Compare split parts, joined parts and tray foreground. Matching the total does not prove correct individual regions.

  1. Separated
  2. Joined
  3. Split
  4. Tray feature
Engineering illustration, not a photograph or measured result.
View full-size diagram

Validate independently

Change only one light variable in each trial: geometry, intensity or ambient shielding. Compare raw image contrast, saturation and the resulting mask before changing a decision threshold. Save both the successful and unsuccessful arrangements. The useful choice is the one that separates relevant classes over the allowed variation, not the one that makes a single sample look attractive.

Verify independently separated small and large parts at every tray location. Treat border clipping as review or a defined loading failure; never count an invisible remainder by assumption.

Test the region boundary deliberately. Move a valid separated part so that its outline crosses the ROI, while keeping the rest of the tray unchanged. Observe whether the pipeline counts the partial region, rejects it or flags it for review; compare that behavior with the declared loading policy. Move the part fully inside again and verify recovery without changing thresholds. Then repeat the boundary test at another edge and inspect the original-coordinate mapping. Do not assume a crop-local border flag has the same meaning after scaling or rotation. If a morphological filter is proposed, run the border and touching controls through both the unchanged and modified masks. Acceptance of the filter requires preservation of the intended part identities and explicit handling of incomplete visibility, not merely a better total. Save the chosen light, ROI and operation sequence together.

Continue the engineering handoff

Provide the light arrangement, ROI coordinates, raw frames and masks for review. Explain whether the task requires a silhouette or a top-surface feature before selecting Deyi Vision lighting and optics. Do not silently resize a crop; any coordinate or scale conversion must be explicit in the saved workflow.

Save the original image and the resulting record together.

Sources and technical references

These references explain the methods and limits used in this tutorial. Example checks are guidance; production acceptance requires evidence from your own samples.

  1. Machine vision lighting basicsDeyi Vision

    Illumination geometry determines whether a surface feature or silhouette is visible.

    Checked
  2. Image thresholdingOpenCV

    Thresholding converts image intensity into a binary segmentation; this does not identify semantic objects.

    Checked

Engineering review

Bring the inspection problem and the evidence.

Send sample images, your current setup and the check that failed. Include field of view, working distance, line speed and acceptance criteria for a practical review.

Send samples for engineering review
Contact

Direct RFQ contact

Talk to engineering about the inspection problem.

Send sample images, competitor model, FOV, working distance and line speed before model selection.

Target: selection brief within 24h
Send sample images