Skip to content

OpenCV shows white screen when using cv2.setWindowProperty(“Image”, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN) #769

@gnohgnij

Description

@gnohgnij

System Information

OpenCV version: 4.7.0.68
Operating System / Platform: macOS Ventura 13.1, Apple Macbook Air M1
Python version 3.9.15

Detailed description

When trying to set the window to fullscreen using cv2.setWindowProperty("Image", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN), the window shows a white screen instead of the webcam capture/image file that is being read. When the line of code is commented out, the window correctly shows webcam capture/image file.

Steps to reproduce

  1. Webcam
import cv2
cap = cv2.VideoCapture(0)

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

while cap.isOpened():
    success, image = cap.read()

    cv2.imshow("Image", image)

    if cv2.waitKey(1) & 0xFF == 27:
      break


cv2.destroyAllWindows()
cap.release()
  1. Reading image file
import cv2

img = cv2.imread('path/to/image')
cv2.namedWindow("Image", cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty("Image", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)

cv2.imshow("Image", img)
cv2.waitKey(0)

EDIT: I've downgraded opencv-python to 4.4.0.46 and now it works

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions