Ask Your Question

# Revision history [back]

### cv2.fisheye camera calibration (Python)

I am trying to calibrate wide-angle/fisheye lenses in OpenCV using python and the cv2.fisheye functions (mainly cv2.fisheye.calibrate() and cv2.fisheye.undistortImage()). When I use the standard calibration functions I end up with these numbers:

RMS: 2.6183751071366848
camera matrix:
[[ 646.42135818    0.          619.10029186]
[   0.          648.42435786  308.14485791]
[   0.            0.            1.        ]]
distortion coefficients:  [ -4.34203961e-01   1.83425079e-01   1.30179493e-03  -2.10155339e-04
-3.27067908e-02]


Which results in images that look like this:

I want to use the cv2.fisheye functions to see if it improves the results, unfortunately there seems to be little information/examples for python available. The furthest I've got so far is following the posts here.

Using the posts above and this code I got the following matrix with bizarre numbers.

RMS: 1.1237757080785875e+21
camera matrix:
[[ -5.52957680e-12   1.57656102e+10   1.01242613e+07]
[  0.00000000e+00  -5.17843048e+06   1.12377571e+21]
[  0.00000000e+00   0.00000000e+00   1.00000000e+00]]
distortion coefficients:  [-0.01538611  0.0218525  -0.01853887  0.00503539]


Furthermore, when attempting to write undistorted images using the matrix above all it produces is completely gray .jpg files.

Any help or links to relevant examples/tutorials would be greatly appreciated.