FabricDefectDetection

A visual tool for defect detection of woven fabric

Original Picture:

Median filter:
Median filtering can well preserve the edge information of the original image and will not affect subsequent operations. So first use median filtering to process the original image to filter out the noise, the effect is as follows:

Use Canny edge detection algorithm to extract edge information:
Because the pattern of the flawless woven cloth is arranged in an orderly manner, there is no sudden change. Therefore, the use of edge detection means can effectively detect the location of the flaw. The Canny detection algorithm is currently the best detection algorithm. We use this method for edge detection. The effect is as follows:

Fill the inside of the contour through the closing operation:
Through edge detection, only the outline of the flaw is obtained. Therefore, the closed calculation algorithm is used to fill the defects inside, and the visual effect is better. The closed operation is a method of mathematical morphology, which expands first and then corrodes, which can fill the voids in the binary image. After testing, the effect is as follows:

UI:
We use Python's PyQt library to achieve visualization, detection prompts and visualization effects are shown in the following figure:
UI