Welcome to Kunshan EEK Automation Equipment Co., Ltd.
Home/Defect Types/Stain Defect Visual Inspection

Stain Defect Visual Inspection

Stain defect visual inspection: for oil stains, water marks, fingerprints and process dirt on leather, fabric and foam surfaces, diffuse uniform illumination with grayscale/color difference comparison distinguishes natural texture from real stains, outputs OK/NG and marks positions.

defect Overview

Surface stains and dirt are revealed by grayscale and color contrast; the difficulty lies in distinguishing them from the material's natural texture

Quick answers

A stain is oil, water, dust or processing dirt adhering to the material surface, producing a gray-level or chromaticity difference from the surrounding substrate under uniform diffuse light. As long as the contrast between the stain and the background reaches a level the camera can resolve, machine vision can detect it consistently; the key risk is misjudging the material's own pattern, color mottling or print marks as stains, so the judgement must be based on a registered normal-appearance datum.

Stain-type defects appear in the image as a local region whose gray level or chroma differs from the surrounding substrate, usually with irregular edges and uneven density inside. They can be oil stains, water stains, adhesive stains, fingerprints, or dust deposits, and may also come from stamping lubricant, handling gloves, or ambient dust. Because stains themselves have no fixed shape, rule-based algorithms cannot exhaustively cover them with a single template; the more practical approach is difference comparison under stable illumination and white balance.

The primary difficulty of stain inspection is not "whether you can see it" but "whether it counts as a defect". Genuine leather, PU synthetic leather and knitted fabrics have natural texture, color mottling and even prints of their own, and these are all normal appearance; treating them as stains leads to an extremely high over-rejection rate. In engineering practice, OK samples are usually used first to establish a background datum (or the average of the same batch), and then local areas that deviate from the datum are tested for significance.

Another category of difficulty comes from reflective and transparent stains. An oil stain may only appear slightly brighter along the specular direction, and a water stain is nearly invisible once dry; such low-contrast stains place higher demands on light source angle, camera dynamic range and calibration consistency. For critical parts, we recommend further dividing stains into "wipeable" and "absorbed / irreversible", with the quality department defining the reject threshold for each.

Occurrence Causes

Only when the cause is known can you decide which station should check for it

  • Carried in during processing: stamping/cutting lubricant, mold release agent residue, glue overflow
  • Handling and assembly: glove oil stains, fingerprints, dust deposits, and shedding from packaging materials
  • Ambient dust: airborne dust from open stations on the production line and insufficient filtration in the air supply system
  • The material itself: uneven coloring of natural leather pores is misread as stains (normal appearance)
  • Incomplete cleaning: water marks from the previous process step, or cleaning agent residue not dried before the part enters the line

imaging Key Points

Whether it can be detected depends first on whether it can be captured

Stain defect visual inspection: comparison of imaging on a normal surface versus a defective surfaceIllustration of how stain defects appear differently in imaging, showing the difference between the material's natural texture and genuine defects.NormalSurface texture regular, no anomaliesdefect Detects "stain"Texture is regular → it can be modeled and suppressed; defects are irregular → only then can they be judged as anomaliesImaging conditions: diffused / low-angle / transmitted / stripe light must be selected according to the material's optical properties
Stain Defect Visual Inspection | Imaging Comparison — Left: normal material surface (regular texture); right: imaging of the same surface type when a stain is present. Actual judgement thresholds must be calibrated by measuring your OK / NG samples.

Uniform Diffused Light

Provides stable, non-directional illumination so stains appear as gray-level / color differences rather than shadows; best suited to oil and water stains

Coaxial Light

Suppresses surface highlights and reduces interference from reflection spots in stain judgement; suitable for coated or slightly reflective surfaces

Multispectral / Color Imaging

Adding near-infrared or specific wavelength bands beyond RGB improves the color difference contrast between certain oily stains and the substrate

White Balance Reference

Light sources and cameras must be calibrated regularly so that color temperature drift does not misjudge normal color variation as a color-difference stain

judgement Method

The judgement centers on "the significance of the local difference from the registered normal appearance". The image is first positioned and background-registered, then the area, maximum deviation, average deviation, and connectivity shape of suspicious regions are measured on the difference map; only deviations that exceed both the area and the intensity dimensions become defect candidates.

