Ask Your Question

laks.it's profile - activity

2019-09-13 16:00:22 -0600 received badge  Notable Question (source)
2018-07-24 16:40:59 -0600 received badge  Popular Question (source)
2018-03-06 04:55:25 -0600 received badge  Popular Question (source)
2013-07-10 10:46:55 -0600 asked a question convertPointsToHomogeneous doesn't work with double

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!

2013-07-09 03:19:25 -0600 asked a question OpenCV Error: Bad argument (For non-planar calibration rigs the initial intrinsic matrix must be specified) in cvCalibrateCamera2

Hi there! I'm trying to compute the camera matrix using a series of (2D <-> 3D) correspondences not acquired from a planar rig. From the documentation of calibrateCamera() it seems possible to use it also in this way but, when I run my program, I get this error:

OpenCV Error: Bad argument (For non-planar calibration rigs the initial intrinsic matrix must be specified) in cvCalibrateCamera2, file /opt/local/var/macports/build/_opt_mports_dports_graphics_opencv/opencv/work/opencv-2.4.5/modules/calib3d/src/calibration.cpp, line 1592 terminate called throwing an exception

The code is very simple, here is a sketch

vector<vector<Point3f> > objectPoints;
vector<vector<Point2f> > imagePoints;
......
   ...insert 3D and 2D points in objectPoint and imagePoints
......
Mat cameraMatrix= Mat(3, 3, CV_64F);
Mat distCoeffs;
vector<Mat> rvecs; //rotation vector
vector<Mat> tvecs;//translation vector

calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs);

Does anybody know what's wrong? Thanks in advance!