I am facing a problem in understanding what the new camera matrix in cvUndistortpoints
. We get a camera matrix of camera in stereocalibration itself and why we have to pass a new cameramatrix in cvstereorectify which we obtain from cvundistortpoints. How exactly new camera matrix different from camera matrix after the output of cvUndistortPoints
?
void cvUndistortPoints(const CvMat* src, CvMat* dst, const CvMat* cameraMatrix,
const CvMat* distCoeffs, const CvMat* R=NULL, const CvMat* P=NULL)
The reference link is here: https://docs.opencv.org/3.4/da/d54/group__imgproc__transform.html#ga55c716492470bfe86b0ee9bf3a1f0f7e
The answer is one page up in the documentation you provided. P is given to you by StereoRectify.
Here is what it says about it under undistort in opencvrefman.pdf, which, my friend, you should be reading too:
newCameraMatrix – Camera matrix of the distorted image. By default, it is the same as cameraMatrix but you may additionally scale and shift the result by using a different matrix.
Now, I am pretty new to this, and have not had occasion to use the StereoRectify functions yet, but I am guessing that you might want to undistort an image to look like what a different camera would see.