Zypps987
Zypps987

Reputation: 414

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++ code

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; in java...

Is there a way to do this?

Upvotes: 1

Views: 318

Answers (1)

Christopher Oezbek
Christopher Oezbek

Reputation: 26333

In C++ this would call the operator>= on the Mat object and then the comma operator on the resulting 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.

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]

[1]: Compare in Core.html

Upvotes: 1

Related Questions