Display image in fullscreen for the projector-camera system.
Python has some GUI tools, but only a few of them are suitable for fullscreen display. In this repository, Tkinter or OpenCV or PyQt5 can be used as the backend. The best backend depends on the environment (i.e., OS, monitor, version of the software), so choose the best one for you.
Note
Recently, I released a new fullscreen program using OpenGL/GLFW in Python. I confirmed it could run at 60 fps, which achieves much faster pro-cam synchronization. You can check it out at https://github.com/elerac/pyglimshow.
- Pillow (PIL)
- OpenCV
- screeninfo (from https://github.com/rr-/screeninfo)
- Pillow (PIL) or OpenCV
- PyQt5
import time
import cv2
from fullscreen import FullScreen
screen = FullScreen()
image = cv2.imread("image/himeji_castle.jpg", 1)
screen.imshow(image)
time.sleep(3)
height, width, ch = screen.shape
screen = FullScreen(backend="tkinter") # default
screen = FullScreen(backend="cv2")
screen = FullScreen(backend="PyQt5")
OS | Hardware | Python | Backend | |
---|---|---|---|---|
✅ | macOS Catalina | MacBook Pro (13-inch, 2017) | 3.8 | Tkinter 8.6.11 |
✅ | macOS Catalina | MacBook Pro (13-inch, 2017) | 3.8 | OpenCV-Python 4.4 |
❌ | macOS Catalina | MacBook Pro (13-inch, 2017) | 3.8 | OpenCV-Python 4.5 |
✅ | macOS Catalina | MacBook Pro (13-inch, 2017) | 3.8 | PyQt5 5.15 |
❌ | macOS BigSur | MacBook Pro (13-inch, 2017) | 3.7 | Tkinter 8.5.9 |
✅ | macOS BigSur | MacBook Pro (13-inch, 2017) | 3.9 | Tkinter 8.6.11 |
❌ | macOS BigSur | MacBook Pro (13-inch, 2017) | 3.9 | OpenCV-Python 4.4 |
❌ | macOS BigSur | MacBook Pro (13-inch, 2017) | 3.9 | OpenCV-Python 4.5 |
❌ | macOS BigSur | Mac Pro (2019) | 3.9 | Tkinter 8.5.9 |
✅ | macOS BigSur | Mac Pro (2019) | 3.9 | Tkinter 8.6.11 |
✅ | macOS BigSur | Mac Pro (2019) | 3.8 | OpenCV-Python 4.4 |
❌ | macOS BigSur | Mac Pro (2019) | 3.8 | OpenCV-Python 4.5 |
✅ | Windows 10 | ThinkPad (L580) | 3.9 | Tkinter 8.6.9 |
✅ | Windows 10 | ThinkPad (L580) | 3.9 | OpenCV-Python 4.4 |
✅ | Windows 10 | ThinkPad (L580) | 3.9 | OpenCV-Python 4.5 |
✅ | Ubuntu 20 (GNOME) | 3.8 | Tkinter 8.6.10 | |
✅ | Ubuntu 20 (GNOME) | 3.8 | OpenCV-Python 4.5 | |
🤔 | Ubuntu 20 (KDE) | 3.8 | Tkinter 8.8.10 | |
✅ | Ubuntu 20 (KDE) | 3.8 | OpenCV-Python 4.4 |
Although I have mainly tested on Mac, it should also work on Windows and Ubuntu as the software is cross-platform.
To summarize the above table, the following cases do not seem to work well ❌,
- Tkinter 8.5.9 does not work well on macOS. I think it is related to that the Apple-supplied Tcl/Tk 8.5 has serious bugs.
- OpenCV-Python 4.5 does not work well on macOS. I think it is related to that Qt support has been dropped.
In some cases, it works but may not be perfect 🤔,
- On Ubuntu, Tkinter could not display the first image, but the second and later images work well.