【发布时间】:2015-10-20 07:57:47
【问题描述】:
我正在尝试使用 HoughCircles 方法的 JavaCV 实现,但我遇到了一些参数问题。 这是我的代码:
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 的第二个参数)以 Mat (detectedCircles) 的形式给出。
我想处理detectedCircles Mat 并以某种方式在控制台上打印圆的中心和半径。到目前为止我的尝试都失败了:我一直在尝试使用FloatBufferIndexer 迭代detectedCircles,这可能是正确的方向,但我还没有成功,有人可以帮忙吗?
请注意以下几点:
- 我使用的是 JavaCV,而不是 openCV。
- 我使用的是 JavaCV HoughCircles,而不是 cvHoughCircles(不过,使用 cvHoughCircles 的解决方案也可以)。
- 我正在使用最新版本的 JavaCV,即 1.0(2015 年 7 月)。
【问题讨论】:
标签: java javacv mat hough-transform