Image Processing for Industrial Inspection - From Visual Inspection to Dimensional Measurement
Industrial Inspection and Image Processing - Automation Needs and System Architecture
Image processing in industrial inspection automatically examines product quality on manufacturing lines. Replacing human visual inspection, cameras and algorithms deliver high-speed, high-accuracy, and consistent inspection results.
Why automated inspection is needed:
- Speed: Production lines output hundreds of products per minute, exceeding human inspection capacity
- Consistency: Humans suffer fatigue, attention lapses, and individual variation. Machines inspect at constant quality 24/7
- Precision: Defects at 0.01mm level are undetectable by human eyes
- Cost: Reduces inspector labor costs and prevents losses from defective product escapes
Inspection system components:
- Lighting: Uniformly illuminates targets, maximizing defect contrast. Ring, bar, coaxial types
- Camera: Area scan (stationary objects) or line scan (continuously conveyed objects)
- Lens: Telecentric (dimensional measurement) or standard (visual inspection)
- Processing hardware: Image acquisition and processing. FPGA-based or GPU-based
- Rejection mechanism: Air blow or robot arm for automatic NG product removal
Inspection types: Visual inspection (scratches, stains, discoloration), dimensional measurement (length, angle, area), presence inspection (component presence, misalignment), and character recognition (lot numbers, expiry dates). Tact time requirements are typically 50-500ms per product.
Lighting Design - Optical Techniques for Defect Visualization
Lighting is the most critical element in industrial inspection. Without appropriate lighting, no algorithm can detect defects. The goal of lighting design is maximizing contrast between defects and normal surfaces.
Lighting method selection:
- Bright field: Uses specular reflection. Effective for mirror surface scratches, print defects, color unevenness
- Dark field: Detects scattered light only. Optimal for transparent material scratches, fine surface irregularities, foreign particles
- Coaxial illumination: Illuminates along camera optical axis. Used for mirror inspection, wafer defect detection
- Backlight: Illuminates from behind. Used for silhouette dimensional measurement, hole presence inspection
- Dome lighting: Uniform illumination from all directions. Effective for curved and glossy surfaces. Minimizes shadows
Lighting color (wavelength) selection:
- Red LED (660nm): Suppresses red defects, emphasizes blue defects
- Blue LED (470nm): Emphasizes fine metal surface scratches. Effective for copper oxidation detection
- IR LED (850nm): Transmissive observation of silicon wafer internal defects
- UV LED (365nm): Fluorescent material detection. Adhesive overflow, oil contamination
Strobe lighting: High-speed conveyance (1m/s+) requires strobe (pulse) lighting to prevent blur. Exposure times below 10μs achieve blur under 0.02mm at 2m/s conveyance speed. LED instantaneous intensity can be set 10-50x continuous operation, ensuring sufficient light for short exposures.
Defect Detection Algorithms - Traditional Method Practice
Defect detection algorithms for industrial inspection are selected based on target characteristics. Traditional methods offer predictable behavior and can be tuned with minimal samples.
Difference inspection (template comparison): Computes difference between reference (master) and inspection images, detecting regions exceeding threshold as defects:
- Alignment: Pattern matching aligns inspection image to master (±0.1px precision)
- Difference: |inspection - master| > threshold → defect
- Applications: Print inspection, PCB pattern defects, label verification
- Limitation: Unsuitable for products with high individual variation. Sensitive to lighting changes
Blob Analysis: Classifies defects using connected region features (area, perimeter, circularity, aspect ratio) after binarization:
- Area filter: Remove micro-noise (<10px), extract significant defects only
- Shape features: Circularity = 4π×area/perimeter² distinguishes scratches (elongated) from stains (round)
- OpenCV:
cv2.connectedComponentsWithStats()implementation
Edge-based dimensional measurement: Detect edges with Sobel or Canny, determine sub-pixel edge positions. Distance between two edges gives dimensional value. Combined with telecentric lenses, achieves ±0.005mm measurement precision.
Frequency analysis: FFT analyzes texture periodicity, detecting deviations from periodic patterns as defects. Effective for fabric weave irregularities and metal surface polishing unevenness.
Deep Learning Anomaly Detection - Defect Detection with Limited Data
In manufacturing, defective samples are extremely rare (below 0.1% of total), making conventional supervised learning impractical due to insufficient training data. Anomaly detection learns only from normal products, detecting anything deviating from normal as anomalous.
PatchCore (2022): Accumulates local features from normal images in a memory bank, computing anomaly scores from distance to test image features. Achieves AUROC 99.1% on MVTec AD benchmark as the highest-accuracy method:
- Uses intermediate layer features from pre-trained ResNet/WideResNet
- Achieves sufficient accuracy with only 10-50 normal images
- Inference speed: approximately 50ms/image (GPU)
PaDiM (2021): Models feature distribution at each patch position as Gaussian, computing anomaly via Mahalanobis distance. Memory-efficient and suitable for embedded device execution.
EfficientAD (2023): Lightweight knowledge distillation-based anomaly detection. Teacher-Student structure detects regions where Student cannot reproduce Teacher output as anomalous. 5ms/image inference (GPU) enables real-time inspection, achieving AUROC 98.8% on MVTec AD.
Implementation considerations: Anomaly detection models are sensitive to normal definition. Training data must include lighting variation, positional shifts, and acceptable individual differences as normal. Threshold setting balances over-detection (yield loss) versus escapes (defective outflow), adjusted per product quality requirements.
High-Speed Processing and Real-Time Inspection
Manufacturing line inspection must complete all processing within tact time (allowable inspection time per product). This section covers acceleration techniques and system design for achieving real-time inspection.
Tact time calculation example: At 600 products/minute production speed, tact time = 60s / 600 = 100ms. Must fit image acquisition 10ms + processing 80ms + judgment output 10ms.
Acceleration techniques:
- ROI (Region of Interest) processing: Process only inspection-required regions, not entire image. Reducing area to 1/4 gives 4x speed
- Lookup tables (LUT): Pre-compute thresholding and gamma correction for fast application
- SIMD instructions: SSE/AVX process 8-16 pixels simultaneously. OpenCV automatically utilizes internally
- GPU processing: CUDA parallelizes image filtering and feature extraction. 10-100x faster than CPU
- FPGA: Pipeline processing at 1 clock/pixel for ultra-high-speed. Latency below 1ms
Multi-camera systems: When single cameras face field-of-view or tact time constraints, multiple cameras inspect different surfaces simultaneously. Four-camera configurations (top, bottom, two sides) with synchronized capture are common for complete product inspection.
Line scan cameras: For continuously conveyed products (film, steel sheet, fabric), line scan cameras capturing one line at a time are optimal. Synchronizing conveyance speed with scan rate produces distortion-free images. An 8K (8192px) line camera covering 1m width achieves approximately 0.12mm/px resolution.
Visual inspection and quality control books are available on Amazon
Inspection System Deployment and Operation - From Installation to Quality Management
This section covers procedures, evaluation methods, and operational considerations for deploying image inspection systems on manufacturing lines, including quality management requirements beyond technical implementation.
Deployment procedure:
- Requirements definition: Clarify defect types, sizes, and acceptable rates. Quantify as "detect scratches 0.1mm+ at 99.9% rate"
- Lighting/optics selection: Determine optimal combination through lighting tests with samples
- Algorithm development: Develop and tune detection logic with good/defective samples
- Performance evaluation: Statistically evaluate detection and false positive rates with 1000+ samples
- Line integration: PLC communication, rejection mechanism coordination, production management system connection
Performance metrics:
- Detection Rate: Correctly identifying defectives as NG. Target 99.9%+
- False Positive Rate: Incorrectly rejecting good products. Target below 0.1%
- Escape Rate: Defectives passing as OK. Target below 0.01%
Operational challenges and solutions:
- Lighting degradation: Monitor LED brightness decline periodically, auto-correct thresholds
- Product specification changes: Master images and parameters require updates for new products
- Environmental variation: Auto-calibration compensates for optical drift from temperature changes
Traceability: Store all inspection images and results for later defect cause investigation. At 100,000 inspections/day with 500KB/image, approximately 50GB daily storage is needed. 30-day retention requires 1.5TB managed via NAS or cloud storage.