Python Forum

Full Version: Python OpenCV window not opening in fullscreen mode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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()