fisheye image to equirectangular

asked 2015-12-15 19:17:14 -0500

arpu gravatar image


for stitching images i want transform a fisheye image to a equirectangular image like nona (hugin) in hugin i can do this

my fisheye has 80 degree HFov

pto_gen --fov=80 -p 2 test22_r.jpeg hugin pro file

nona -o test22_r_equirectangular.jpg test22_r.pto

is this possible with opencv ? i look at detail::SphericalWarper but no idea how i can set the destination matrix for equirectangular

here is the input and output

edit retag flag offensive close merge delete


Forget the SphericalWarper. There are OpenCV functions for this in the Calib3D module.

Check this!


kbarni gravatar imagekbarni ( 2015-12-16 10:18:00 -0500 )edit

Hello i think this does not help me because the output image is not an undisort image

arpu gravatar imagearpu ( 2015-12-16 10:44:08 -0500 )edit

Yes, it is an undisorted image. Did you try it???

Check this description:

And an image

kbarni gravatar imagekbarni ( 2015-12-16 11:46:44 -0500 )edit


calib3d camera calibration i get this undisort image after calibration input out

arpu gravatar imagearpu ( 2015-12-17 06:50:07 -0500 )edit

You are probably using wrong parameters. To correct barrel distortion, k1,k2, k3 should be positive.

kbarni gravatar imagekbarni ( 2015-12-17 08:42:21 -0500 )edit

i think it have nothing to do because the output image should be equirectangular not?

arpu gravatar imagearpu ( 2015-12-17 09:01:34 -0500 )edit this is the calibration file from calib3d

arpu gravatar imagearpu ( 2015-12-17 09:02:38 -0500 )edit

here is the code i use to test

arpu gravatar imagearpu ( 2015-12-17 11:21:39 -0500 )edit

I have some problem with the code, it always crashes my computer and I have no idea why (total blackout) so sorry, but I can't test it.

Anyway, I still think the problem is with the distortion coefficients. Please note, that the calibrateCamera gives distCoeffs={k1,k2,p1,p2,k3}, but the fisheye::undistort functions need the coefficients D={k1,k2,k3,k4}, which are not the same!!!

kbarni gravatar imagekbarni ( 2015-12-18 05:11:07 -0500 )edit

any idea how i can calculate the coefficients D for the fisheye::undistort?

arpu gravatar imagearpu ( 2015-12-18 05:21:00 -0500 )edit