Skip to content

Correct image borders and principal point computation in cv::stereoRectify#6836

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
vicproon:rectify_correct_principal_point
Jul 18, 2016
Merged

Correct image borders and principal point computation in cv::stereoRectify#6836
opencv-pushbot merged 1 commit intoopencv:masterfrom
vicproon:rectify_correct_principal_point

Conversation

@vpisarev
Copy link
Copy Markdown
Contributor

@vpisarev vpisarev commented Jul 8, 2016

Former #6337 by @vicproon:

resolves #6336

What does this PR change?

Image corners for undistortion now uses real image corners independently if source image scale.
It fixes the issue and runs well on the test code sample attached to it.

rsz_result
correct resize -> remap(rectify)
src_result
remap(rectify) -> resize

@snosov1 snosov1 self-assigned this Jul 12, 2016
@snosov1
Copy link
Copy Markdown
Contributor

snosov1 commented Jul 12, 2016

I think the change is legit. However, it brings a slightly bigger issue. We also have a few other places, where the principal point is treated the similar way. Namely, getOptimalNewCameraMatrix and stereoRectifyUncalibrated (maybe, somewhere else, as well). So, these functions should, probably, be modified accordingly.

Also, we'll need to add a couple of tests (the provided sample can simply be refactored into a test).

@vicproon, do you care to take a look at this?

@vpisarev
Copy link
Copy Markdown
Contributor Author

@vicproon, @snosov1, wow, frankly speaking, I did not expect such a dramatical change because of extra "-1" added or removed. It still looks like a magic to me. Still, I'm fine to move from nx-1, ny-1 to nx and ny. 👍

@vpisarev vpisarev self-assigned this Jul 18, 2016
@opencv-pushbot opencv-pushbot merged commit 93ff1fb into opencv:master Jul 18, 2016
@vicproon
Copy link
Copy Markdown

@snosov1 I am not sure i can make in immediately, but i sure can take a look at this a bit later. How about creating an issue for these updates?

@vpisarev this happens because when you calculate camera matrix for 4 times smaller picture, this extra "-1" becomes "-4".

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

Successfully merging this pull request may close these issues.

Incorrect image borders taken in cv::stereoRectify (calibration.cpp)

4 participants