다음 사진이 있습니다. 실제로 감지하고 싶은 것은 각 상자의 왼쪽 상단에있는 글자가있는 상자 위의 원입니다. 그러나 그 결과 다른 일부 서클도 감지합니다. 나는 이유를 모른다. I가 감지 할HoughCircles에서 잘못된 서클을 찾습니다 (opencv)
이미지 :
이 결과는 모습입니다 같은 :
당신이 그것을 원으로 편지를 종종 찾을 수 있습니다 볼 수 있듯이 및 또한 레고의 서클들. 여기 내 코드는 다음과 같습니다.
Mat source = Highgui.imread("testar.jpg", Highgui.CV_LOAD_IMAGE_COLOR);
Mat destination = new Mat(source.rows(), source.cols(), source.type());
Imgproc.cvtColor(source, destination, Imgproc.COLOR_RGB2GRAY);
Imgproc.GaussianBlur(destination, destination, new Size(3,3),0,0);
Mat circles = new Mat();
Imgproc.HoughCircles(destination, circles, Imgproc.CV_HOUGH_GRADIENT, 1, 20, 10, 20, 7, 13);
int radius;
Point pt;
for (int x = 0; x < circles.cols(); x++) {
double vCircle[] = circles.get(0,x);
if (vCircle == null)
break;
pt = new Point(Math.round(vCircle[0]), Math.round(vCircle[1]));
radius = (int)Math.round(vCircle[2]);
// draw the found circle
Core.circle(destination, pt, radius, new Scalar(0,255,255), 3);
Core.circle(destination, pt, 3, new Scalar(255,255,255), 3);
}
Highgui.imwrite("foundCircles.jpg", destination);
테스트 이미지에서 발견되는 모든 것이 원이기 때문에 의도적으로 허위 원 기능이 작동하는 것 같습니다. 찾을 서클의 종류에 대해 더 높은 지식을 갖고 있다면 서클 안에 다른 문자가 있는지 여부와 관계없이 서클 내에서 어떤 색상이 있는지 테스트 해보십시오. – Micka
죄송합니다, 저에게 매우 정확하게 보입니다. –