1
我正在嘗試使用HoughCircles方法的JavaCV實現,但我遇到了一些參數問題。 這是我的代碼:如何傳遞和使用JavaCV HoughCircles方法的參數
所有的Mat currentImageGray = tgtFrag.getImage().clone();
Mat detectedCircles = new Mat();
HoughCircles(currentImageGray, detectedCircles, CV_HOUGH_GRADIENT, 1, 2, 254, 25, tgtFrag.getImage().rows()/4, 0);
if (detectedCircles != null && !detectedCircles.empty()) {
// TO DO:
// Print the center and the raidus of the detected circles.
}
首先,檢測(該HoughCircles
的第二argment)的結果作爲一個墊(detectedCircles
)。
我想處理detectedCircles
墊,並以某種方式打印控制檯上圓的中心和半徑。到目前爲止,我的嘗試失敗了:我一直試圖使用FloatBufferIndexer
迭代detectedCircles
,這可能是正確的方向,但我還沒有成功,任何人都可以提供幫助?
請注意以下幾點:
- 我使用JavaCV,不OpenCV的。
- 我使用的是JavaCV HoughCircles,而不是cvHoughCircles(使用cvHoughCircles的解決方案也可以)。
- 我使用的是最新版本的JavaCV,即1.0(2015年7月)。
謝謝@Tzeencth,這確實可以解決我的問題,甚至很難我想看到使用HoughCircle方法,而不是cvHoughCircles。我將等待一段時間,然後將其標記爲我的問題的答案。 – INElutTabile