Ask Your Question
0

camera_calibration.cpp fisheye calibration aborted

asked 2016-02-17 12:30:06 -0600

Lucas Walter gravatar image

I'm trying out fisheye calibration with samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp. I've adapted the example VID5.xml file, then calibrated without fisheye, and get a 1.36 pixel reprojection error. Next I added <Calibrate_UseFisheyeModel>1</Calibrate_UseFisheyeModel>, and get an exception:

Re-projection error reported by calibrateCamera: 282.075
Calibration succeeded. avg re projection error = 282.075
OpenCV Error: Assertion failed (rvecs[i].rows == 3 && rvecs[i].cols == 1) in saveCameraParams, file /home/lwalter/other2/opencv_latest/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp, line 611
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/lwalter/other2/opencv_latest/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp:611: error: (-215) rvecs[i].rows == 3 && rvecs[i].cols == 1 in function saveCameraParams

Aborted (core dumped)

This is using the latest source, I could try going back to a release though I'll have to track down when the useFisheye logic was added to camera_calibration.cpp. I'll run this through a debugger as well.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-02-17 16:42:39 -0600

Lucas Walter gravatar image

Setting <Write_extrinsicParameters> to 0 avoids the problem and allow the calibration to finish.

I also discovered I needed to bootstrap the calibration using the intrinsic guess in order to get that reprojection error down to something reasonable.

edit flag offensive delete link more

Comments

I just hit this error as well - thank you for the magic xml fix.

Would you be willing to also explain how "to bootstrap the calibration using the intrinsic guess"?

AngelGabriel gravatar imageAngelGabriel ( 2016-02-27 20:16:08 -0600 )edit

Lucas refers to pre-computing the extrinsics (r_vecs, t_vecs) of detected checkerboard image points, and provide them as parameter to cv::fisheye::calibrate() together with an estimate of you camera matrix.

  • detect Image points
  • compute checkerboard extrinsics, (checkerboard poses relative to camera)

    • use cv::solvePnP(.) for this
    • see samples/cpp/select3dobj.cpp

    • call cv::fisheye::calibrate() with CALIB_USE_INTRINSIC_GUESS present int flags.

lnz-ptng gravatar imagelnz-ptng ( 2016-07-27 10:56:16 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-02-17 12:28:57 -0600

Seen: 1,243 times

Last updated: Feb 17 '16