initundistortrectifymap line 103 and 137 what is going on?
Hi,
I'm having trouble understanding a line in the original source code of the function initUndistortRectifyMap(..). In the corresponding docs this part doesn't seem to be mentioned.
The code is on line 103 and 137 of the following undistort.cpp function:
It appears to be taking the product of the camera intrinsic matrix A and multiplying it with the rotation. It then takes the inverses (all on line 103). This is then used on line 137 when bits are extracted out from the result on line 103. The results I get when using this code are excellent but I just can't understand it or tie it into the documentation at:
In particular I don't see how the first three lines of equations in the doc corresspond to the inverse of the cam matrix A and the rotation matrix?
Can some clever person put me right or point me at a doc that just explains that bit? Thanks
I think I was just being a bit dense and may have an answer after staring at this all afternoon).
I think the documentation is just a more specific case of the implementation in that it doesn't explicitly handle skew in the intrinsic matrix. However the first two equations are just the inverse of the intrinsic matrix (with skew set to zero) and explicitly written out. The third line then handles the rotation. My matrix maths is a bit rusty but I think:
[u v 1]^T = A R [x y 1]^T (camera to pixel coords)
inv(AR) [u v 1]^T = [x y 1]^T (pixel to camera)
inv(R)inv(A) [u v 1]^T = [x y 1]^T
I convinced myself with Matlab and some dummy numbers for fx, fy, cx and cy that inv(A) gives exactly equation 1 and 2. The third equation ...(more)