10
votes

I'm using a wide-angle lens (178º Diagonal FOV ) and I'm trying to calibrate it properly using Opencv Calibration module. All the detection and calibration process are working fine, but the result is very poor.

I have tried many different configurations:

  • Different set of images
  • Different radial coefficient numbers: 2,3,4,5 even 6.(CV_CALIB_FIX_K1,...,CV_CALIB_FIX_K6 )
  • Fixing principal point and tangential disortion to 0 (CV_CALIB_FIX_ASPECT_RATIO, CV_CALIB_FIX_PRINCIPAL_POINT)
  • Using expected focal length as initial camera matrix. (CV_CALIB_USE_INTRINSIC_GUESS)

The best I can get is something like:Bad calibration

Any ideas about how could I get a good calibration? Do you think using two calibrattion patterns at the same time, or using a circles grid as calibration pattern would help?

I've seen in opencv 3.0 thin prism coeffs are added. I haven't tried it, but I don't think there will make a difference, right? Edit: Checked it... Nothing

6
Did you get images with the calibration target placed in the boundary (upper left, upper right, etc.) of the field of view?Alessandro Jacopson
Yes I did. I actually have a lot of images with the checkerboard all around... You can check one of the dataset I used here: [dl.dropboxusercontent.com/u/31166777/images.rar ]Josep Bosch

6 Answers

4
votes

fisheye lenses have different distortion modelling. For calibrating a fisheye camera, use opencv fisheye module. See opnecv docs.

3
votes

Are you making sure to use the CV_CALIB_RATIONAL_MODEL flag? That will tell OpenCV to use a model that supports wider angle lenses.

Here are my suggestions for a 150 deg lens. You might also consider trying April Cal which I have had decent luck with.

3
votes

Maybe the camera/lens model of OpenCV does not describe accurately enough your ultra wide angle lens. And so maybe you have to abandon the built-in OpenCV calibration procedure and write your own calibration procedure.

For example a google search gives me:

Kanatani, K., "Calibration of Ultrawide Fisheye Lens Cameras by Eigenvalue Minimization," Pattern Analysis and Machine Intelligence, IEEE Transactions on , vol.35, no.4, pp.813,822, April 2013

Abstract: We present a new technique for calibrating ultrawide fisheye lens cameras by imposing the constraint that collinear points be rectified to be collinear, parallel lines to be parallel, and orthogonal lines to be orthogonal. Exploiting the fact that line fitting reduces to an eigenvalue problem in 3D, we do a rigorous perturbation analysis to obtain a practical calibration procedure. Doing experiments, we point out that spurious solutions exist if collinearity and parallelism alone are imposed. Our technique has many desirable properties. For example, no metric information is required about the reference pattern or the camera position, and separate stripe patterns can be displayed on a video screen to generate a virtual grid, eliminating the grid point extraction processing.

1
votes

I don't have any experiences with fish-eye lenses, but if you are planing to map the image to a perspective projection, you will run into trouble. The large viewing angle parts of the image will map to very far distances on the image plane. This might acctually result in an image like the one you provided. There are definitely some errors, but it seems that most of the straight "world lines" map to straight "image lines".

What exactly did you expect as the result and what are you planing to use this calibration for?

1
votes

Since Opencv 2.4.10 and above there is a specfic distortion model for wide-angle/fisheye lenses able to handle this strong radial distortion. I've tested with my datasets and results are very good.

0
votes

OpenCV 2.4.10 and above have fisheye camera calibration module. But this module uses a method based on pin-hole camera model. In this model we have an angle between an optical axis of camera and ray of light from some object in front of camera. We also have an angle between optical axis and direction to point on undistorted image (corresponding to object). If calibration was performed correctly, these 2 angles will be equal. It means that if FOV of your camera is about 180 degrees, the distanse from center of undistorted image to edge of undistorted image will be equal to infinity. As a result OpenCV fisheye correction module (cv::fisheye) undistorts only a central part of image. In my own results I got 140-150 degrees FOV in undistorted image. More detailed explanation I placed HERE. If FOV about 140-150 degrees is suitable for you, you can use cv::fisheye without any modification