0

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. However on a Raspberry Pi 5, which I think uses Wayland, it is random whether it appears on monitor 1 or monitor 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.

New contributor
user190002 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Nov 21 at 7:27

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.