//=========================对原始图像畸变矫正========================== double fx= 355.0974745605948; double fy= 355.47832693317105; double cx= 357.7074039567714; double cy= 351.0244037313849; double k1= -0.023790306606729556; double k2= -0.0007571494794293715; double p1= 0.00016452517056601848; double p2= -0.0005743824914513448; cv::Mat cameraMatrix = (cv::Mat_<double>(3, 3) << fx, 0, cx, 0, fy, cy, 0, 0, 1); cv::Mat distCoeffs = (cv::Mat_<float>(4, 1) << k1, k2, p1, p2); cv::Mat dst_Left; // 普通图像畸变矫正 //undistort(imLeft, dst_Left, cameraMatrix, distCoeffs); cv::Size corrected_size(imLeft.cols,imLeft.rows); cv::Mat mapx, mapy; // 鱼眼图像畸变矫正 cv::fisheye::initUndistortRectifyMap(cameraMatrix, distCoeffs, cv::Matx33d::eye(), cameraMatrix, corrected_size, CV_16SC2, mapx, mapy); remap(imLeft, dst_Left, mapx, mapy, cv::INTER_LINEAR, cv::BORDER_TRANSPARENT); // cv::imshow("leftImage", imLeft); // cv::imshow("dst_Left", dst_Left); // cv::waitKey(2); imLeft=dst_Left; //=========================对原始图像畸变矫正==========================
标签:矫正,Mat,double,鱼眼,opencv,畸变,cv From: https://www.cnblogs.com/gooutlook/p/17111967.html