Ask Your Question
0

Display a streamed video in full screen Opencv3

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

singrium gravatar image

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

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)
while(True):
    ret, frame = cap.read()
    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')):
        break
cap.release()
cv2.destroyAllWindows()

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?

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

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

As for Raspbian the output is:

GUI: 
    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

Comments

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

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

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

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

thanks for doing so !

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

1 answer

Sort by ยป oldest newest most voted
0

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

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

Stats

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

Seen: 14,712 times

Last updated: Aug 31 '18