Python Forum
Python OpenCV window not opening in fullscreen mode - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python OpenCV window not opening in fullscreen mode (/thread-33492.html)



Python OpenCV window not opening in fullscreen mode - Zman350x - Apr-29-2021

I have some basic code to receive a camera stream as a numpy array and display it as a fullscreen window. I'm able to receive and display the camera, but 75% of the time the fullscreening doesn't work and instead of scaling it nicely and centering it on the screen, it displays smaller in the corner. Any clue why?
from numpysocket import NumpySocket
import cv2

host_ip = '169.254.53.20'  # change me

npSocket = NumpySocket()
npSocket.startClient(host_ip, 9999)

cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty("window",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)

# Read until video is completed
def watch():
    # Capture frame-by-frame
    frame = npSocket.recieve()
    cv2.imshow("window", frame)
    if cv2.waitKey(25) & 0xFF == ord('q'):
        quit()
    
if __name__=="__main__":
    while True:
        watch()