Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/144.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
这段代码到OpenCV Java的翻译是什么?_Java_C++_C_Opencv - Fatal编程技术网

这段代码到OpenCV Java的翻译是什么?

这段代码到OpenCV Java的翻译是什么?,java,c++,c,opencv,Java,C++,C,Opencv,此代码是OpenCV c++: 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));

此代码是OpenCV c++:

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);
}
但是,我在(Point3 circle:circles.toArray())的
中遇到了一个错误

有什么想法吗?谢谢

编辑2:

上次编辑问题的解决方案位于中
MatOfPoint3圆圈=新的MatOfPoint3()

一定是
MatOfPoint3f圆圈=新的MatOfPoint3f()

使用类点3。由坐标x、y和z指定的三维点的模板类。该类的一个实例可以与C结构CvPoint2D32f互换。与点坐标类似,可以将三维点的坐标转换为其他类型。还支持向量算术和比较运算。

那么
cvgetsekelem
CV_AA
呢?我找不到他们。谢谢,我不需要
cvgetsekelem
。我有这样一个:
for(Point3 circle:circles.toArray()){Point center=new Point(circle.x,circle.y);int radius=(int)Math.round(circle.z);Core.circle(image,center,radius,new Scalar(0255,0),6,CV_AA,0);}
现在只缺少
CV_AA
MatOfPoint3 circles = new MatOfPoint3();
Imgproc.HoughCircles(image, circles, Imgproc.CV_HOUGH_GRADIENT,2, image.rows()/4,200,100,0,0);
for(Point3 circle : circles.toArray()){
     Point center = new Point(circle.x, circle.y);
     int radius = (int) Math.round(circle.z);      
     Core.circle(image, center, radius, new Scalar(0,255,0), 6, 8, 0);    
}
Exception in thread "main" java.lang.UnsupportedOperationException: Mat data type is not compatible: 21
     at org.opencv.core.Mat.get(Mat.java:2581)
     at org.opencv.core.MatOfPoint3.toArray(MatOfPoint3.java:64)
     at org.opencv.core.MatOfPoint3.toList(MatOfPoint3.java:76)
     at main.java.DetectFaceDemo.run(HelloOpenCV.java:60)
at main.java.HelloOpenCV.main(HelloOpenCV.java:83)