How to have the imshow window in black color

I want to display an image in full screen using code similar to:

https://answers.opencv.org/question/198479/display-a-streamed-video-in-full-screen-opencv3/

import cv2

cap = cv2.VideoCapture(0)
while(True):
    ret, frame = cap.read()
    cv2.namedWindow('frame', cv2.WINDOW_FREERATIO)
    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()

How to set the unused part of the window to black color?

I can create arrays and stack/concatenate them but that seems like an over kill

do that. (and stop worrying)

1 Like