1

I am working on a college project where I have to use image processing using opencv to detect manufacturing defects in cookies. The program must be able to detect oversized, undersized, distorted cookies, cookies with cracks, etc.

I am new to opencv. I tried using Houghcircles to check for some of the above defects, but it does not work since the perfect cookie itself is elliptical.

Or, if I take the pics of a perfect cookie and any other cookie, how do I compare them?

Can you please mention a few functions / codes which might be helpful for my project.

Thank You.

1 Answers1

1

You can look into ellipse detection. It does involve more coding compared to hough circles, but I've tried it in the past and it works quite well. Take a look at these papers:

Also read through this article on matrix representations of conic sections. This will help you find the lengths of the major and minor axes of the ellipses, which in turn will aid with quality control.

Zaphod
  • 1,927
  • 11
  • 13
  • thank you very much. I'll try using the above ideas. However when I tried an ellipse detection code which i found online, the problem is, even a distorted object can be fit into an ellipse... So, objects with defects still remain. – user2392772 May 17 '13 at 08:37
  • Yes objects with defects will definitely be detected. You will need to post-process, check the lengths of the major and minor axes, and then filter out noise or bad samples. – Zaphod May 17 '13 at 08:52
  • thanks for the help. It worked. Now I am done with all dimensional defects. For checking cracks on the cookie, I am thinking of Sobel operator. But what do I use to detect imperfections like the surface of the cookie is bent / contorted. Since the image will be 2d, I am clueless about how to detect thickness / surface related defects. – user2392772 May 23 '13 at 07:38
  • Great, glad it worked. Can you attach some examples so that we get a better idea about defects? – Zaphod May 23 '13 at 08:07
  • The top one is bent and has cracks. The middle one is fine. The bottom one is almost fine, but has a small projection in one place. That also should be considered as a defect. – user2392772 May 23 '13 at 08:27
  • For the top one, your approach of finding edges should work. Measure the density of edges inside the fitted ellipse, and this should indicate how _smooth_ the cookie is. For the third one, you can count the number of edge pixels that lie outside the fitted ellipse. If this number is too high, there may be a surface defect. – Zaphod May 23 '13 at 08:36