convertPointsToHomogeneous doesn't work with double

asked 2013-07-10 10:46:55 -0600

laks.it gravatar image

Hi all!

I'm using the convertPointsToHomogeneous() function but, I'm having some trouble using it with Point_d objects. Here is my code:

vector<Point2d> pointsIm1;
vector<Point2d> pointsIm2;
vector<Point3d> hpointsIm1; 
vector<Point3d> hpointsIm2; 

Mat(matchPointsImage1).copyTo(pointsIm1);
Mat(matchPointsImage2).copyTo(pointsIm2);
convertPointsToHomogeneous(pointsIm1, hpointsIm1);

I don't understand why it works fine if I use Point2f and Point3f instead of Point2d and Point3d. Any idea? Here is the error:

OpenCV Error: Assertion failed (npoints >= 0 && (src.depth() == CV_32F || src.depth() == CV_32S)) in convertPointsToHomogeneous

The number of points is not null (so npoints>=0) but i don't know how to check the depth(). Thanks!

edit retag flag offensive close merge delete

Comments

2

Apparently the function only allows float (=CV_32F) or int (=CV_32S), so use float or modify the opencv-function to also support double.

Guanta gravatar imageGuanta ( 2013-07-10 12:24:53 -0600 )edit