Skip to content

Bare PCB defect detection using Image Subtraction technique, implemented with OpenCV in Python.

Notifications You must be signed in to change notification settings

swaralipaygude/Bare-PCB-defect-detection-using-OpenCV

Repository files navigation

Bare-PCB-defect-detection-using-OpenCV

This project implements the detection of bare PCB defects such as missing hole, mouse bite and open circuit, using the OpenCV library in Python.
The image processing technique called Image Subtraction is used for the purpose of defect detection.

The Bare-PCB-images-dataset folder contains the dataset used for this project, and its details in a README file inside the folders of template and defective PCB images. It contains RGB images of five types of bare PCBs.

An example of a bare PCB having missing hole defect:

Annotated PCB image with missing hole defect

The Jupyter notebook has the code for the step-by-step PCB defect detection process using image subtraction. The steps, which apply to both template and test images, involve converting the original image to grayscale, applying Gaussian blur to blur the image and then using adaptive thresholding to convert the image to a binary image.
Once both the images are binary, the test image is subtracted from template to get the resultant image (difference image) which shows the defects.
Contour detection is then used to get the number of defects in the final image.

An example of a final result image showing defects looks like this:

Resultant binary image

About

Bare PCB defect detection using Image Subtraction technique, implemented with OpenCV in Python.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published