QObject::moveToThread: Current thread (0x55c5f66c3570) is not the object’s thread (0x55c5f683ed40).
Cannot move to target thread (0x55c5f66c3570)
没有明确的解决办法,(网上有说降低opencv版本的,有说卸载Qt的,哈哈,降低版本后没有解决又不想卸载Qt)在尝试了降低系统中安装的opencv版本之后,不出现上面错误了,但是会出现下面的错误(!!注意:降不降这个版本应该都无所谓!!)
(python:26443): Gtk-CRITICAL **: 11:06:49.815: IA__gtk_widget_style_get: assertion ‘GTK_IS_WIDGET (widget)’ failed
网上的解决办法是(试过之后依旧不成功):
https://blog.csdn.net/Chandler_Bing_/article/details/107244426
https://blog.csdn.net/zhouhuaidong/article/details/107524239
在重装了好几个版本之后发现还是会出现一样的错误!
但是莫名其妙又可以显示图片了?(系统中安装的版本是3.4.15)
下面这个要安装!
pip3 install opencv-python==4.1.2.30 pip3 install opencv-contrib-python==4.1.2.30
sudo apt-get install build-essential sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
mkdir build cd build
sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -D OPENCV_GENERATE_PKGCONFIG=ON -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=/home/yangji/opencv/opencv-3.4.15/opencv_contrib-3.4.15/modules -D BUILD_EXAMPLES=ON ..
(修改路径!)
sudo make sudo make install
缺少.i文件的话就下载i文件,opencv_contrib/modules/xfeatures2d/src/目录下,然后重新编译。
.i文件下载
fatal error: features2d/test/test_detectors_regression.impl.hpp: No such file or directory
原因是没找到这个文件,将opencv / modules / features2d复制,然后粘贴到build目录中来解决该问题。(参考这篇)
/usr/local/lib/pkgconfig/opencv.pc
中看到opencv版本