Arya Zhang
Arya Zhang

Reputation: 1

How to get 4 distortion elements with opencv camera calibration?

I use 5 elements distortion for my stereo camera and I find there is a little contort on the corner of the correction image(especially the left camera), while 4 elements distortion matrix is fine. 5 elements correction 4 elements correction Above tests are implemented on MATLAB, and I need to code on python with openCV.

The problem is that I consulted the openCV documentation, which mentioned the 4 elements distortion, but did not provide the corresponding flag. I doubt whether openCV can really generate a 4 elements distortion matrix?

Upvotes: -1

Views: 679

Answers (1)

fana
fana

Reputation: 1870

OpenCV's calibrateCamera() function has flags( CALIB_FIX_K1, ... , CALIB_FIX_K6) to omit specific radial distortion coefficients from optimization parameter.

This is described in OpenCV's reference manual as

CALIB_FIX_K1,...,CALIB_FIX_K6 The corresponding radial distortion coefficient is not changed during the optimization. If CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used. Otherwise, it is set to 0.

Therefore, you will be able to exclude unnecessary radial distortion term with the flag (and giving 0 as initial value).

Upvotes: 1

Related Questions