Ask Your Question

Is there a solvePnP function for the fisheye Camera model?

asked 2015-07-29 14:06:25 -0500

TAXfromDK gravatar image

I did an exercise recently where I used solvePnp to estimate the position of a camera. That used the normal camera model.

Does there exist a solvePnP() function for the fisheye model as well?

Kind regards


edit retag flag offensive close merge delete


Hi, you manage to get it working? I had the some problem .

Soarez gravatar imageSoarez ( 2018-04-26 14:05:19 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2018-05-09 06:19:59 -0500

Soarez gravatar image

Hi i got it to work for me, u can try the same =). Since ther is no function to compute pose on fisheye lens, and the solvePnP performes the lens correction internaly, what i did was this:

im working with a chessboard , and findchessboard function.

bool patternfound = findChessboardCorners(gray, patternsize, corners_distorted,
                                                              //CALIB_CB_ADAPTIVE_THRESH +
                                                              //CALIB_CB_NORMALIZE_IMAGE +
fisheye::undistortPoints ( corners_distorted, corners, cameraMatrix, distCoeffs , cameraMatrix);

after i have the corrected chessboard corners, i create a fake_distorcion vector, and use solvepnp with that distorcion vector.

 Mat fake_distCoeffs = (Mat_<double>(4,1) << 0, 0, 0, 0);
 solvePnP(points, corners, cameraMatrix, fake_distCoeffs, rvec, tvec,false,CV_EPNP);

And this got it working. my camera lens is 110º FOV, and i also got it to work with the normal model, but in both solvepnp as lot of error , i will try to improve the intrinsic parameters and other methods on solvpnp.

here is a screenshot of the chessboard corners on the camera frame. image description


edit flag offensive delete link more


@Soarez I tried the method but rvec and tvec appear to vary with different snapshots of the board (board and camera position are fixed in all these samples). do you have any idea why this is happening?

sverma gravatar imagesverma ( 2019-02-07 03:16:33 -0500 )edit

I can confirm this answer is correct and is caused by solvePnP using cv::undistortPoints rather than cv::fisheye::undistortPoints.

V gravatar imageV ( 2019-08-14 01:16:14 -0500 )edit

This answer is slightly wrong. You need to provide np.eye(3) as cameraMatrix argument to solvePnP.

off99555 gravatar imageoff99555 ( 2019-11-26 21:16:22 -0500 )edit

Question Tools

1 follower


Asked: 2015-07-29 14:06:25 -0500

Seen: 1,282 times

Last updated: May 09 '18