OpenCV不会扭曲鱼眼图像的中央部分 [英] OpenCV undistorts only a central part of fisheye image

查看:258
本文介绍了OpenCV不会扭曲鱼眼图像的中央部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过OpenCV 3.4.0(C ++,MS Windows)执行鱼眼镜头相机校准.

I'm trying to perform fisheye camera calibration via OpenCV 3.4.0 (C++, MS Windows).

我用cv :: fisheye :: calibrate制作了K和D(相机矩阵和径向失真系数矩阵).然后,我使用cv :: fisheye :: initUndistortRectifyMap生成X和Y坐标的地图. 最后,我使用cv :: remap通过initUndistortRectifyMap中的地图使鱼眼镜头的图像不失真. 一切看起来都不错,但是OpenCV只会扭曲鱼眼图像的中心部分. 边移到外面. 我想使整个图像变形. 我尝试手动更改K矩阵中的焦距,并获得未失真的边缘,但是它们变得非常非常模糊. 我在此任务中发现了一些结果.例如

I used cv::fisheye::calibrate to make K and D (camera matrix and radial distortion coeffitients matrix). Then I used cv::fisheye::initUndistortRectifyMap to produce maps for X and Y coordinates. And finally I used cv::remap to undistort image from fisheye camera via maps from initUndistortRectifyMap. Everything looks right, but OpenCV dewarps only a central part of fisheye image. Edges are moved outside. I'd like to dewarp the whole image. I tried to change focal length in K matrix manually, and got undistorted edges, but they became very very blurry. I found some results in this task. For example

https://www.youtube.com/watch?v=Ll8KCnCw4iU

https://www.youtube.com/watch?v=p1kCR1i2nF0

据您所见,这些结果与我的结果非常相似. 有人能解决这个问题吗?

As far as you can see these results are very similar with my results. Does anybody have a solution of this problem?

推荐答案

在过去2周中,我分析了很多论文.我想我找到了问题的根源. OpenCV 3.4.0鱼眼不失真方法基于针孔相机模型.我们在相机的光轴和某些物体发出的光线之间有一个角度.我们在到该对象的未失真点的方向与相机光轴之间也存在一个角度.如果鱼眼图像未正确失真,则这两个角度将相等.我的鱼眼镜头的FOV是180度.这意味着距未失真图像中心和与未失真图像边缘相对应的点的距离等于无穷大. 换句话说,如果我们有一个鱼眼摄像机,其FOV约为180度,则鱼眼图像表面100%的失真(通过OpenCV)是不可能的.

I analyzed a lot of papers in the last 2 weeks. I think I found the source of the problem. OpenCV 3.4.0 fisheye undistortion method is based on a pin-hole camera model. We have an angle between the optical axis of the camera and the ray of light from some object. We also have an angle between the direction to an undistorted point of this object and the camera optical axis. If the fisheye image was undistorted correctly, these two angles would be equal. FOV of my fisheye camera is 180 degrees. It means that distance fromthe undistorted image center and the point corresponding to the edge of the undistorted image is equal to infinity. In other words if we have a fisheye camera with FOV around 180 degrees, undistortion (via OpenCV) of 100% of fisheye image surface is impossible.

这篇关于OpenCV不会扭曲鱼眼图像的中央部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