euclid135
euclid135

Reputation: 1272

Android OpenCV List<KeyPoint> to Mat

i'm trying to use stereouncalibratedrectify from opencv for android

and i didn't find the way to convert from List to Mat in java, but in opencv c++ we can create a Mat from vector

this is the step i did :

//find fundamental matrix
//srcmatchkey and dstmatchkey are List<Point> as required in findFundamentalMat function,    

they have been calculated using FLANN Matcher


Cali3D.findFundamentalMat(srcMatchKey, dstMatchKey, Calib3d.FM_8POINT);

//this is the strange part

Calib3D.stereoRectifyUncalibrated(Mat points1,Mat,points1,Mat fundamentalMatrix,Mat H1,Mat H2)

from what i understand, Mat points1 and Mat points2 are Mat that made from srcMatchKey and dstMatchKey ( or am i wrong??, correct it please if it is wrong ) and there is no Mat constructor that accepted List or something like vector in c++ , and Mat c++ has that.

so the question is Is there any way to create Mat from List in android?? thanks for your help...

Upvotes: 1

Views: 4071

Answers (1)

OpenCV4Android
OpenCV4Android

Reputation: 266

If you use OpenCV 2.3.1 for Android, the code converting List to Mat is:

  List<Point> lp = null;
  Mat mp = Converters.vector_Point_to_Mat(lp);

or talking about the stereoRectifyUncalibrated() it can be:

  Mat mp = Converters.vector_Point2d_to_Mat(lp);

In OpenCV 2.4.beta for Android (that has been published recently) all List<T> types were replaced with MatOfT types that prevents copying data forth/back between Native and Java.

Upvotes: 3

Related Questions