Reputation: 640
I would like to detect ellipses with OpenCV for Android, using the Tutorial 2-Basic included with OpenCV 2.4.1 package as a starting point. Note that my ellipse would be a perfect-photoshop one.
From what I understand, using the "HoughCircles" will only find perfect (or so) circles, thus leaving ellipses out.
Any help would be much appreciated as I am a total beginner at OpenCV
This is what I've tried so far
case Sample2NativeCamera.VIEW_MODE_CANNY: (ignore the Canny mode...)
capture.retrieve(mGray, Highgui.CV_CAP_ANDROID_GREY_FRAME);
Imgproc.HoughCircles(mGray, mCircles, Imgproc.CV_HOUGH_GRADIENT, 1, 20);
Log.d("Ellipse Points", " X " + mCircles.get(1,1)[0] + mCircles.get(1, 1)[1]);
break;
If you think any more info could be useful, please let me know.
Upvotes: 12
Views: 26381
Reputation: 1927
If you already have an idea of the sizes of the ellipses that you're looking for, then try the following steps:
Upvotes: 4
Reputation: 93478
The parameters used in HoughCircles
play a fundamental role. HoughCircles
will detect not just perfect, but also near-perfect circles (ellipses). I suggest you check this examples:
And this answer has a decent collection of references.
Upvotes: 5
Reputation: 8914
One possible solution to your problem is similar to this thread Detection of coins (and fit ellipses) on an image .
You should take a look a opencv's function fitEllipse.
Upvotes: 7