代码拉取完成,页面将自动刷新
同步操作将从 yizhaoyanbo/Camera Calibration 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "undistort.h"
bool CUndistort::readParams()
{
ifstream in;
in.open(calibResultPath+"calibResult.txt", ios::in);
in>>K.at<float>(0, 0);
in>>K.at<float>(1, 1);
in>>K.at<float>(0, 2);
in>>K.at<float>(1, 2);
#ifdef CV
in >> discoeff.at<float>(0, 0);
in >> discoeff.at<float>(1, 0);
in >> discoeff.at<float>(2, 0);
in >> discoeff.at<float>(3, 0);
in >> discoeff.at<float>(4, 0);
#elif defined FISHEYE
in >> discoeff.at<float>(0, 0);
in >> discoeff.at<float>(1, 0);
in >> discoeff.at<float>(2, 0);
in >> discoeff.at<float>(3, 0);
#endif
in.close();
return true;
}
bool CUndistort::undistProcess()
{
//***************У****************//
R=Mat::eye(Size(3, 3),CV_32FC1);
Mat mapx, mapy;
Mat srcImg=imread(srcImgPath);
Mat dstImg;
#ifdef CV
cv::initUndistortRectifyMap(K, discoeff, R, K, srcImg.size(),CV_32FC1, mapx, mapy);
#elif defined FISHEYE
cv::fisheye::initUndistortRectifyMap(K, discoeff,R, K, srcImg.size(), CV_32FC1, mapx, mapy);
#endif
remap(srcImg, dstImg, mapx, mapy, CV_INTER_LINEAR);
cv::resize(dstImg, dstImg, cv::Size(), 0.25, 0.25, CV_INTER_LINEAR);
cv::namedWindow("show", 1);
imshow("show", dstImg);
waitKey(0);
return true;
}
void CUndistort::run()
{
bool readSuccess=readParams();
if (!readSuccess)
{
cout << "read Params Failed!" << endl;
getchar();
}
undistProcess();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。