[英]opencv c++ to java distance transform
I've been converting my opencv code in c++ 2.4.9 into java and I've been having trouble getting this code to work. 我一直在将c ++ 2.4.9中的opencv代码转换为Java,并且一直无法使此代码正常工作。
c++ code C ++代码
Mat Gradient;
Mat edge = MeanShift >= 225, dist;
cvtColor(edge, edge, CV_BGR2GRAY);
distanceTransform(edge, dist, CV_DIST_L2, CV_DIST_MASK_5);
dist *= 65655;
pow(dist, 2, dist);
dist.convertTo(Gradient, CV_8U, 1, 0.1);
threshold(Gradient, Gradient, 2, 255, CV_THRESH_BINARY);
imshow("Gradient before", Gradient);
I am really confused how to get the equivalent of Mat edge = MeanShift >= 225, dist; 我真的很困惑如何获得等效的Mat edge = MeanShift> = 225,dist; in java... 在Java中...
Is there a way to do this? 有没有办法做到这一点?
In C++ this would call the operator>= on the Mat object and then the comma operator on the resulting Mat edge
. 在C ++中,这将在Mat对象上调用operator> =,然后在生成的Mat edge
上调用逗号运算符。
Basically this code does: 基本上,这段代码可以做到:
Mat edge = MeanShift.operator>=(225);
edge.operator,(dist);
So the right place to look would first the C++ operator and then the compare function in Java. 因此,正确的位置应该是C ++运算符,然后是Java中的compare函数。
Let latter I think I could find here: 让后者我可以在这里找到:
[ http://docs.opencv.org/java/org/opencv/core/Core.html#compare(org.opencv.core.Mat , org.opencv.core.Scalar, org.opencv.core.Mat, int)][1] [ http://docs.opencv.org/java/org/opencv/core/Core.html#compare(org.opencv.core.Mat,org.opencv.core.Scalar,org.opencv.core.Mat,int )] [1]
[1]: Compare in Core.html [1]:在Core.html中进行比较
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.