Reputation: 2716
I'm trying to detect areas that contain a top portion of an oval shape in a color image.
Here are some examples I drew:
https://i.sstatic.net/I8MUh.jpg
https://i.sstatic.net/eNqN2.jpg
How would you accomplish this? I'm inexperienced in image processing, but I'm willing to read and learn. I'm mainly using OpenCV with C++ but I can use other libraries as well.
Upvotes: 1
Views: 1023
Reputation: 1927
For ellipse detection, you can refer to this post. The two methods are based on the hough transform, and can be tuned easily if required.
Upvotes: 0
Reputation: 637
I would suggest a simpler approach than the Hough transform for circles. From the images above, I see that the oval has a uniform color while the rest of the image does not.
Upvotes: 0
Reputation: 2588
There is actually a function to detect circles at opencv.
Use hough transform with low parameter2 -cause you should detect the circle with given only its top.
Another way should be as such;
1- low pass filter (gaussian blur, search inside opencv doc)
2- color filter -optional (use your object's color if you know it, otherwise try to obtain the color from pixel(image.width/2 , 0)
3- canny edge detection (again, refer to the doc)
4- find contours (again, refer to the doc)
5- if you have a contour having preferably big area and including pixel(image.width/2 , 0) -you will use pointPolygonTest here- then you have a blob at the bottom.
6- to detect if this blob is "oval" is a big issue; but you can do some filtering using properties of "ovality";
Upvotes: 0
Reputation: 1145
In general the thing you ask is a kind of big problem. In the real world images, you will need to find every oval shape, distinguish which has top (till what angle you tolerate and consider up ?). Then you need to segment those shapes very well so you can find areas with top portion oval shaped objects.
However, if you need to find simpler images like in the example, but still a more general approach, you may first get edges by using any edge detection (for example Canny). Then, use Hough Transform for curves and ellipses. But I don't think there is function or library for that. So you may need implement your own Hough Transform. For that you must decide what exactly you mean by oval top. For your two images, if you successfully find oval top, just get the area under it. But to get more general you may want to segment shape under it with more sophisticated approach.
For Hough Transform; http://en.wikipedia.org/wiki/Hough_transform#Circle_Detection_Process and for using it with ellipses http://en.wikipedia.org/wiki/Randomized_Hough_transform
Upvotes: 1