Skip to content

Stereo Calibration: Return rotation and transformation vectors for each calibration object#22519

Merged
asmorkalov merged 4 commits intoopencv:4.xfrom
stefan-spiss:stereo_calib_per_obj_extr_ret
Sep 19, 2022
Merged

Stereo Calibration: Return rotation and transformation vectors for each calibration object#22519
asmorkalov merged 4 commits intoopencv:4.xfrom
stefan-spiss:stereo_calib_per_obj_extr_ret

Conversation

@stefan-spiss
Copy link
Copy Markdown
Contributor

Motivation for feature

Extension of stereoCalibrate function for both, pinhole and fisheye model, to return the translation and rotation vectors between each calibration object and the coordinate system of the first camera of the stereo pair. This feature is helpful to evaluate the individual image pairs used for calibration. This feature is in particular interesting for the fisheye model since its stereoCalibrate function has not provided a parameter to obtain the reprojection errors per stereo image pair. With these per-view transformations available, it is now possible to calculate these reprojection errors. In addition, for the pinhole model, it is also interesting to not only get the per-view rms errors, but also statistics within one view.
For the implementation, the single camera calibration methods were used as example and all previous available function calls should still work.

Pull Request Readiness Checklist

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

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

…w rotation and translation vectors between the calibration object coordinate space and the coordinate space of the first camera of the stereo pair. Added overloaded versions of the function for downward compatibility.
…w rotation and translation vectors between the calibration object coordinate space and the coordinate space of the first camera of the stereo pair. Added overloaded versions of the function for downward compatibility.
@asmorkalov
Copy link
Copy Markdown
Contributor

/cc @ivashmak

Copy link
Copy Markdown
Contributor

@savuor savuor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes should also be ported to 5.x (taking into account all the recent refactoring)

@asmorkalov asmorkalov added the port to 5.x is needed Label for maintainers. Authors of PR can ignore this label Sep 16, 2022
@asmorkalov
Copy link
Copy Markdown
Contributor

/cc @vpisarev

@asmorkalov asmorkalov merged commit fcf9f11 into opencv:4.x Sep 19, 2022
@alalek
Copy link
Copy Markdown
Member

alalek commented Jan 8, 2023

@savuor @asmorkalov There is still no port of this patch to "5.x" branch.
Automatic merge is not possible due to manual memory management here - logic must be significantly refactored first.

rvecs.create(3, 1, CV_64F, i, true);
tvecs.create(3, 1, CV_64F, i, true);
memcpy(rvecs.getMat(i).ptr(), rvecs1[i].val, sizeof(Vec3d));
memcpy(tvecs.getMat(i).ptr(), tvecs1[i].val, sizeof(Vec3d));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rvecs.getMat(i).ptr()

There is no guarantee (and no checks) of contiguous memory layout.

@alalek alalek mentioned this pull request Jan 8, 2023
@asmorkalov
Copy link
Copy Markdown
Contributor

@savuor Please port the patch to 5.x manually.

savuor added a commit to savuor/opencv that referenced this pull request Jan 19, 2023
asmorkalov pushed a commit that referenced this pull request Feb 2, 2023
### Changes

* Port of #22519 to 5.x
* Distortion coefficients were not copied properly, fixed
* Minor coding style chages

### 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: calib3d feature port to 5.x is needed Label for maintainers. Authors of PR can ignore this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants