Wide angle lenses calibration with Opencv

10,817

Solution 1

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

Solution 2

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.

Solution 3

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.

Solution 4

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?

Solution 5

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.

Share:
10,817
Josep Bosch
Author by

Josep Bosch

PhD Student

Updated on July 19, 2022

Comments

  • Josep Bosch
    Josep Bosch over 1 year

    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

  • Josep Bosch
    Josep Bosch about 6 years
    I have used the fisheye model to calibrate cameras of 190 degrees with good results. The thing, is that when you have such wide fov you can not remap the image to a pinhole camera, you need to project the points using another model. For example, look at the equirectangular or stereographic projections.
  • VideoProcessingResearcher
    VideoProcessingResearcher almost 6 years
    Thank you for reply! As I know strereographic projection is a method to project a sphere to plane. But my input data are flat images from fisheye camera. However I'm happy to meet a person who got good results with 180+ FOV camera. My real task is to realize a virtual pan-tilt-zoom (PTZ) camera via data from physical fisheye camera. Please look my other question, which I placed HERE
  • Josep Bosch
    Josep Bosch almost 5 years
    The opencv model for fisheye lenses is based on this work. A Generic Camera Model and Calibration Method for Conventional, Wide-Angle, and Fish-Eye Lenses by Juho Kannala and Sami S. Brandt