Skip to content

Fixing the formula in the documentation of reprojectImageTo3D#25083

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
mamut-m:fix_docs_for_reprojectImageTo3D
Feb 24, 2024
Merged

Fixing the formula in the documentation of reprojectImageTo3D#25083
asmorkalov merged 1 commit intoopencv:4.xfrom
mamut-m:fix_docs_for_reprojectImageTo3D

Conversation

@mamut-m
Copy link
Copy Markdown

@mamut-m mamut-m commented Feb 23, 2024

Fixing the formula in the documentation of reprojectImageTo3D

fixes #25082

The documentation states correctly:

Reprojects a disparity image to 3D space.

and

The function transforms a single-channel disparity map to a 3-channel image representing a 3D surface. That is, for each pixel (x,y) and the corresponding disparity d=disparity(x,y) , it computes:

But then there is an error in the formula:
image

This does not make sense since the function wants to calculate $Z$, it makes no sense to have $z$ on the right side of the equation. It does not have any meaning in a disparity image. The value should be one at that coordinate, to reflect that this is a normalized homogenous coordinate in 3 dimensions.

I fixed it to
image

which corresponds to the implementation which is (click permalink to get to file):

Vec4d homg_pt = _Q*Vec4d(x, y, d, 1.0);

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

Do not apply since this is only a documentation fix:

  • 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

@asmorkalov asmorkalov added the category: documentation Documentation fix or update label Feb 24, 2024
@asmorkalov asmorkalov added this to the 4.10.0 milestone Feb 24, 2024
@asmorkalov
Copy link
Copy Markdown
Contributor

@catree Could you take a look?

@asmorkalov asmorkalov self-requested a review February 24, 2024 10:00
Copy link
Copy Markdown
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

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

👍

@catree
Copy link
Copy Markdown
Contributor

catree commented Feb 24, 2024

@mamut-m Thanks for the correction.


Mistake is also present in the 3.4 documentation BTW.

@asmorkalov asmorkalov merged commit ae347ab into opencv:4.x Feb 24, 2024
@asmorkalov asmorkalov mentioned this pull request Feb 26, 2024
catree added a commit to catree/opencv that referenced this pull request Feb 26, 2024
asmorkalov added a commit that referenced this pull request Feb 27, 2024
Fix mistake into the reprojectImageTo3D doc. Backport from #25083 PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: documentation Documentation fix or update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

formula in the documentation of reprojectImageTo3D is wrong

3 participants