I am developing a machine vision project to find defects on metal surfaces. I want to learn and implement algorithms which commercial systems are use for metal surface defect. My sample object as below:enter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description here

I am using OpenCV. I could find sharp defects with standard edge detection methods. But it is not sufficient. There is some samples of commercial solutions:
- http://www.keyence.co.uk/products/vision/vision-sys/cv-5000/features/movie06.jsp
- http://www.keyence.com/products/vision/vision-sys/cv-5000/features/movie09.jsp

Or like this picture:
enter image description hereenter image description here

Do you have any idea about algorithms which is used in commercial systems?

  • $\begingroup$ What kind of sensor are you using ? eddy-current, ultrasonic, video ? I'm not a specialist in non destructive testing so I can't answer your question from a professional point of view but the bottom plot looks like a frequency-line tracking problem (appearing in sonar and radar signal processing) where hidden markov model are used. $\endgroup$ Jun 9, 2015 at 15:31
  • $\begingroup$ We are using camera, and trigger by a sensor to take image. $\endgroup$
    – twister
    Jun 10, 2015 at 7:20
  • $\begingroup$ Where did you get the bottom picture from ? $\endgroup$
    – user7657
    Sep 9, 2015 at 7:48
  • $\begingroup$ It was taken from Keyence web site keyence.com/products/vision/vision-sys/cv-x100/features/… $\endgroup$
    – twister
    Sep 13, 2015 at 13:26
  • $\begingroup$ Impressive. I have no idea what filter this can be. They will keep it secret. $\endgroup$
    – user7657
    Sep 13, 2015 at 14:45

2 Answers 2


As the video says, they use the classical lowpass filtering for texture smoothing, then shading correction to lessen the effect of uneven illumination, followed by binarization for defect segmentation.

A completely different technique is used for the bearing: edge detection and (presumably) assessment of deviations from a smooth line.

The scratch detection on the heavily textured surface is much more challenging and I am not sure that a commercial system can handle it.

For the best of my knowledge, the technique in "Fast Detection of Curved Edges at Low SNR, Nati Ofir, Meirav Galun, Boaz Nadler and Ronen Basri" could do.

  • $\begingroup$ The paper looks nice. But at first sight the processing time in seconds and it is far away for my study. I must process 5 image in a second. I will investigate deeply this paper. Thanks for your advice. $\endgroup$
    – twister
    Sep 13, 2015 at 13:58

Apparently, the commercial solutions are purely visual (not current or ultrasonic, as one poster suggested). There's two ways shown: detection of stains or defects on a surface parallel to the image surface, and detection of a defect in an edge perpendicular to that. To me, it appears that those programs first separate out accidental data (like roughness or lighting). Maybe there's some learning involved, that is, an estimation of "typical" accidental data - for example, in your case you could evaluate the variations in several images. There's some types of variations that would need to be accounted for:

  1. Geometry and position of the imaged object (maybe its dimension are a little off, or it is slightly misadjusted, in both cases there'd be a difference you'd have to ignore)
  2. Unavioidable but harmless variation (surface roughness, lighting effects)
  3. Actual variation (the defects which you're looking for)

I'd first build a model of the expected image. For example, I could use a wavelet transformation to characterize expected variation - medium values and standard derivations of coefficients. So I would capture both size and "strength" of a visual variation. Roughness outside of the expected surface roughness either in size or in strength or depth would stand out.

When taking in account different orientations, it might be useful to align the image instead of the part. That is, I could identify useful orientation points (the edges maybe) and rotate, translate and scale the image accordingly.

Lighting effects are probably hardest to understand and model. For example, when wavelets are used, one could find (using several "good" images) correlations in means and standard deviations between different coefficients. These correlations would then further restrict expected coefficient values. These correlations would be quite hard to calculate (basically, pixels squared times number of evaluated images), however their evaluation can be a lot simpler - some coefficients would carry the most information, and could be used to "lead" the model.

I hope you'd understand my reply, and I'd like to thank you for posting such an interesting problem. I never thought about it before. Edge detection apparently works differently, and apparently is not of much use in your case. Would you be so kind and submit a few (maybe 20) images for testing?

  • $\begingroup$ I couldn't understand exactly. I added more images for testing. Thanks. $\endgroup$
    – twister
    Sep 13, 2015 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.