cvMat image;stdvectorstdvectorcvPoint3f objectPoints;stdvectorstdvectorcvPoint2f imagePoints;void MainWindowloadImages 打开文件夹对话框选择需要加载的图片文件夹 QString dirName = QFileDialoggetExistingDirectorythis
255, 0), 2); else cv::putText(tmp, "Chessboard Not Detected", cv::Point(20, 50), cv::FONT_HERSHEY_TRIPLEX, 1.0, CV_RGB(255, 0, 0), 2); cv::imshow("Chessboard Detection", tmp); }
// 进行相机标定
cv::Mat cameraMatrix, distCoeffs;
std::vector<cv::Mat> rvecs, tvecs;
cv::calibrateCamera(objectPoints, imagePoints, image.size(), cameraMatrix, distCoeffs, rvecs, tvecs);
// 显示标定结果
std::cout << "Camera Matrix: " << cameraMatrix << std::endl;
std::cout << "Distortion Coefficients: " << distCoeffs << std::endl;
cv::Mat undistorted;
cv::undistort(image, undistorted, cameraMatrix, distCoeffs);
cv::imshow("Undistorted Image", undistorted);
原文地址: https://www.cveoy.top/t/topic/hfJT 著作权归作者所有。请勿转载和采集!