opencv
opencv copied to clipboard
Resizing the window doesn't properly scale the image within.
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:
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
- [X] I report the issue, it's not a question
- [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [X] I updated to the latest OpenCV version and the issue is still there
- [X] There is reproducer code and related data files (videos, images, onnx, etc)