ImprovedOcamCalib icon indicating copy to clipboard operation
ImprovedOcamCalib copied to clipboard

how to get the reverse value ???

Open chennuo0125-HIT opened this issue 5 years ago • 3 comments

https://github.com/urbste/ImprovedOcamCalib/blob/a58ec61f9bf93900f7c3e28dbaf9ff22a47d9df8/cpp_model_impl/src/cam_model_general_test.cpp#L38

chennuo0125-HIT avatar Jan 10 '20 01:01 chennuo0125-HIT

https://github.com/urbste/ImprovedOcamCalib/blob/a58ec61f9bf93900f7c3e28dbaf9ff22a47d9df8/cpp_model_impl/src/cam_model_general_test.cpp#L38

Did you solve this?

ouyangandy avatar Jun 04 '20 06:06 ouyangandy

It took me quite a while to figure this out, but it seems like the author used the function findinvpoly, which can be located deep inside the files for fisheye calibration in matlab. In Matlab 2019a you can find this in <MatlabPath>\R2019a\toolbox\vision\vision\+vision\+internal\+calibration\computeApproxImageProjection.m

marcelino-pensa avatar Feb 27 '21 01:02 marcelino-pensa

You can find an easy method to obtain the reverse value as described in here: https://github.com/jj-tetraquark/ocamcalib_undistort/issues/1

As an example, we can approximately compute pInv from the OP assuming that the camera has a resolution of 720p (it doesn't seem to be the case, but the values of pInv ends up being very close to the expected one. We can run the following script:

ss_coeff = [-338.405137634369 0.000000e+00 0.00120189826837736 -1.27438189154991e-06 2.85466623521256e-09];
height = 720;
width = 1280;

% Compute the inverse polynomial
pol1 = flip(findinvpoly(ss_coeff, sqrt((width/2)^2+(height/2)^2)));

display_inv_poly = vpa(pol1, 5)

The output is as follows:

[510.98, 291.38, -13.886, 42.691, 23.557, -7.7764, 11.831, 16.32, -3.0772, -7.1109, -1.7924]

The expected values in cam_model_general_test.cpp are as follows (quite close):

[510.979186217526, 291.393724562448, -13.8758863124724, 42.4238251854176, 23.054291112414, -7.18539785128328, 14.1452111052043, 18.5034196957122, -2.39675686593404, -7.18896323060144, -1.85081569557094]

I could not find the true resolution of the camera that was used for calibration, and that's probably why I couldn't get the results precisely as expected.

marcelino-pensa avatar Nov 10 '21 23:11 marcelino-pensa