No fixed number is given for the threshold: the cost of an escape (letting a stain through) and of over-rejection (treating normal texture as a stain) is usually asymmetric, so the threshold should be biased toward the safer side; the specific upper and lower limits must be quantitatively defined by the customer's quality department together with the release criteria, and saved as a recipe at changeover. Clearly different "soaked-in" stains and slight "wipeable" stains should be handled in separate grades.

Judgement DimensionDescription
AreaMinimum/maximum area threshold for the difference region; below it the region is treated as noise, above it the part is rejected outright
IntensityThe maximum deviation in grayscale or chromaticity relative to the background, distinguishing slight color variation from real stains
ShapeWhether the edge transitions naturally: hard edges are usually external stains, while gradual transitions are usually natural texture
PositionWhether it falls on a functional surface or an appearance surface; appearance surfaces and hidden assembly surfaces can be rejected at different grades
RecoverabilityThe quality department defines a graded disposition strategy for wipeable and penetrated marks

Applicable algorithm

Background Registration and Difference Map

Build a reference from OK samples or the same-batch mean, then compare pixel by pixel to obtain a difference image

  • Register positioning first to avoid false differences caused by position drift
  • Smooth the difference image to suppress noise

Blob and saliency analysis

Apply threshold segmentation and connected-component statistics to the difference image to extract area, intensity and shape

  • Dual-threshold filtering by area and intensity
  • Low-contrast stains require a higher camera dynamic range

Deep learning classification

Run binary classification on suspicious regions to distinguish real stains from natural grain/marks

  • Collect real stain samples and normal pattern samples
  • Sample coverage determines the false-rejection ceiling

Common Materials

Common Industry

Common Question

What types of stains can visual inspection detect?
It mainly targets oil marks, water marks, adhesive marks, fingerprints, and dust deposits that differ in grayscale or chromaticity from the substrate. Stains that are fully transparent and have the same refractive index as the substrate may have low contrast, and measurement is needed to confirm whether the imaging solution is sufficient.
Why are color blooms on genuine leather often misjudged as stains?
The pores and coloring of genuine leather are inherently uneven, which is normal appearance. Judgement must be based on difference comparison against a registered normal appearance datum rather than a fixed threshold applied uniformly; otherwise the over-rejection rate will be very high.
How do you balance escapes and over-rejection in stain inspection?
The two costs are usually asymmetric, so the judgement threshold should be biased toward the safer side, and the specific upper and lower limits should be left to the customer's quality department to define quantitatively; the equipment supplier only provides adjustable parameters and recipe management.
Can oil stains be captured clearly on reflective surfaces?
Under ordinary diffuse light an oil stain may only appear slightly brighter. For coated or slightly reflective surfaces, coaxial light suppresses highlights and increases the contrast between the oil stain and the substrate; a near-infrared band can be added if necessary.
Should Wipeable Stains and Penetrating Stains Be Judged Separately?
Grading is recommended. Wipeable stains and penetrated / non-recoverable ones have different release standards, so the quality department defines the graded disposition, and the equipment outputs a defect grade rather than a simple binary result.
What is the smallest stain that can be detected?
It depends on the camera resolution and field of view (pixel equivalent). To be added. The specific minimum detectable size must be measured according to the on-site field of view and camera configuration; a general figure cannot be given.
Does switching to a differently colored material require readjustment?
Yes. Different base colors / patterns give different contrast relationships, which should be accommodated by calling up the corresponding recipe (inspection area, datum, threshold) rather than by manual repeated parameter tuning.

Submit sample testing

The key to stain inspection is to "distinguish external dirt from the material's natural appearance"; below are examples comparing typical material surfaces with the reference.

JPG / PNG supported, multiple files allowed
Each file must not exceed 20 MB
    JPG / PNG supported, multiple files allowed
    Each file must not exceed 20 MB
      JPG / PNG supported, multiple files allowed
      Each file must not exceed 20 MB
        A solution engineer will contact you within 1 business day after submission

        Need to assess imaging conditions, defect criteria and cycle time item by item? Go to the Full Requirement Assessment →

        Send Us Your Defect Samples and We Will Measure Them and Show You the Results

        Whether a defect can be detected depends on whether imaging captures the defect features. Provide OK and NG samples and we will run actual imaging and judgement tests on the equipment.

        Online support WhatsApp
        WeChat
        Scan the QR code to add us on WeChat
        Call us Back to top