The most common problem with manual inspection would be human errors while detecting the defects and calculating the correct lengths to cut. This will lead to higher wastage of fabric when cutting. This is a simple solution to detect defects in plain colored fabrics using OpenCV library. This uses contours to identify the defects on plain colored fabrics and calculates the total wastage of fabric due to the defects.
- Get the video stream of the fabric moving through the machine.
- Break the video into frames.
- Convert the frames to grayscale.
- Apply gaussian blur to reduce the noise.
- Convert the resulting image to binary image.
- Apply morphology close operation to close the gaps between pixels.
- Calculate contours.
- Calculate the bounding rectangle for each contour.
- Calculate the wastage by using the calculated values and the minimum piece length.
- Show the results.