Equivalent of OpenCV statement in Java using JavaCV

I want to know how to build the following C ++ statement in OpenCV using JavaCV:

float* p = (float*)cvGetSeqElem(circles, i); int radius = cvRound(p[2]); 

To get the radius of a circle detected with cvHoughCircles (). Obviously, Java does not use a pointer, so I do not know how to do this in Java. The code that I have, so you can see its context:

 lines = cvHoughCircles(frame2, storage, CV_HOUGH_GRADIENT, 1, 50, 300, 60, 10, 600); for (int i = 0; i < lines.total(); i++) { //Would like the code to go here CvPoint2D32f point = new CvPoint2D32f(cvGetSeqElem(lines, i)); cvCircle(src, cvPoint((int)point.x(), (int)point.y()), 3, CvScalar.WHITE, -1, 8, 0); Point p = new Point((int)point.x(), (int)point.y()); points.add(p); } 
+6
source share
1 answer

JavaCPP maps C / C ++ arrays / pointers to pointer objects, so we can access it the same way as in C / C ++, that is:

 FloatPointer p = new FloatPointer(cvGetSeqElem(circles, i)); int radius = Math.round(p.get(2)); 
+6
source

Source: https://habr.com/ru/post/908796/


All Articles