2

For a project i need to display an image fullscreen on mac os. But i just get a grey fullscreen and everything freezes (reboot required). I am not sure if this problem is related to opencv-python on MacOS or if i'm missing something on how to display fullscreen images on MacOS. If there are other ways to display the image with another dependency im open to that.

My code:

import cv2

im = cv2.imread("image.png")
cv2.namedWindow("test", cv2.WINDOW_NORMAL)
cv2.setWindowProperty("test", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
cv2.imshow("test", im)
cv2.waitKey()
cv2.destroyWindow("test")

I tried different versions of opencv-python and different code. The cv2.imshow()function seems to work fine when displaying an windowed image, but as soon as i try to display it fullscreen everything freezes.

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
  • 1
    Can you share the image and your computer specs / environment? – Louis Lac Feb 26 '23 at 13:20
  • I just tried your code on my MacBook Pro M1 Pro (Ventura 13.2.1). I got a white fullscreen but no freeze on my side. I installed `opencv-python` in a conda env using pip. Can you try the solution from [this](https://stackoverflow.com/a/41544621/6324055) answer (fill your screen resolution) ? – Louis Lac Feb 26 '23 at 13:29
  • Okay! I will try it. But would there be a way to fetch the screen res, so the code could run on any mac? – 00000cs000000 Feb 26 '23 at 13:31
  • Maybe the `screeninfo` package, give it a try. Or `tkinter` which is usually included with Python. – Louis Lac Feb 26 '23 at 13:35
  • I tried your solution but it still does not work. The whole screen turns grey and i am not able to close the window. All i can do is to restart my mac – 00000cs000000 Feb 26 '23 at 13:39
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/252141/discussion-between-louis-lac-and-00000cs000000). – Louis Lac Feb 26 '23 at 13:41

0 Answers0