python下载过程中最后一步执行opencv出错怎么回事_如何修复python中opencv中的错误“QObject::moveToThread:”?...

在使用Python的OpenCV库时,遇到一个错误,该错误发生在调用`cv2.waitKey(0)`时。错误信息涉及到对象线程不匹配。尝试更新到OpenCV的旧版本后,又出现了一个新的错误,提示未实现的功能,需要重新编译库以支持Windows、GTK+2.x或Carbons。解决方案可能包括检查和更新依赖库,如libgtk2.0-dev和pkg-config,并重新配置或构建OpenCV库。
摘要由CSDN通过智能技术生成

我在python中使用opencv2和代码import cv2

cv2.namedWindow("output", cv2.WINDOW_NORMAL)

cv2.imshow("output",im)

cv2.resizeWindow('output', 400,400)

cv2.waitKey(0)

cv2.destroyAllWindows()

我的错误是QObject::moveToThread: Current thread (0x1d2c9cf0) is not the object's thread (0x1d347b20).

Cannot move to target thread (0x1d2c9cf0)

我调试发现它发生在我使用cv2.waitKey(0)时。我该怎么修?谢谢

更新:我正在使用3.3.0.0。如果我使用旧版本,我有错误

OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvDestroyAllWindows, file /io/opencv/modules/highgui/src/window.cpp, line 577

Traceback (most recent call last):

File "tools/demo_handbone.py", line 220, in

demo(net, im_name)

File "tools/demo_handbone.py", line 159, in demo

cv2.destroyAllWindows()

cv2.error: /io/opencv/modules/highgui/src/window.cpp:577: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值