2

I've found contours from my image. And I'd like to find circular areas from the image. OpenCV has SimpleBlobDetector and it's method circularity which might work but I have not found anything useful to get it working. Any ideas or pointers where to look?

Example:

enter image description here

Desired result:

enter image description here

Noripsni
  • 425
  • 1
  • 5
  • 21
  • written in c++ but similar function should be available in java i guess..http://stackoverflow.com/questions/6416117/simple-object-detection-using-opencv-and-machine-learning/6416361#6416361 – Lucky Apr 13 '15 at 08:46
  • 1
    Yes this is a good start and there are java functions for `HoughCircles`. Now I need to go more abstract and search for oval. Keyword for this is probably `SimpleBlobDetector` and filter by circularity. – Noripsni Apr 13 '15 at 08:55
  • another pointer you would like to have http://stackoverflow.com/questions/21396674/detection-of-different-shapes-dynamically-like-circle-square-and-rectangle/21472252 it says you have to convert it into a gray image and smooth it before applying houghcircles – Lucky Apr 13 '15 at 10:21

1 Answers1

0

This is the most popular algorithm to detect circles: http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html . You will perhaps need some time to understand but for several radius, it computes maps of center probability then add them. You set radius range and threshold above which algorithm return a detected circle.

Tom A
  • 639
  • 5
  • 10
  • Looks like HoughCircle won't solve the problem as it is meant to detect only full circles. I guess I have to redefine my problem to detecting curved lines. – Noripsni Apr 13 '15 at 10:09
  • If you dig inside, you could get it works in your case. In short, for(r in range of radius); for(every points in image); value on map for radius r = number of black pixels on the circle of radius r; end for; end for; add maps; for highest values, retreive map where value at this position is higher. You got centers and radius. – Tom A Apr 13 '15 at 10:52
  • It's perhaps not exactly that but that the same principle. Give a look to the two first images of this wikipedia section on Hough Circle Transform: http://en.wikipedia.org/wiki/Circle_Hough_Transform#Find_parameters_with_Known_radius_R – Tom A Apr 13 '15 at 10:55