問題描述
我想使用 OpenCV for Android 檢測橢圓,使用 OpenCV 2.4.1 包中包含的 Tutorial 2-Basic 作為起點.請注意,我的橢圓將是一個完美的 Photoshop 橢圓.
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.
據我了解,使用HoughCircles"只會找到完美(或左右)的圓圈,因此會忽略橢圓.
From what I understand, using the "HoughCircles" will only find perfect (or so) circles, thus leaving ellipses out.
任何幫助將不勝感激,因為我是 OpenCV 的初學者
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.
推薦答案
您的問題的一個可能解決方案類似于此線程 Detection of圖片上的硬幣(和適合的橢圓) .
One possible solution to your problem is similar to this thread Detection of coins (and fit ellipses) on an image .
你應該看看opencv的函數fitEllipse.
You should take a look a opencv's function fitEllipse.
這篇關于使用 OpenCV 進行橢圓檢測的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!