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

Uncertainties calculation for fisheye calibration can be incorrect #23057

Closed
3 of 4 tasks
savuor opened this issue Dec 28, 2022 · 1 comment
Closed
3 of 4 tasks

Uncertainties calculation for fisheye calibration can be incorrect #23057

savuor opened this issue Dec 28, 2022 · 1 comment

Comments

@savuor
Copy link
Contributor

savuor commented Dec 28, 2022

System Information

OpenCV version: 3.4+
OS / Platform / Compiler: all

Detailed description

Related to #19803

Similar bug in omnidir calibration: #3406@contrib

According to the [MVG], various least squares method explanations (like this) and the standard camera calibration code in OpenCV (here), the parameters uncertainty should be calculated with the "minus k" denominator correction:
$$\sigma^2 = \frac{1}{n - k} \sum^n_{i=1} \left( x_i - \bar{x} \right)^2$$
where n is a number of errors and k is a number of non-fixed model parameters.

The bug appears here.

MVG: R. Hartley, A. Zisserman, Multiple View Geometry in Computer Vision, 2004, section 5.1.3, page 134

Steps to reproduce

This is the low priority issue since the calculated value is not used in latter calculation.
However, we may extend the function's interface in the future by adding stddevs for estimated parameters, the same way we did for standard pinhole calibration. When doing this, we should be aware of this bug at least.

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)
@savuor savuor self-assigned this Dec 28, 2022
asmorkalov pushed a commit that referenced this issue Jan 27, 2023
Fixes #23057

Parameter uncertainty fixed + ground truth test data fixed

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
@savuor
Copy link
Contributor Author

savuor commented Jan 30, 2023

Fixed

@savuor savuor closed this as completed Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants