2021年1月25日星期一

cv2.destroyAllWindows() is not implemented when installing opencv-python-headless

in order to resolve: https://pastebin.com/raw/my6VXj3H error briefly stated below:

Got keys from plugin meta data ("xcb")  loaded library "/home/mona/venv/vision/lib/python3.8/site-packages/cv2/qt/plugins/platforms/libqxcb.so"  QObject::moveToThread: Current thread (0x34390e0) is not the object's thread (0x3527410).  Cannot move to target thread (0x34390e0)    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/mona/venv/vision/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found.  This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.    Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.  

I decided to remove opencv-python and install opencv-python-headless based on a suggestion in Qt Forum.

This solved the problem initially but now throws the following opencv error.

How can I solve this opencv error?

(vision) mona@goku:~/research/code/vision/integration$ pip install --upgrade pip  Requirement already satisfied: pip in /home/mona/venv/vision/lib/python3.8/site-packages (20.3.3)  Collecting pip    Downloading pip-21.0-py3-none-any.whl (1.5 MB)       |████████████████████████████████| 1.5 MB 3.6 MB/s   Installing collected packages: pip    Attempting uninstall: pip      Found existing installation: pip 20.3.3      Uninstalling pip-20.3.3:        Successfully uninstalled pip-20.3.3  Successfully installed pip-21.0  (vision) mona@goku:~/research/code/vision/integration$ pip install opencv-python-headless  Collecting opencv-python-headless    Using cached opencv_python_headless-4.5.1.48-cp38-cp38-manylinux2014_x86_64.whl (37.6 MB)  Requirement already satisfied: numpy>=1.17.3 in /home/mona/venv/vision/lib/python3.8/site-packages (from opencv-python-headless) (1.19.5)  Installing collected packages: opencv-python-headless  Successfully installed opencv-python-headless-4.5.1.48  

After running my code, here's the error:

    cv2.destroyAllWindows()  cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-jhawztrk/opencv/modules/highgui/src/window.cpp:645: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvDestroyAllWindows'  
https://stackoverflow.com/questions/65894955/cv2-destroyallwindows-is-not-implemented-when-installing-opencv-python-headles January 26, 2021 at 10:03AM

没有评论:

发表评论