Free shipping €150+
Blog/tutorials

Machine Vision for Industrial Applications: Complete Implementation Guide

Implement industrial machine vision systems with Raspberry Pi and Arducam. Learn quality inspection, defect detection, and automated measurement techniques.

Robotics3D TeamJanuary 15, 202513 min read

Machine vision transforms manufacturing by enabling automated inspection, quality control, and precision measurement at speeds impossible for human operators. This guide covers implementing industrial vision systems using affordable hardware like Raspberry Pi and professional cameras, making advanced inspection accessible to businesses of all sizes.

Industrial line scan camera for machine vision
Industrial line scan cameras enable high-speed quality inspection (Laserlicht, CC BY-SA 4.0)

Industrial Vision Applications

Machine vision systems handle tasks that would be impossible or impractical for human inspectors:

Application Inspection Rate Typical Accuracy Use Cases
Defect Detection 1000+ parts/min 99.5%+ Surface scratches, cracks, contamination
Dimensional Measurement 500+ parts/min ±0.01mm Part dimensions, tolerances, alignment
Barcode/QR Reading 2000+ reads/min 99.9%+ Tracking, inventory, traceability
Color/Appearance 800+ parts/min ΔE < 1 Color matching, label verification
Robot Guidance Real-time ±0.1mm Pick-and-place, assembly, welding
Automated quality inspection unit
Automated inspection systems ensure consistent quality (Public Domain)

Hardware Selection

Entry Level (€200-500)

  • • Raspberry Pi 4/5 + HQ Camera
  • • USB global shutter cameras
  • • Basic LED lighting
  • • OpenCV processing
  • • 30-100 inspections/minute

Professional (€1000-5000)

  • • Industrial GigE cameras
  • • Telecentric lenses
  • • Structured lighting systems
  • • HALCON/VisionPro software
  • • 500+ inspections/minute

Lighting Techniques

Proper lighting is 80% of successful machine vision. Key techniques:

Backlight

Silhouette inspection, edge detection, dimensional measurement. Places light source behind object.

Diffuse Dome

Eliminates shadows and glare on curved/reflective surfaces. Ideal for shiny parts.

Dark Field

Highlights surface defects (scratches, contamination) by lighting at acute angles.

Industrial robot arm in factory automation
Vision-guided robots enable precise automated handling (KUKA, Public Domain)

OpenCV Quality Inspection Code

import cv2
import numpy as np
from typing import Tuple, List

class DefectInspector:
 def __init__(self, reference_image: np.ndarray):
 self.reference = cv2.cvtColor(reference_image, cv2.COLOR_BGR2GRAY)
 self.reference = cv2.GaussianBlur(self.reference, (5, 5), 0)
 
 def inspect(self, test_image: np.ndarray, 
 threshold: int = 30) -> Tuple[bool, List[dict]]:
 """
 Compare test image against reference for defects.
 Returns (passed, defects_list)
 """
 test_gray = cv2.cvtColor(test_image, cv2.COLOR_BGR2GRAY)
 test_gray = cv2.GaussianBlur(test_gray, (5, 5), 0)
 
 # Compute absolute difference
 diff = cv2.absdiff(self.reference, test_gray)
 _, thresh = cv2.threshold(diff, threshold, 255, cv2.THRESH_BINARY)
 
 # Find defect contours
 contours, _ = cv2.findContours(
 thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE
 )
 
 defects = []
 min_defect_area = 50 # Ignore tiny noise
 
 for contour in contours:
 area = cv2.contourArea(contour)
 if area > min_defect_area:
 x, y, w, h = cv2.boundingRect(contour)
 defects.append({
 'location': (x, y),
 'size': (w, h),
 'area': area,
 'severity': 'major' if area > 500 else 'minor'
 })
 
 passed = len(defects) == 0
 return passed, defects

# Usage
reference = cv2.imread('golden_sample.jpg')
inspector = DefectInspector(reference)

# Inspect production parts
for part_image in capture_parts():
 passed, defects = inspector.inspect(part_image)
 if not passed:
 trigger_reject(defects)
Barcode and QR code scanning system
Barcode scanning enables full product traceability (IAEA, CC BY-SA 2.0)

ROI Calculation

A typical manual inspector costs €30-50/hour and catches ~85% of defects. A €2000 vision system running 24/7 at 99.5% accuracy pays for itself in 2-3 months while eliminating defect-related customer returns.

Conclusion

Machine vision democratizes quality control, making 24/7 automated inspection accessible to small manufacturers. Start with affordable Raspberry Pi solutions for proof-of-concept, then scale to industrial cameras as volumes increase.

Ready to implement machine vision? Browse our selection of industrial cameras and Raspberry Pi modules at Robotics3D.

Frequently Asked Questions

Can Raspberry Pi-based vision systems achieve industrial-grade accuracy?

Yes, with proper camera selection, lighting, and calibration, Raspberry Pi systems can achieve 95-99% accuracy suitable for many industrial applications. Key factors include using high-resolution cameras like Arducam 64MP for detailed inspection, global shutter sensors for moving lines, proper lighting design, and thorough calibration. While they may not match the speed of 100,000+ EUR professional systems, they provide excellent value for applications not requiring absolute maximum throughput.

What camera should I use for inspecting parts on a moving conveyor belt?

Use an Arducam global shutter camera (OV9281 or OG01A1B models) for moving conveyor applications. Rolling shutter cameras produce motion blur and distortion when capturing moving objects, making defect detection unreliable. Global shutter sensors capture the entire frame simultaneously, providing sharp images regardless of conveyor speed. Pair with appropriate lighting (often strobed to freeze motion) for best results.

How important is lighting in industrial vision systems?

Lighting is arguably more critical than the camera itself. Proper lighting can make defects obvious and easily detectable, while poor lighting can make them invisible regardless of camera quality. Different defect types require specific lighting techniques: dark field for surface scratches, backlighting for dimensional measurement, diffuse bright field for color verification. Budget at least as much for lighting as for the camera, and test multiple lighting configurations during development.

How do I integrate a Raspberry Pi vision system with factory PLCs?

Use industrial communication protocols like Modbus TCP/RTU, OPC UA, or EtherNet/IP. The pymodbus library enables Modbus communication from Raspberry Pi to most PLCs. Use digital I/O (via GPIO or industrial I/O hats) for simple signals like pass/fail and trigger inputs. For more complex data exchange, consider MQTT for publish/subscribe architecture or REST APIs. Ensure reliable network connectivity and implement error handling for production environments.

What measurement accuracy can I achieve with camera-based systems?

With proper calibration, telecentric lenses, and controlled conditions, camera-based measurement can achieve 10-50 micron accuracy, sufficient for many manufacturing applications. Accuracy depends on factors including: camera resolution (higher is better), lens quality (telecentric lenses eliminate perspective error), working distance (closer improves resolution), lighting (affects edge detection precision), and calibration quality. For critical dimensions, verify accuracy against certified measurement tools before deployment.

Related Products

Ready to Build?

Get all the components you need for your next project.

Shop Products
Contact1