bytedeco / procamcalib

A User-Friendly Method to Calibrate Cameras and Projector-Camera Systems
GNU General Public License v2.0
69 stars 26 forks source link

Test Calibration #17

Open teganscott opened 6 years ago

teganscott commented 6 years ago

Is there a method I can use to test the calibration? When I put the calibration numbers into my own software (which works with opencv and calibrations from other systems) it doesn't coorrelate the camera and projector correctly.

Thank you, Tegan

saudet commented 6 years ago

Could you copy/paste typical results that you get here?

teganscott commented 6 years ago

Below is what procamlib gives me, and the formatting I have for my calibration files. These two will be slightly different because the projector and camera are in different positions. The biggest difference is in the extrinsic rotation of my old calibrations was a 3x1 matrix, and the new one is 3x3. In my code I have the following that converts the rotation matrix into Rodrigues:

cv::Vec3d axis_angle; double data[9] = {9.9981890125721906e-01, -8.7052645857853533e-03, 1.6922856062103579e-02, 1.6082024959920501e-02, 8.6194239428941977e-01, -5.0675110004795354e-01, -1.0175124667329560e-02, 5.0693148185441583e-01, 8.6192629588781566e-01}; cv::Mat origRot = cv::Mat(3,3, CV_64F, data); cv::Rodrigues(origRot, axis_angle); cv::Mat rot = cv::Mat(3, 1, CV_64F, axis_angle);

This is what procamlib gives me:

%YAML:1.0

Cameras:

This is what the calibration software I am working with needs: CAMERA: %YAML:1.0 cameraMatrix: !!opencv-matrix rows: 3 cols: 3 dt: d data: [ 5.2390037217688837e+02, 0., 2.9894316833599152e+02, 0., 5.2273440154265677e+02, 2.3062940702516227e+02, 0., 0., 1. ] imageSize_width: 640 imageSize_height: 480 sensorSize_width: 0 sensorSize_height: 0 distCoeffs: !!opencv-matrix rows: 5 cols: 1 dt: d data: [ -9.4425188361295043e-02, 1.3559756613205826e-01, 2.5196205369225116e-04, -2.2982133039631367e-03, 2.9994602486057755e-02 ] reprojectionError: 1.5748588740825653e-01

PROJECTOR: %YAML:1.0 cameraMatrix: !!opencv-matrix rows: 3 cols: 3 dt: d data: [ 2.0071611042360921e+03, 0., 6.2447724667816487e+02, 0., 2.0000916462185571e+03, 1.5582659966238060e+02, 0., 0., 1. ] imageSize_width: 1280 imageSize_height: 720 sensorSize_width: 0 sensorSize_height: 0 distCoeffs: !!opencv-matrix rows: 5 cols: 1 dt: d data: [ -9.8245651394649747e-02, 5.6098143869503347e-01, 1.1589744437146346e-02, 4.8286095453437001e-03, 5.6681736350551748e-01 ] reprojectionError: 5.2733808755874634e-01

EXTRINSICS: %YAML:1.0 Rotation_Vector: !!opencv-matrix rows: 3 cols: 1 dt: d data: [ 6.8210825021344387e-02, 2.8757581667304671e-02, -3.0531880320480636e-02 ] Translation_Vector: !!opencv-matrix rows: 3 cols: 1 dt: d data: [ 2.4228539839093036e-01, 3.1220677070266731e+00, 2.1248321280799489e+00 ]

saudet commented 6 years ago

Good! The errors don't look too big, so the calibration is OK. You'll just need to plug in the numbers correctly, yes.