Ask Your Question

Display a streamed video in full screen Opencv3

asked 2018-08-31 09:49:28 -0500

singrium gravatar image

updated 2018-08-31 11:20:19 -0500

I am new to Opencv. The current version I am using is Opencv 3.3 with Python 3.5.
Lately, I wanted to try streaming video in full screen, but I got a full white screen and the streamed video takes just a part of this full white screen.
This is the code I used:

import cv2

cap = cv2.VideoCapture(0)
    ret, frame =
    cv2.namedWindow('frame', cv2.WINDOW_NORMAL)
    cv2.setWindowProperty('frame', cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
    cv2.imshow('frame', frame)
    if(cv2.waitKey(1) & 0xFF == ord('e')):

This is a screenshot about what I got after running the program:

image description

Anyone please has an idea about how to display the video on full screen?

I used this code with two different OS: Ubuntu and Raspbian. OS: Ubuntu and Raspbain For Ubuntu: the output of cv2.getBuildInformation() is:

    QT:                          YES (ver 4.8.7 EDITION = OpenSource)  
    QT OpenGL support:         NO  
    GTK+:                        NO  
    VTK support:                 NO

As for Raspbian the output is:

    QT:                              NO
    GTK+ 3.x:                    YES (ver 3.22.11)
    GThread :                    YES (ver 2.50.3)
    GtkGlExt:                     NO
    OpenGL support:          NO
    VTK support:                NO
edit retag flag offensive close merge delete


os ? which gui is used ? (cv2.getBuildInformation())

berak gravatar imageberak ( 2018-08-31 09:53:13 -0500 )edit

@berak: I edit the post and added the needed info

singrium gravatar imagesingrium ( 2018-08-31 11:21:02 -0500 )edit

thanks for doing so !

berak gravatar imageberak ( 2018-08-31 12:00:53 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-01-11 07:47:47 -0500

please use cv2.namedWindow('Video', cv2.WINDOW_FREERATIO) instead of cv2.namedWindow('frame', cv2.WINDOW_NORMAL)

see the documentation of the flags cv2.WINDOW_... to know more

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-08-31 09:49:28 -0500

Seen: 12,471 times

Last updated: Aug 31 '18