The default coordinate system when using the Matlab stereo camera calibrator is to have Z increasing away from the camera (see the bottom image of this page: http://www.mathworks.com/help/vision/gs/coordinate-systems.html)
I would like to rotate my coordinate system so that it is still right-handed, but with z=0 at the calibration target and +z directed towards the camera. I can construct a rotation matrix R that will rotate any coordinate 180 degrees about the x-axis:
RotMatrix= [1 0 0;
0 -1 0; % 0 cos(pi) -sin(pi)
0 0 -1]; % 0 sin(pi) cos(pi)
I can see how this could rotate the coordinates of any world point, e.g.
P_new_coordinates= R*[Px; Py; Pz];
But I'm not sure how to account for this rotation of coordinate system in the conversion from pixel coordinates to world coordinates and vice versa. Is there a way I can incorporate this directly into my camera matrix? I'm using the 3x4 camera matrix convention:
[su; sv; s]= M*[X; Y; Z; 1]