initUndistortRectifyMap(cameraMatrixL, distCoeffL, Rl, Pr, cv::Size(boardwidth, boardheight), CV_32FC1, mapLx, mapLy);
initUndistortRectifyMap(cameraMatrixR, distCoeffR, Rr, Pr, cv::Size(boardwidth, boardheight), CV_32FC1, mapRx, mapRy);
cv::Mat rectifyImageL, rectifyImageR;
remap(image1, rectifyImageL, mapLx, mapLy, cv::INTER_LINEAR);
cv::FileStorage fw1("rectify.xml", cv::FileStorage::WRITE);
fw1 << "mat" << rectifyImageL;
remap(image2, rectifyImageR, mapRx, mapRy, cv::INTER_LINEAR);
cv::namedWindow("rectifyImageL", cv::WINDOW_AUTOSIZE);
cv::imshow("rectifyImageL", rectifyImageL);
cv::imshow("rectifyImageR", rectifyImageR);
展开后是这样的: