I have a set of solid body images with some markers attached. I defined a coordinate system with a start in one of these markers, and I want to get a rotation and translation between this coordinate system and the one that is defined at the beginning of the camera.
I tried POSIT for some time (after this ), without getting acceptable results, until I realized that I had to first calibrate the camera location. Based on this and using some images obtained using the calibration body, I got a matrix of built-in cameras and distortion parameters. I also got a bad (?) Reprojection Error 1.276.
- Is the re-projection error too high? How can I improve it? (I used more images and only slightly reduced the value).
- Can I use distortion options in POSIT? How?
Thanks.
It seems that the only way to get the error when reprogramming (it changed from ~ 1.3 to ~ 0.7) is to set the following parameters in the "0" XML configuration file:
<Calibrate_FixAspectRatio> 0 </Calibrate_FixAspectRatio> <Calibrate_AssumeZeroTangentialDistortion> 0 </Calibrate_AssumeZeroTangentialDistortion> <Calibrate_FixPrincipalPointAtTheCenter> 0 </Calibrate_FixPrincipalPointAtTheCenter>
Using more images does not change the error, and I'm still not sure if this new error is valid or not.
I used the values ββthat the calibration gave as output (namely, the focal length and optical center) in POSIT, but the results were very similar to those that I got when I used the pre-calibration values. I did not use the distortion parameters because I do not know how to process them in POSIT (can they affect the results?).
The matrix of the camera that I received after calibration:
<Camera_Matrix type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data> 2.0613885351075501e+003 0. 2.2865517805186334e+002 0. 2.2546461307897816e+003 2.5261706201677623e+002 0. 0. 1. </data> </Camera_Matrix>
and the way I used it in POSIT:
#define FOCAL_LENGTH 2158.0175 #define FOCAL_LENGTH_X 2061.389 #define FOCAL_LENGTH_Y 2254.646 #define cX 203.655 #define cY 205.117
I calculated the difference between the new center coordinates and the setting for the calibration images, and then applied this difference to the central coordinates of the images that I work with POSIT.
I use POSIT on two different images, where theoretically I should get a rotation of 0 (for the first) and 10 (for the second) degrees between the model and the camera coordinate system. After I get the rotation matrix for each image, I determined the unit vector in the camera coordinate system and calculated it in the model coordinate system, multiplying it by the inverse of the two rotation matrices specified by POSIT, getting two new vectors in the coordinate system model. When I calculate the angle between these two vectors in the model coordinate system, the output is not what it should be - 10 degrees.
Does anyone have an idea where I'm wrong?