小编Zeb*_*ett的帖子

霍夫圆检测精度很低

我试图从一个看起来非常清晰的图像中检测圆形。我确实意识到圆的一部分丢失了,但从我读到的关于霍夫变换的内容来看,这似乎不会导致我遇到的问题。

输入: 输出图像

输出: 在此处输入图片说明

代码:

// Read the image
Mat src = Highgui.imread("input.png");

// Convert it to gray
Mat src_gray = new Mat();
Imgproc.cvtColor(src, src_gray, Imgproc.COLOR_BGR2GRAY);

// Reduce the noise so we avoid false circle detection
//Imgproc.GaussianBlur( src_gray, src_gray, new Size(9, 9), 2, 2 );

Mat circles = new Mat();

/// Apply the Hough Transform to find the circles
Imgproc.HoughCircles(src_gray, circles, Imgproc.CV_HOUGH_GRADIENT, 1, 1, 160, 25, 0, 0);

// Draw the circles detected
for( int i = 0; i < circles.cols(); …
Run Code Online (Sandbox Code Playgroud)

java opencv image-processing computer-vision edge-detection

3
推荐指数
1
解决办法
3678
查看次数