Witam, czy mógłby ktoś pomóc mi wyznaczyć długość srednicy/promienia okregu znalezionego na zdjęciu za pomocą poniższej metody.
public class metody {
public static opencv_core.IplImage kolo(String zrodlo){
opencv_core.IplImage src = cvLoadImage(zrodlo);
opencv_core.IplImage gray = cvCreateImage(cvGetSize(src), 8, 1);
cvCvtColor(src, gray, CV_BGR2GRAY);
cvSmooth(gray, gray, CV_GAUSSIAN, 3);
opencv_core.CvMemStorage mem = opencv_core.CvMemStorage.create();
opencv_core.CvSeq circles = cvHoughCircles(
gray, //Input image
mem, //Memory Storage
CV_HOUGH_GRADIENT, //Detection method
1, //Inverse ratio
100, //Minimum distance between the centers of the detected circles
100, //Higher threshold for canny edge detector
100, //Threshold at the center detection stage
15, //min radius
500 //max radius
);
for (int i = 0; i < circles.total(); i++) {
opencv_core.CvPoint3D32f circle = new opencv_core.CvPoint3D32f(cvGetSeqElem(circles, i));
opencv_core.CvPoint center = cvPointFrom32f(new opencv_core.CvPoint2D32f(circle.x(), circle.y()));
int radius = Math.round(circle.z());
cvCircle(src, center, radius, opencv_core.CvScalar.GREEN, 6, CV_AA, 0);
}
//cvShowImage("Result", src);
cvWaitKey(0);
return src;
}
}