首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用fisheye时断言失败

使用fisheye时断言失败
EN

Stack Overflow用户
提问于 2015-07-01 15:50:01
回答 1查看 945关注 0票数 0

我正试着去扭曲摄像机拍摄的鱼眼图像。我已经得到了所需的摄像机参数。但是,当我运行下面的代码时:

代码语言:javascript
运行
复制
Mat cammatrix = cv::Mat::zeros(3,3, CV_64F);
cammatrix.at<double>(0,0) = 3.7089418826568277e+002;
cammatrix.at<double>(1,1) = 3.7179355652545451e+002;
cammatrix.at<double>(0,2) = 3.4450520804288089e+002;
cammatrix.at<double>(1,2) = 2.5859133287932718e+002;
cammatrix.at<double>(2,2) = 1.0;
std::vector<double> distortcoeff;
double tempdoub = -2.2022994789941803e+000;
distortcoeff.push_back(tempdoub);
tempdoub = 4.4652133910671958e+000;
distortcoeff.push_back(tempdoub);
tempdoub = 6.8050071879644780e-001;
distortcoeff.push_back(tempdoub);
tempdoub = -1.7697153575434696e+000;
distortcoeff.push_back(tempdoub);

// Process images here (optional)
    Mat img_scene (current);

    if(!img_scene.data )
    { std::cout<< " --(!) Error reading images " << std::endl; return -1; }
    img_scene.convertTo(img_scene, CV_32FC2);
    cv::fisheye::undistortPoints(img_scene, img_scene, cammatrix, distortcoeff);

我知道这个错误:

代码语言:javascript
运行
复制
OpenCV Error: Assertion failed (distorted.type() == CV_32FC2 || distorted.type() == CV_64FC2) in undistortPoints

不知道为什么会发生这种情况,因为我在将.convertTo行转换为CV_32FC2之前就有了它。如果有人能帮我解决这个错误,我会非常感激的!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-08 07:43:25

undistortPoints()函数是检索不失真的像素位置,因为它在图像上的当前失真位置。也就是说,它的作用是点,而不是图像。使用鱼眼::图像不失真图像。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31166105

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档