Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About calibration code #58

Closed
qianyu220 opened this issue Nov 1, 2021 · 2 comments
Closed

About calibration code #58

qianyu220 opened this issue Nov 1, 2021 · 2 comments

Comments

@qianyu220
Copy link

Hi, I am trying your calibration code (projection.py) on fisheye images. I found the distortion coefficients k1-k4 are very different from the standard format in OpenCV (their number is smaller than 1, while yours is hundreds). Could your please share your calibration code and how to correspond your coeff with Opencv's?

@sleepywitti
Copy link
Contributor

sleepywitti commented Nov 17, 2021

Hello,
we do not use the OpenCV calibration model, but a 4th order polynomial described e.g. by Davide Scaramuzza. Both models can not be derived from each other and therefore have no equivalent representations.

The following text is an excerpt from the calibration description that can be found along with the calibrations.

The intrinsic calibration is given in a calibration model that describes the radial distortion using a 4th order polynomial
rho(theta) = k1 * theta + k2 * theta ** 2 + k3 * theta ** 3 + k4 * theta ** 4,
where theta is the angle of incidence with respect to the optical axis and rho is the distance between the image center and projected point. The coefficients k1, k2, k3 and k4 are given in the calibration files.
The image width and height as well as the offset (cx, cy) of the principal point are given in pixels.

For completeness, the projection of a 3D point (X, Y, Z) given in camera coordinates to image coordinates (u, v) looks like:

chi = sqrt( X ** 2 + Y ** 2)
theta = arctan2( chi, Z ) = pi / 2 - arctan2( Z, chi )
rho = rho(theta)
u’ = rho * X / chi if chi != 0 else 0
v’ = rho * Y / chi if chi != 0 else 0
u = u’ + cx + width / 2 - 0.5
v = v’ * aspect_ratio + cy + height / 2 - 0.5

The last two lines show the final conversion to image coordinates assuming that the origin of the image coordinate system is located in the upper left corner with the upper left pixel at (0, 0). The projection itself is implemented in projection.py which can be found at https://github.com/valeoai/WoodScape/tree/master/scripts/calibration.

@sandeepnmenon
Copy link

@sleepywitti
Thank you for the explanation. Can you provide the data/images used for your calibration so that people who wants to use the OpenCV model can calibrate accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants