# Revision history [back]

Got this working after posting:

  Mat newCamMatrix = calibCamMatrix.clone();
double scale = double(newWidth) / double(calibWidth);
newCamMatrix.at<double>(0,0) = scale * calibCamMatrix.at<double>(0,0);
newCamMatrix.at<double>(1,1) = scale * calibCamMatrix.at<double>(1,1);
newCamMatrix.at<double>(0,0) = scale * calibCamMatrix.at<double>(0,0);
newCamMatrix.at<double>(0,2) = scale * calibCamMatrix.at<double>(0,2);
newCamMatrix.at<double>(1,2) = scale * calibCamMatrix.at<double>(1,2);


calibCamMatrix is the matrix generated by the calibration process (where frame had x resolution of calibWidth). newCamMatrix is the modified matrix to be passed to initUndistortRectifyMap(), along with the new resolution (newWidth/yyy)

Got this working after posting:

  Mat newCamMatrix = calibCamMatrix.clone();
double scale = double(newWidth) / double(calibWidth);
newCamMatrix.at<double>(0,0) = scale * calibCamMatrix.at<double>(0,0);
newCamMatrix.at<double>(1,1) = scale * calibCamMatrix.at<double>(1,1);
newCamMatrix.at<double>(0,0) = scale * calibCamMatrix.at<double>(0,0);
newCamMatrix.at<double>(0,2) = scale * calibCamMatrix.at<double>(0,2);
newCamMatrix.at<double>(1,2) = scale * calibCamMatrix.at<double>(1,2);


calibCamMatrix is the matrix generated by the calibration process (where frame had x resolution of calibWidth). newCamMatrix is the modified matrix to be passed to initUndistortRectifyMap(), along with the new resolution (newWidth/yyy)