Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resizing the window doesn't properly scale the image within. #25504

Open
4 tasks done
Semnodime opened this issue Apr 28, 2024 · 0 comments
Open
4 tasks done

Resizing the window doesn't properly scale the image within. #25504

Semnodime opened this issue Apr 28, 2024 · 0 comments

Comments

@Semnodime
Copy link

System Information

Steps to reproduce

property value
operating system Linux Mint 21.3 Cinnamon
architecture x86
opencv-python version 4.0.9.80

Detailed description

Resizing the window doesn't properly scale the image within.

Observe the variable padding on the right window border:
160
161
162
163
164
165
166
167
168
169
170

Steps to reproduce

import numpy as np
import cv2


def main():
    # Generate a random 32x160x3 image
    random_image = np.random.randint(low=0, high=256, size=(32, 160, 3), dtype=np.uint8)

    # Create a named window to display the image
    window_name = 'random image'
    cv2.namedWindow(window_name, cv2.WINDOW_NORMAL)
    cv2.imshow(window_name, random_image)

    # Resize it iteratively
    for width in range(random_image.shape[1]):
        cv2.setWindowTitle(window_name, str(width))
        cv2.resizeWindow(window_name, width, 100)
        cv2.waitKey(50)

    # Exit
    cv2.destroyAllWindows()


if __name__ == '__main__':
    main()

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants