4

I am using namedWindow() function in my code to resize the image's window. The mouse cursor showing i can resize the windows, but it actually can't. Here is my code

import numpy as np
import cv2

img=cv2.imread('/home/jeff/Downloads/iphone.png', 1)
cv2.namedWindow('image',cv2.WINDOW_NORMAL)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Please assist. Thanks.

1
  • Question solved. After restarting the machine, image is resizeable. Oct 2, 2017 at 8:00

2 Answers 2

1

Replace code line cv2.namedWindow('image',cv2.WINDOW_NORMAL) with following:

cv2.namedWindow('image',cv2.WINDOW_AUTOSIZE)
1
  • How would this solve the issue? With WINDOW_AUTOSIZE "the user cannot resize the window, the size is constrainted by the image displayed." (see documentation).
    – luator
    Aug 13, 2020 at 9:14
0

There is a bug (at least in v3.2.0) that the resizing does not work if the image is bigger than the screen resolution. See the issue on GitHub.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.