Machine Vision detecting paint issues and defects

open-source libraries, toolkits, and projects you can use (or build on) to detect paint issues (defects, variability, etc.) in images. Depending on whether you need classical image processing vs deep learning vs segmentation vs anomaly detection, some are more suitable than others. I’ll also mention pros/cons and what sort of paint issue they might help with.



Name

Description / Use-Cases

Strengths

Limitations / Challenges

OpenCV

A classic computer vision library in C++/Python. Useful for filtering, edge detection, thresholding, morphological ops, color segmentation, etc. It’s a good baseline for detecting scratches, blotches, unevenness or color defects. 

Very mature; many tutorials; works in real-time; small models; lots of control.

Classical methods often fragile under variable lighting, texture, reflections. May require heavy tuning; less effective for subtle defects or where you need localization or segmentation.

Mahotas

Python library for traditional image processing (filters, morphology, feature descriptors). 

Fast, C++ under the hood; good for prototyping; integrates well with scientific workflows.

Not focused on deep learning; might struggle with high-level defects; no built-in object detection or segmentation for complex scenarios.

VIGRA (Vision with Generic Algorithms)

C++ (with Python binding) library for customizable vision algorithms. Useful when you need high performance and precise control. 

Efficiency; template-based; good for lower-level image processing where you have strong domain control.

Less “out-of-the-box” deep learning / modern segmentation/detection pipelines; steeper learning curve; fewer pre-trained models.

ilastik

Interactive machine learning / segmentation / classification toolkit. Useful when you want to label parts of images (e.g. areas with paint peeling, cracks, discoloration) and do segmentation. 

Very user-friendly; rapid iteration; GUI for non-experts; works well with small annotated datasets; able to do pixel-wise segmentation.

Might not scale to very large datasets or real-time on large images; for subtle defects, might require good annotation; not always ideal for production deployment without customization.

Kornia

Differentiable computer vision library built on PyTorch; includes routines for geometric transforms, filtering, edge detection, image augmentation etc. Useful if you want to build parts of your pipeline as differentiable modules (e.g. embed in a neural network). 

Seamless integration with deep learning frameworks; useful for creating custom losses, augmentations; modern.

Using deep learning increases complexity; you’ll need data, correct training; more overhead; may need GPU etc.

Anomalib (via OpenMMLab / other anomaly detection libraries)

Although I didn’t find a clean citation above for “paint issues,” anomaly detection libraries are very relevant when you mostly have “good” paint surfaces and want to spot “abnormal” defects (scratches, pits, spots etc.).

You can train with “normal” examples and detect anomalies; less labeling effort for defect classes; good for rare/unpredictable defects.

Hard to detect subtle anomalies if they are similar to normal texture; false positives; need well-controlled imaging, consistent lighting; deployment may need calibration.






Specific Projects / Datasets



  • Defect_detector (GitHub: AhmadCodes/defect_detector): A library + GUI for defect detection in images/videos using multiple methods (edge detection, background subtraction, thresholding, object detection). Could be a good starting point.  
  • ARTDET: Open-source tool built on Mask R-CNN for detecting deterioration/damage in paintings. Useful for paint defects if you treat paint issues as “damage” (peeling, cracks, loss). Offers pixel-level segmentation.  
  • A study “Smart System to Detect Painting Defects in Shipyards” (Appl. Sci., 2022) that implements Vision AI and deep learning for paint defect detection in real shipyard environment. Could be informative for domain adaptations, lighting, real-world constraints.  






What to Consider: What vs How



To pick which library / approach is best, think about:


  1. Type of defects you need to detect (e.g. color inconsistency, paint runs, sags, orange peel texture, scratches, corrosion under paint, rust, peeling, bubbling, etc.). Some are structural (shape, elevation), some are purely appearance (color, gloss, reflections).
  2. Image capture setup: lighting control, resolution, reflections, angle, consistency. Paint tends to be reflective; shadows/reflections can look like defects.
  3. Data available: Do you have lots of images with and without defects? Is there segmentation (pixel-level) data or only “good/bad” labels?
  4. Real-time vs offline: On a production line you might need fast inference; that may push you toward lighter models or even classical methods if acceptable.
  5. Annotation cost: Pixel segmentation is more expensive to label than bounding boxes; anomaly detection needs fewer defect samples but may have higher false positives.
  6. Evaluation metrics: false positives vs false negatives cost; tolerances; how precise the detection must be.



From Blogger iPhone client