繁体   English   中英

C ++到Java-OpenCV

[英]C++ to Java - OpenCV

我试图将OpenCV C ++程序“移植”到Java,但是语法却大不相同。

我找不到Java OpenCV的等效项:

img_bw.at<uchar>(j,i);
boundingRect();
vector.push_back(Point(i,j)); // the Point part

另外,如何在向量中保留空间?

很难找到openCV C ++代码的Java等效项。 您只需要浏览互联网即可。 其中很多已经在StackOverflow上。

向量本质上是一个矩阵。 所以Mat是看神的地方。 MatOfPoint应该是您的向量等效项,它只是一个带有点的矩阵。 还有更多的MatOf类型的对象。

这段代码在语义上不是等效的(因为我不了解C ++),但是可以让您知道从这里开始的方向:

mat.get(row, col); // returns pixel info as a double[]
Imgproc.boundingRect(matOfpoint); // returns a Rectangle that wraps the points in this matrix
matOfpoint.push_back(otherMatOfPoint); // pushes points from otherMatOfPoint to the matOfPoint matrix

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM