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

前端 未结 15 2140
栀梦
栀梦 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:00

    The answer of @Mateen works great if you have Ubuntu version 17 and above. For Ubuntu 16, it's better to compile from sources your opencv python. As @Varun mentioned, follow the opencv tutorial. However, to successfully compile opencv with python 3 I have to add some flags in cmake command:

    cmake -DCMAKE_BUILD_TYPE=RELEASE -DPYTHON_DEFAULT_EXECUTABLE=$(which python3) -DPYTHON_INCLUDE_DIR2=/usr/include/x86_64-linux-gnu/python3.5m/ -DPYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.5/dist-packages/numpy/core/include/ ..

    Hope that will be helpful.

提交回复
热议问题