Hi,
I'm implementing markerbased tracking on Android and I'm stuck at the rotation matrix.
Up until the solvePnP everything works fine and I get results (rvec, tvec) that seem legit.
But after using the rvec in Rodrigues for having a rotation matrix, it just results in a 3x3 Matrix, filled only with zeroes.
I really don't get this, because there are definitely values in rvec, but Rodrigues just doesn't use them?
I hope somebody knows whats wrong.
Heres the code snippet:
Mat rvec = new Mat(3,1,CvType.CV_64F);
Mat tvec = new Mat(3,1,CvType.CV_64F);
MatOfPoint3f markerPointsMat = new MatOfPoint3f(new Point3(0,0,0),new Point3(1,0,0),new Point3(1,1,0),new Point3(0,1,0));
MatOfPoint2f pointsMat = new MatOfPoint2f(points.get(0),points.get(1),points.get(2),points.get(3));
//cam matrix, by hand
Mat cam=new Mat(3,3,CvType.CV_64F);
cam.zeros(cam.size(),CvType.CV_64F);
cam.put(0, 0, 1400.533595140377 );
cam.put(0, 2, 175.5 );
cam.put(1, 1, 1400.533595140377 );
cam.put(1, 2, 143.5);
cam.put(2,2,1.0);
double[] a = {0.1155606860709641,-0.3046292381782507,0,0,0};
MatOfDouble dist = new MatOfDouble(a);
Calib3d.solvePnP(markerPointsMat, pointsMat, cam, dist, rvec, tvec);
//rot vector to matrix
Mat rmat = Mat.zeros(3,3,CvType.CV_64F);
Rodrigues(rvec, rmat);