[OpenCV] Six methods of industrial defect detection in OpenCV4

machine vision

Machine vision uses various industrial cameras, combined with sensors and electrical signals, to replace traditional manual labor to complete tasks such as object recognition, counting, measurement, defect detection, guidance, positioning, and grabbing. Among them, the defect detection of industrial products relies heavily on manual work, especially in the traditional 3C manufacturing process. Product defect detection relies on human eyes to detect and detect, which is not only time-consuming and labor-intensive, but also faces constraints such as personnel costs and working hours. Using machine vision to detect product defects can save a lot of time and personnel costs, and realize the automation and assembly line operations of the production process.


Defect detection

Common industrial product defects mainly include scratches, dirt, missing parts, pits, cracks, etc. These defects that rely on manual visual inspection (eye inspection) can be replaced by machine vision defect detection algorithms. Current industrial defect detection algorithms are mainly divided into two directions, traditional vision-based algorithms and deep learning-based algorithms. The former mainly relies on quantifying the characteristics of the detection target, such as color, shape, length and width, angle, area, etc. Benefits It has strong interpretability, no requirements on the number of samples, and fast running speed. The disadvantage is that it relies on fixed lighting imaging. If there is a slight change, the program must be rewritten and redeployed, and the detection rules and algorithms play a leading role with the developer experience. The defect detection algorithm based on deep learning can just make up for the shortcomings of the former. It can adapt well to different lighting and better adapt to the requirements of similar defects. The disadvantage is that it has certain requirements on the number of samples and the hardware configuration is also lower than traditional ones. There are certain requirements.

Chapter 14 of the book "OpenCV Application Development: Getting Started, Advanced and Engineering Practice" introduces in detail through cases how to implement traditional defect detection and deep learning-based defect detection based on OpenCV.

Insert image description here
Common defect detection methods in industry

Method 1: Implement scratch extraction based on simple binary image analysis, the effect is as follows:
Insert image description here
Method 2: Image defect analysis under complex background, implement defect detection based on frequency domain enhancement method, running screenshot:
Insert image description here
Method 3: Image defects under complex background Analysis, image defect analysis is implemented based on spatial domain enhancement. For images with complex backgrounds, defect search is implemented after spatial domain filtering enhancement. The running screenshot is as follows:

Insert image description here

Method 4: Implement image defect analysis based on spatial enhancement based on sample template comparison, and implement defect search through two-dimensional analysis and contour comparison. The running screenshot is as follows:

Insert image description here

Method 5: Based on the deep learning UNet model network, crack and scratch detection is implemented. The running screenshot is as follows:

Insert image description here

Method 6: Segment the network model network based on deep learning instances to achieve subtle defect detection. The running screenshot is as follows:
Insert image description here

The above content is all from Chapter 14 of a recently published new book "OpenCV Application Development: Introduction, Advanced and Engineering Practice", which I would like to share with you.

Further reading

Insert image description here

OpenCV4 application development: entry, advanced and engineering practice
Jia Zhigang Zhang Zhen
Recommended by experts from industry and academia
Written by front-line development experts and gold medal lecturers, one-stop solution to the pain points of OpenCV engineering development

Recommendations

Taking the knowledge points required for industrial-grade vision application development as the main line, it explains the core modules related to OpenCV, and explains 1,000 commonly used functions, deep learning knowledge, and model reasoning and acceleration through case studies.

This book focuses on introducing the commonly used modules of OpenCV4 in the industrial field, and builds a stepped learning path of knowledge points through reasonable chapter settings. Simplify the complex and be case-driven, focusing on algorithm principles, code demonstrations and actual use in relevant scenarios. This book also introduces necessary deep learning knowledge and development skills to expand OpenCV developer skills.


Guess you like

Origin blog.csdn.net/weixin_44244190/article/details/135063302