Purpose and operating boundary
Compare product color on a stable object region while keeping shadows, specular highlights and colored background from silently redefining the sample.
This tutorial defines an engineering evaluation, not a ready-to-run product certification. The current Deyi Vision public PC example covers an EAN-13 workflow on confirmed sample images. Native OCR and detection work in the engineering code must be checked against the installed runtime, bound models and job before use. A browser template does not prove browser execution: the planned OpenCV.js backend needs separate verification. Cloud recognition requires explicit approval of the image scope, provider, model and cost. A review archive is not an executable release package. Camera, firmware and driver compatibility require their own check. All worksheet values below are hypothetical; they are not Deyi Vision measurements or customer results.
Prepare the evidence
Prepare a neutral target and representative product shapes under the proposed diffuse light. Define which surface patch represents the intended class before viewing the classification results. Repeat the selected condition after restoring the fixture, not merely while leaving everything untouched. This reveals whether the recipe can be reproduced during changeover. Record ambient-light state and the time since illumination was enabled when these affect the image. Do not compare measurements taken from different masks or different bit-depth conversions as though only lighting changed. Keep the rejected optical condition in the record, including its image and the reason for rejection. A visually attractive image is not automatically the best inspection image: the selected condition must preserve the relevant feature and its separation from acceptable variation over the full agreed sample range. Color sorting and SKU recognition answer different questions. A color region may match a red reference while the item is the wrong size, label or package variant. Define whether the job sorts a physical color, verifies an expected SKU or requires both independent checks. Use color images with known channel order and keep exposure, white balance and light spectrum in the recipe. Test acceptable material lots, glossy surfaces, shadows and foreign products rather than only a clean reference swatch. Low saturation makes hue unreliable, and clipped highlights remove information that an algorithm cannot restore. Unknown, unobservable and mixed-color items need an explicit route. If semantic SKU recognition uses a model, validate that model separately from the color threshold and require approval before any cloud transfer. Build a controlled optical comparison before moving the threshold. Mark the fixture, working distance, light angle and focus so that each condition can be restored. Change only the selected lighting or region variable while holding the camera settings and sample identity fixed. Retain the entire source frame beside every crop or mask, with the transform back to source coordinates. Capture both acceptable variation and a known problematic sample, including the edge of the allowed placement range. Inspect the region overlay on the original image before interpreting a numeric result. A smaller region can hide a failure rather than improve inspection, so excluded areas need an explicit engineering reason.
Procedure
- Compare illumination with fixed camera settings and check the neutral patch for channel imbalance or clipping.
- Locate the object, map its mask to source coordinates and exclude known background without cutting off class-defining material.
- Record the valid object-pixel count and inspect glare/shadow exclusions on the original; never remove a difficult patch solely because it causes the wrong class.
- Save baseline and candidate masks on the same specimens, then repeat with pose and finish changes before freezing the ROI.
Interpret the trial
In the hypothetical mask record, the frame has 2000 pixels in the trial window but only 1000 valid object pixels. A color count of 600 must use the object denominator, yielding 60%, rather than 30% from the whole window. Mask construction therefore changes the meaning of the ratio; the excluded pixels and their reasons must remain auditable.
Recording worksheet
| Record | Value / observation | Interpretation |
|---|---|---|
| Window / valid object | 2000 / 1000 px | Object mask defines denominator |
| Color pixel count | 600 px | 60% object; 30% window |
object_ratio = 600 / 1000 = 60%
window_ratio = 600 / 2000 = 30%Two engineering views
Two engineering views · 1
The diagram shows the order of checks. Each arrow requires recorded evidence; it does not imply an implemented automatic connection. Source frame → Light condition → ROI → Contrast.
- Source frame
- Light condition
- ROI
- Contrast
Two engineering views · 2
The diagram shows the order of checks. Each arrow requires recorded evidence; it does not imply an implemented automatic connection. Baseline → Candidate → Same sample → Decision.
- Baseline
- Candidate
- Same sample
- Decision
Failure diagnosis
- A colored conveyor occupying the ROI can dominate the color result.
- A highlight exclusion that erases most of the colored surface should produce an insufficient-evidence result, not a forced known class.
Acceptance and handover
Accept illumination and geometry when the intended material remains observable and the denominator is stable under declared variation. Keep color thresholds and semantic SKU recognition for the next stage.
Keep the source images, the expected decision, the exact revision and the complete result record together. Freeze the evaluation set before selecting the final parameters. If those answers are later used to tune the workflow, mark that set as development data and obtain a new independent acceptance set. Keep Review, NoResult, execution error and missing acquisition visible in the denominator; do not turn them into passes by filtering rows. Save a reproducible failure alongside the successful sample. The handover should identify who may change the recipe, how a prior approved revision is restored and which device output remains inhibited until acceptance. A software result alone does not establish that a moving physical part reached the correct destination.
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.
- Deyi Vision machine vision software: evaluation scopeDeyi Vision
Public EAN-13 PC evaluation scope and separate hardware/production acceptance.
Checked - Thresholding Operations using inRangeOpenCV
HSV conversion and explicit channel ranges; not proof of Deyi runtime support.
Checked - Color Space ConversionsOpenCV
Explicit input channel order and depth-dependent color conversion semantics.
Checked - Geometric Image TransformationsOpenCV
Source/destination coordinate mappings, affine/perspective transformations and interpolation; image geometry does not certify an installed Deyi executor.
Checked
Component and selection references
- Machine Vision Lighting
- Automated Visual Inspection
- Visual Inspection System Design Checklist
- How to Choose Machine Vision Lighting
- Machine Vision Lighting Types
- Machine Vision Lighting Basics
- Reflective Metal Scratch Inspection Lighting Route
- Backlight vs Coaxial Lighting
- Automotive Metal Surface Defect Inspection
- Metal and Surface Inspection
- OPT Lighting Alternative
- EAN-13 traceability: lighting and quiet zones
- Lighting and ROI for a visible liquid boundary
- Calibrate flat-field shading without hiding bad data
- Compare red, blue and white illumination by defect contrast
- OCR labels: light and field geometry
- Choose lighting and ROI for open-package contents
- Run a polarization A/B test for glare
- Seal and bead appearance: lighting and ROI
- Verify the optical strobe inside the exposure window
- Surface defects: acceptance and line output
- Surface defects: bounded AI evaluation
- Surface defects: camera sampling and motion
- Surface defects: light and ROI validation
- Surface defects: false-alarm diagnosis

