I’m trying to display jpegs full screen on a second monitor on a Raspberry Pi 5 using opencv in Python.
import cv2 from pathlib import Path from screeninfo import get_monitors, Monitor def display_jpeg_fullscreen(image_path: Path, monitor: Monitor): """ Display an image full screen. """ image = cv2.imread(str(image_path)) if image is None: raise Exception(f"Error: Could not load image from '{image_path}'") image = cv2.resize(image, (monitor.width, monitor.height)) # Create a fullscreen window window_name = monitor.name cv2.namedWindow(window_name, cv2.WINDOW_FULLSCREEN) cv2.moveWindow(window_name, monitor.x, 0) # move to appropriate monitor cv2.setWindowProperty(window_name, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN) # Show the image cv2.imshow(window_name, image) cv2.waitKey(2000) def main(): all_monitors = get_monitors() display_jpeg_fullscreen(Path("bird.jpg"), all_monitors[1]) if __name__ == "__main__": main() This ought to display the image on the second monitor and on MS Windows it does.x == 2560
However on a Raspberry Pi 5, which I think uses Wayland, it seemsis random whether the image gets displayedit appears on the first monitor (x==0)1 or the secondmonitor 2.
I’ve tried with moveWindow after imshow too.
Any idea what I am doing wrong?
I do get a warning that Qt platform plugin 'wayland' cannot be found in site-packages/cv2/qt/plugins. However if I set QT_QPA_PLATFORM=xcb the behaviour is the same.