OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Mon, 29 Apr 2019 08:13:23 -0500One suspicious issue of Fisheye calibration at opencv4.0.0 prehttp://answers.opencv.org/question/197833/one-suspicious-issue-of-fisheye-calibration-at-opencv400-pre/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.
https://stackoverflow.com/questions/31089265/what-are-the-main-references-to-the-fish-eye-camera-model-in-opencv3-0-0dev/34388476
Therefore, I searched the pre-version of opencv-4.0.0 and found this issue has been opened and resolved by
https://github.com/opencv/opencv/pull/6801
https://github.com/opencv/opencv/pull/6801/files
in the same time, you can find the corresponding document at
[link text](https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html)
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:
[document]
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
[document]
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)
x’=(theta_d/r)a
y’=(theta_d/r)b ………….(5)
Obviously, equation (1) and (4) are difference.
Is any one help to recheck it?
Is my understanding correct?
Thanks.Tue, 21 Aug 2018 05:48:54 -0500http://answers.opencv.org/question/197833/one-suspicious-issue-of-fisheye-calibration-at-opencv400-pre/Answer by CV_beginner for <p>Hi all,</p>
<p>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.</p>
<p><a href="https://stackoverflow.com/questions/31089265/what-are-the-main-references-to-the-fish-eye-camera-model-in-opencv3-0-0dev/34388476">https://stackoverflow.com/questions/3...</a></p>
<p>Therefore, I searched the pre-version of opencv-4.0.0 and found this issue has been opened and resolved by</p>
<p><a href="https://github.com/opencv/opencv/pull/6801">https://github.com/opencv/opencv/pull...</a></p>
<p><a href="https://github.com/opencv/opencv/pull/6801/files">https://github.com/opencv/opencv/pull...</a></p>
<p>in the same time, you can find the corresponding document at </p>
<p><a href="https://docs.opencv.org/master/db/d58/group__calib3d__fisheye.html">link text</a></p>
<p>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:</p>
<p>[document]</p>
<p>a=x/z and b=y/z ………….(1)</p>
<p>x’=(theta_d/r)a ………….(2)</p>
<p>y’=(theta_d/r)b ………….(3)</p>
<p>[code at modules/calib3d/src/fisheye.cpp]</p>
<p>Vec2d x(Y[0], Y[1]); ………….(4)</p>
<p>Vec2d xd1 = x * cdist; ………….(5)</p>
<p>“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:</p>
<p>(a) “cdist” at code and “theta_d/r” at document should be the same.</p>
<p>(b) “x” at code should be the same as “a, b” at document.</p>
<p>However, check point (b) cannot been satisfied. For the convenience of explanation, I unifying the naming of variables at these two equations as below</p>
<p>[document]</p>
<p>a=x/z and b=y/z ………….(1)</p>
<p>x’=(theta_d/r)a ………….(2)</p>
<p>y’=(theta_d/r)b ………….(3)</p>
<p>[code at modules/calib3d/src/fisheye.cpp]</p>
<p>a=x and b=y ………….(4)</p>
<p>x’=(theta_d/r)a </p>
<p>y’=(theta_d/r)b ………….(5)</p>
<p>Obviously, equation (1) and (4) are difference.
Is any one help to recheck it?
Is my understanding correct?</p>
<p>Thanks.</p>
http://answers.opencv.org/question/197833/one-suspicious-issue-of-fisheye-calibration-at-opencv400-pre/?answer=212278#post-id-212278Hi,I also have the same question and I have my opinion: the [code] is right !. See the link
[reference of fisheye model in OpenCV](https://stackoverflow.com/questions/31089265/what-are-the-main-references-to-the-fish-eye-camera-model-in-opencv3-0-0dev/34388476). You will see the *Camera Calibration Toolbox for Matlab* of *Jean-Yves Bouguet* in "project_points_fisheye.m" :
%Definitions:
%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.
Mon, 29 Apr 2019 08:13:23 -0500http://answers.opencv.org/question/197833/one-suspicious-issue-of-fisheye-calibration-at-opencv400-pre/?answer=212278#post-id-212278