Defect detection in industrial images
This project uses OpenCV to detect defects in fabric and textile images through a classical image-processing pipeline. Local variance highlights irregularities in the weave pattern, morphological filtering refines the defect regions, and connected components are used to isolate and mark defects such as holes, stains, broken yarns, and misweaves.
This project detects defects in fabric images using classical digital image processing techniques. By computing local variance, the system highlights abnormal texture regions such as holes, stains, broken yarns, and misweaves. Morphological filtering refines the segmentation, and connected component analysis identifies and marks the defects. The pipeline automatically processes an entire dataset and outputs defect masks and annotated images.
- Grayscale Conversion: Converts the input image to grayscale so that defect detection can focus purely on intensity and texture variations instead of color information.
- Local Variance Calculation: Measures texture irregularity within a sliding window; high variance indicates abnormal fabric regions where defects are likely present.
- Thresholding: Transforms the variance map into a binary mask by separating high-variance defect pixels from normal fabric regions.
- Median Filtering & Morphological Operations: Removes noise and refines the defect mask using median blur along with closing and opening to clean and isolate defect blobs.
- Batch Image Processing: The system automatically loads all images from the dataset folder and processes them sequentially, enabling large-scale fabric defect inspection.
- Connected Components Analysis: Identifies and labels defect regions, allowing the system to locate, draw bounding boxes, and count individual defects.
https://github.com/SimonThomine/IndustrialTextileDataset
- Local-variance-based defect detection specifically optimized for repetitive textile textures.
- Morphological filtering pipeline designed to suppress natural weave patterns and remove noise.
- Automated batch processing workflow that detects, counts, and marks defects for all images in a folder.
- Hardik Gupta (PES1UG23EC115)
- Sinchana M (PES1UG23EC299)
- Monal Reddy P (PES1UG23EC180)
- Refer the outputs folder
- https://www.geeksforgeeks.org/python-opencv-median-blurring
- https://github.com/avishkakavindu/defect-detection-opencv-python
- https://www.geeksforgeeks.org/erosion-dilation-image-processing-python-opencv
Limitations-
- The method is sensitive to lighting variations and may produce noise on unevenly illuminated fabric images.
- Highly patterned or textured fabrics can cause false positives due to naturally high variance regions.
- Fixed thresholding may not adapt well to different fabric types or varying defect sizes.
Future Work
- Implement adaptive or multi-scale thresholding to handle different fabric textures automatically.
- Integrate advanced texture filters (Gabor, LBP) to improve defect separation in complex patterns.
- Extend the system with deep-learning models for more robust detection and defect classification.