How to fix the error “QObject::moveToThread:” in opencv in python?

前端 未结 15 2128
栀梦
栀梦 2020-12-10 11:18

I am using opencv2 in python with the code

import cv2
cv2.namedWindow(\"output\", cv2.WINDOW_NORMAL)       
cv2.imshow(\"output\",im)
cv2.resizeWindow(\'outp         


        
15条回答
  •  时光取名叫无心
    2020-12-10 12:07

    I tried the above mentioned method and could get opencv module working for my project which uses python3.x interpreter.

    After performing few experiments, i got it working by doing the below steps:

    1) Install opencv-python in your machine using:

    sudo pip3 install opencv-python
    

    2) On the python3.x terminal find the version:

    >>> import cv2
    >>> cv2.__version__
    '3.4.1'
    

    3) Get the same version of OpenCV from their official page.

    4) Perform the CMake settings as mentioned in opencv tutorial. Note the location specified in PYTHON3_PACKAGES_PATH

    5) Once build has been performed, got to the install location specified in PYTHON3_PACKAGES_PATH. Move the library named cv2.cpython-*-gnu.so to the current python3.x dist-packages path:

    usr/local/lib/python3.5/dist-packages/cv2
    

    6) Reload your python3 project and try again!

提交回复
热议问题