Six ways to implement industrial defect detection using OpenCV4

1 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.

2 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 is highly interpretable, has no requirements on the number of samples, and runs fast. 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.

picture

3 common defect detection methods in industry

Method 1: Implement scratch extraction based on simple binary image analysis. The effect is as follows:

picture

Method 2: Image defect analysis under complex background, defect detection based on frequency domain enhancement method, running screenshot:

picture

Method 3: Image defect analysis under complex backgrounds. Image defect analysis is realized based on spatial enhancement. For images with complex backgrounds, defect search is achieved after spatial filtering enhancement. The running screenshot is as follows:

picture

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:

picture

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

picture

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

picture

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

picture

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

Recommended words:

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_55756734/article/details/135166844