How can I get the number of circles that return by hough circle using java open CV.
Mat circles = new Mat(); //Imgproc.HoughCircles(edges, circles, Imgproc.CV_HOUGH_GRADIENT, 1, 60, 200, 20, 30, 0 ); Imgproc.HoughCircles(gray, circles, Imgproc.CV_HOUGH_GRADIENT, 1, 10, 200, 20, 40, 0 );
System.out.println("#rows " + circles.rows() + " #cols " +
circles.cols());
I don't know how it store the circles in Mat that has cols and rows ?? I try to get the circle in the row but it does not show me good result.
for( int i = 0; i < circles.rows(); i++ ) { double[] data = circles.get(i, 0); x = data[0]; y = data[1]; r = (int) data[2]; }
also I try to get the circle from column also does not work !!!
for( int i = 0; i < circles.cols(); i++ ) { double[] data = circles.get(0, i); x = data[0]; y = data[1]; r = (int) data[2]; }
Any help please.