Ask Your Question

One suspicious issue of Fisheye calibration at opencv4.0.0 pre

asked 2018-08-21 05:48:54 -0500

Hi all,

I am working on the camera calibration for a super-fisheye lenses (i.e., FOV above 180 degree). According to the reference below, I know the fisheye calibration algorithm implemented at currently opencv cannot handle the lens with FOV above 180 degree.

Therefore, I searched the pre-version of opencv-4.0.0 and found this issue has been opened and resolved by

in the same time, you can find the corresponding document at

link text

The formulas presented at document are reasonable and correct. Next, I compare this document with its corresponds source code. However, I found one piece of code and documents are contradictory:


a=x/z and b=y/z ………….(1)

x’=(theta_d/r)a ………….(2)

y’=(theta_d/r)b ………….(3)

[code at modules/calib3d/src/fisheye.cpp]

Vec2d x(Y[0], Y[1]); ………….(4)

Vec2d xd1 = x * cdist; ………….(5)

“xd1” at code and “x’, y’” at document are used to represent the location of one incoming light ray which mapping on the camera’s normalize image plane (i.e., f = 1). In which, if the document and code are identical, following two check points should be satisfied at the same time:

(a) “cdist” at code and “theta_d/r” at document should be the same.

(b) “x” at code should be the same as “a, b” at document.

However, check point (b) cannot been satisfied. For the convenience of explanation, I unifying the naming of variables at these two equations as below


a=x/z and b=y/z ………….(1)

x’=(theta_d/r)a ………….(2)

y’=(theta_d/r)b ………….(3)

[code at modules/calib3d/src/fisheye.cpp]

a=x and b=y ………….(4)


y’=(theta_d/r)b ………….(5)

Obviously, equation (1) and (4) are difference. Is any one help to recheck it? Is my understanding correct?


edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2019-04-29 08:13:23 -0500

Hi,I also have the same question and I have my opinion: the [code] is right !. See the link reference of fisheye model in OpenCV. You will see the Camera Calibration Toolbox for Matlab of Jean-Yves Bouguet in "project_points_fisheye.m" :

%Let P be a point in 3D of coordinates X in the world reference frame    (stored in the matrix X)
%The coordinate vector of P in the camera reference frame is: Xc = R*X + T
%where R is the rotation matrix corresponding to the rotation vector om: R = rodrigues(om);
%call x, y and z the 3 coordinates of Xc: x = Xc(1); y = Xc(2); z = Xc(3);
%The pinehole projection coordinates of P is [a;b] where a=x/z and b=y/z.
%call r^2 = a^2 + b^2,
%call theta = atan(r),
%Fisheye distortion -> theta_d = theta * (1 + k(1)*theta^2 + k(2)*theta^4 + k(3)*theta^6 + k(4)*theta^8)
%The distorted point coordinates are: xd = [xx;yy] where:
%xx = (theta_d / r) * x
%yy = (theta_d / r) * y
%Finally, convertion into pixel coordinates: The final pixel coordinates    vector xp=[xxp;yyp] where:
%xxp = f(1)*(xx + alpha*yy) + c(1)
%yyp = f(2)*yy + c(2)

The answer is from L.Robin, thanks him.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-08-21 05:48:54 -0500

Seen: 187 times

Last updated: Aug 21 '18