Skip to content

Fix image position control in window_QT#20368

Merged
opencv-pushbot merged 1 commit intoopencv:3.4from
mightbxg:bugfix_imshowqt
Jul 8, 2021
Merged

Fix image position control in window_QT#20368
opencv-pushbot merged 1 commit intoopencv:3.4from
mightbxg:bugfix_imshowqt

Conversation

@mightbxg
Copy link
Copy Markdown
Contributor

@mightbxg mightbxg commented Jul 7, 2021

In Qt backend of imshow(), the image shown in the window can be zoomed and dragged with the mouse. And the function DefaultViewPort::controlImagePosition() aims to keep the image border out of the visible window area. However, this function doesn't work properly when the image is zoomed (the translation distance should be scaled by current zooming factor), which makes it hard to check the pixel value near image borders, see the gif below:

before

This PR resolves the problem:

after

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
force_builders=Custom
build_image:Custom=qt:16.04
buildworker:Custom=linux-1,linux-2,linux-4,linux-6

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 for contribution 👍

@opencv-pushbot opencv-pushbot merged commit 1ba6cd8 into opencv:3.4 Jul 8, 2021
@alalek alalek mentioned this pull request Jul 10, 2021
@alalek alalek mentioned this pull request Oct 15, 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.

3 participants