You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This error is related to OpenCV's highgui module which is responsible for creating windows. This error often occurs when OpenCV functions that require a GUI (like cv2.imshow(), cv2.moveWindow(), etc.) are called, but the environment where the code is running doesn't support GUI display (e.g., a headless server or during testing).
In the context of running tests with pytest and pre-commit hooks, we likely don't need the GUI features.
Solution
So, pip install opencv-python-headless install the headless version of OpenCV, which excludes GUI functionality and this prevents OpenCV from trying to use any GUI functions.
I think using headless python shouldn't be the default way but we should definitely check if the monitor or windows are available before imshow() and moveWindow() are called in the show() function
Describe the bug
While running pre-commit hooks and pytest for my application, I'm encountering an OpenCV error related to GUI functions.
To Reproduce
Steps to reproduce the behavior:
git add
andpre-commit run -a
(make sure pre-commit is installed).git commit -m "commit message"
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: