Skip to content

fix camera_calibration sample for fisheye#19690

Merged
alalek merged 2 commits intoopencv:3.4from
hedgepigdaniel:fix/calibration_fisheye
Mar 9, 2021
Merged

fix camera_calibration sample for fisheye#19690
alalek merged 2 commits intoopencv:3.4from
hedgepigdaniel:fix/calibration_fisheye

Conversation

@hedgepigdaniel
Copy link
Copy Markdown
Contributor

@hedgepigdaniel hedgepigdaniel commented Mar 8, 2021

The camera_calibration sample has a bug where when using fisheye and with a video as the source, the corrected image is almost entirely empty except for the 1-4 pixels closest to the origin. This is because fisheye::undistortImage uses an identity as the output camera matrix by default, and therefore maps all points very close to (0,0).

This fix is to use fisheye::estimateNewCameraMatrixForUndistortRectify to create the output camera matrix, in the same manner that it is used when images are used as the calibration source.

Also, there are two added guards around calibration flags for calibrateCameraRO that are not applicable to fisheye::calibrate.

relates #7040

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 other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to 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

@alalek
Copy link
Copy Markdown
Member

alalek commented Mar 9, 2021

Thank you for contribution!

As a "bugfix" this patch should go into 3.4 branch first.
We will merge changes from 3.4 into master regularly (weekly/bi-weekly).

Please:

  • change "base" branch of this PR: master => 3.4 (use "Edit" button near PR title)
  • rebase your commits from master onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/master
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".

@hedgepigdaniel hedgepigdaniel force-pushed the fix/calibration_fisheye branch from 482fcd7 to 778bb98 Compare March 9, 2021 11:26
@hedgepigdaniel hedgepigdaniel changed the base branch from master to 3.4 March 9, 2021 11:27
@hedgepigdaniel
Copy link
Copy Markdown
Contributor Author

sure, I've done so.

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Well done! Thank you 👍

@alalek alalek merged commit 65b51e1 into opencv:3.4 Mar 9, 2021
@alalek alalek mentioned this pull request Mar 13, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants