OpenCV undistorts only a central part of fisheye image

一世执手 提交于 2019-11-26 23:38:20

问题


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

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

and

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?


回答1:


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.




回答2:


It can be achieved, only that using a projection instead of trying to undistort it.

More info here OpenCV fisheye calibration cuts too much of the resulting image

Example result:



来源:https://stackoverflow.com/questions/48990136/opencv-undistorts-only-a-central-part-of-fisheye-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!