A difference between average RGB values can describe an overall color shift, but it cannot reliably locate a stain, separate illumination drift from material change, or preserve every difference within a patterned surface. The useful measurement depends on what should make the part fail. For inspection and process-control work, start by defining that decision, then choose a region statistic or an aligned color-difference map. The workflow below covers acquisition controls, color conversion, numerical examples, and acceptance checks.
Choose the measurement from the failure condition
Use region averages when the inspected surface is reasonably uniform and its overall shade determines acceptance. Use spatial measurements when a small discolored patch matters, or when different areas must retain different colors.
Comparing entire images without defining the inspected material usually mixes several effects: background, shadows, part position, surface finish, and actual material color.
| Inspection question | Useful starting measurement | Main limitation |
|---|---|---|
| Has a uniform coating changed overall shade? | Difference between representative region colors in Lab | Small defects can disappear inside the average |
| Is there a local stain or discoloration? | Aligned pixelwise Delta E map with connected-region measurements | Position errors create apparent differences |
| Are separate printed areas the correct colors? | Separate region measurements for each printed area | Requires reliable identification of each area |
| Is the overall color distribution different? | Color histogram or distribution comparison | Similar distributions can have different spatial arrangements |
| Has image structure changed? | Structural comparison alongside color measurements | A structural score is not a color tolerance |
Mean RGB is a useful diagnostic descriptor when acquisition settings and image encoding remain unchanged. It is not a universal acceptance metric. Channel values do not form a perceptually uniform distance scale, and averaging discards location.
This task also differs from deciding whether monochrome intensity can separate colored parts. The guide to monochrome sorting under changing ambient light addresses that separate acquisition decision.
Stabilize lighting and camera settings first
A color measurement is only meaningful relative to its acquisition conditions. Fix the camera, part position, illumination geometry, exposure, gain, white balance, and processing settings before collecting reference images.
Disable automatic adjustments during the comparison unless the complete adjustment method is deliberately part of your validated process. Otherwise, a camera may change its response between the reference and production image. For settings that cannot be applied as expected, use the checks in diagnosing rejected color-stream exposure settings.
Record these conditions with the inspection recipe:
- Illumination type, output setting, operating mode, and warm-up procedure.
- Camera exposure, gain, white balance, pixel format, and color-processing settings.
- Lens aperture, working distance, focus, and part presentation.
- Reference target identity and the processing version used for comparison.
Exclude changing daylight and nearby indicator lights. Check for clipping in each color channel; a saturated highlight has already lost information.
For reflective or curved parts, dome lights can reduce directional reflections by surrounding the inspection area with diffuse illumination. They do not automatically make every surface uniform, and the camera opening can remain visible in reflections.
Use the dome-light geometry guide to assess coverage and access before comparing options in the lighting finder. A diffuse image is useful only if it preserves the color feature you need to measure.
Convert to Lab through a defined color pipeline
Lab separates a lightness coordinate from two chromatic coordinates. A Delta E formula then expresses the difference between two Lab colors. Its usefulness depends on how those Lab values were obtained.
Do not assume that every three-channel camera image is sRGB. An image might contain camera-native values, processed RGB, or another documented encoding. Applying an sRGB conversion to unidentified camera data can produce a repeatable number without producing a defensible color measurement.
A controlled pipeline should establish:
- The input channel order and numeric range.
- The RGB encoding, including any transfer function.
- The camera characterization or applicable color profile.
- The reference white used for conversion to Lab.
- The exact Delta E formula used for acceptance.
When averaging has a physical radiometric purpose, average linearized values rather than assuming encoded RGB values are proportional to light. When your decision concerns a representative Lab color, explicitly define the statistic in Lab instead. These operations are not interchangeable because the conversions are nonlinear.
For calibrated color work, characterize the imaging system using a suitable target under the production illuminant. Validate that characterization on independent samples representative of the inspected materials. A neutral patch can reveal drift, but it cannot fully characterize all color errors.
Cross-camera comparisons need additional care. Different spectral responses can produce different readings from the same material. A shared white-balance setting does not establish equivalence between cameras.
Define a region-based color measurement
For a uniform patch, identify the same physical material in both images. Exclude background, labels, edges, clipped highlights, and known invalid pixels using a documented mask.
Convert valid pixels to Lab, then calculate a representative color for each image. An arithmetic mean is straightforward; a median or trimmed mean may resist isolated outliers. However, discarding unusual pixels can also discard the defect you intended to find.
For a transparent starting point, calculate the Euclidean Lab distance, commonly called Delta E 76:
Here, each image contributes its own representative Lab coordinates. Delta E 76 is easy to inspect mathematically, but it is not equally perceptually uniform throughout color space. If you select CIEDE2000 instead, use a validated implementation and document its parameters.
A difference between mean colors is not the same as the mean of individual pixel differences. The first measures an overall shift; the second can reveal local changes that cancel in the regional average.
Build aligned maps for localized changes
A pixelwise color-difference map compares corresponding surface locations. Register the images before calculating that map, using stable geometry rather than the changing color feature itself.
Registration may require translation, rotation, perspective correction, or another justified geometric model. A flat printed surface and a flexible curved package do not necessarily support the same alignment method.
The procedure is:
- Find the part and establish correspondence with the reference.
- Transform the image into the reference coordinate system.
- Mask background, invalid borders, occlusions, and excluded reflections.
- Convert both images through the same defined color pipeline.
- Calculate Delta E at each valid location.
- Summarize the map using area, connected regions, percentiles, and maximum values where appropriate.
The guide to contour artifacts in image subtraction explains why displaced boundaries resemble defects. The same geometric problem affects color-difference maps, even though their values are not simple grayscale subtraction.
Interpolation during registration can mix colors near sharp boundaries. Consider a justified boundary exclusion zone, and verify that it does not hide defects along the edges you must inspect.
For moving parts captured by separate cameras, correspondence also depends on timing. The multi-camera exposure synchronization guide helps distinguish simultaneous exposure from matching delivery times.
Work through averages and local differences
Consider a region containing 10,000 valid pixels. Suppose a discoloration raises one encoded channel by 30 digital numbers in only 200 pixels, while all other pixels remain unchanged.
A substantial local shift has become a small whole-region average change. This arithmetic illustrates dilution; it does not translate the channel change into a perceptual color difference.
Cancellation creates another failure mode. If 10% of the region increases by 20 digital numbers and another 10% decreases by 20, the net channel average changes by zero. The image is different even though that statistic is unchanged.
Now consider representative Lab colors of (50, 20, 10) and (52, 23, 14):
That result describes the difference between those representative colors. It says nothing about where a change occurred.
For a local-defect example, suppose 240 pixels exceed a chosen color-difference threshold within 12,000 valid pixels:
If an illustrative recipe allows no more than 1% changed area, this sample fails that area criterion. Neither the area limit nor the color-difference threshold is universal; both must come from your acceptance requirements and validation data.
Establish thresholds from accepted and rejected material
Do not choose a Delta E threshold solely because a value is described as visible to a person. Viewing conditions, surface texture, defect size, measurement geometry, and commercial acceptance requirements all affect the decision.
Start with repeated captures of an unchanged sample. This estimates acquisition variation before you introduce real production variation. Then measure accepted samples across relevant batches, positions, and operating conditions.
As an initial engineering study, 30 repeated captures can help expose obvious instability. They do not, by themselves, establish a qualified acceptance limit or a production false-reject rate.
Next, test rejected or deliberately prepared boundary samples. Include the smallest unacceptable defect, not just strongly discolored examples. Keep threshold-setting data separate from the samples used for final validation.
For local defects, consider a combination of criteria:
- A pixel-level Delta E threshold to define candidate changes.
- A minimum connected area to reject isolated noise.
- A maximum permitted changed-area fraction.
- Separate limits for critical regions and noncritical regions.
- An acquisition-validity check for clipping, reference-patch drift, and missing material.
Store invalid acquisition as a separate result rather than quietly labeling it a color failure. Likewise, do not automatically normalize every image to the sample mean: that can remove the overall shade change you intended to detect.
Select camera and lighting parts for the measurement
Browse area scan cameras by color capability, shutter behavior, interface, and the controls needed by your acquisition pipeline. The camera finder helps narrow those choices before checking software access to fixed settings.
The MV-CU020-90GC is a color camera with a global shutter and GigE interface. Evaluate its documented image-processing controls and characterization options against your measurement requirements.
- Sensor format
- 1/1.7"
- Interface
- GigE
- Resolution
- Up to 3 MP
- Shutter
- Global
A global shutter addresses exposure timing across the image; it does not eliminate motion blur or establish color accuracy. Verify image quality at the intended exposure and illumination settings.
The LS-DOM-0085 is a dome-light option to assess against the part envelope, camera access, and mounting arrangement.
- Size
- 100-200 mm
- Voltage
- 24 V
The LS-DOM-0062 is another dome-light option for the mechanical and illumination review.
- Size
- 100-200 mm
- Voltage
- 24 V
Do not infer usable field coverage from an outer diameter alone. Request dimensional information and confirm the emitting opening, camera opening, part clearance, and illumination behavior for your geometry. Electrical compatibility and operating mode also need checking before selecting a controller.
Use the camera configuration starting point when acquisition requirements drive the system, or the lighting configuration starting point when reflections are the main uncertainty.
Recognize when a color-distance metric is insufficient
A single representative color is a poor description of a multicolored image. Two images can share the same average while containing different shapes, swapped colors, or different proportions within individual features.
Histograms retain more distribution information than averages, but lose location. They can suit unordered material mixtures while missing a printing error that exchanges two colored regions.
Structural similarity measures address a different question. They can help detect texture or layout changes, but a good structural score does not establish acceptable color. Combine separately validated measurements when the specification includes both appearance structure and shade.
Pixelwise comparison also becomes unreliable when valid parts naturally wrinkle, rotate in depth, or reveal different surface regions. In those cases, compare corresponding semantic regions, use controlled presentation, or develop a model that explicitly represents acceptable variation.
Finally, a camera comparison under one illuminant does not establish agreement under every illuminant. If contractual color acceptance requires a specified measurement method, correlate the camera decision with that method rather than treating an image score as a substitute.
Check the recipe before ordering and deployment
Use this checklist to keep the inspection decision traceable:
- Define the defect: state whether overall shade, local discoloration, spatial arrangement, or several conditions determine failure.
- Freeze acquisition: save settings and confirm they are restored after restart.
- Verify the color pipeline: record channel order, encoding, characterization, reference white, and Delta E variant.
- Validate correspondence: check region masks and image registration using accepted parts with realistic position variation.
- Measure repeatability: separate acquisition noise from production color variation.
- Challenge the limits: include small local defects, boundary colors, reflections, and intentionally invalid captures.
- Preserve evidence: retain the reference version, measured values, masks, and decision reason with representative images.
- Confirm mechanical fit: check camera access, illumination coverage, mounting, and part handling before committing to hardware.
Bring representative accepted and rejected samples, the inspection region, and your proposed pass/fail rule to applications support. That gives the next hardware and measurement discussion a defined target rather than an unexplained difference between two images.
Questions
Is subtracting the average RGB values enough?
Subtracting average RGB values can track an overall shift when lighting, camera settings, encoding, and the inspected region remain fixed. It cannot preserve defect location, and opposite local changes can cancel. Use it as a defined process statistic, not as a universal measure of perceptual color difference.
Should I compare average Lab colors or a pixelwise Delta E map?
Use representative Lab colors when acceptance depends on the overall shade of a reasonably uniform region. Choose a pixelwise map when defect position or size matters and corresponding surface locations can be aligned. For patterned parts, separate region measurements may be more dependable than either whole-image approach.
What Delta E threshold should trigger rejection?
There is no universal machine-vision acceptance threshold. Specify the Delta E formula, measure repeatability, and evaluate accepted material alongside samples near the rejection boundary. Local defects also need size or area criteria. Validate the completed recipe on independent samples under the expected operating conditions.
Can images from different cameras be compared reliably?
Possibly, but matching exposure and white balance is not sufficient. Each camera needs a documented color pipeline, suitable characterization, and validation on the actual material range. Differences in spectral response can remain significant, especially when illumination or surface reflectance differs from the characterization conditions.
Does a dome light make color measurements accurate?
A dome can reduce directional glare on reflective or curved surfaces, but it does not establish color accuracy by itself. Its coverage, camera opening, geometry, stability, and spectral suitability still matter. A flat matte sample may work well with a different controlled illumination arrangement.


