如何解决相机由于Android上的“-2:未指定错误”而无法启动
我正在测试一个在Android上使用OpenCV 4.4的应用程序,并且当该应用程序应该启动相机时,相机将无法启动,并且在日志中显示:
cv2.error: OpenCV(4.0.1) /home/mark/frontend_android/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/opencv/armeabi-v7a__ndk_target_21/opencv/modules/highgui/src/window.cpp:610: 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 'cvNamedWindow'
我安装了libgtk2.0-dev
,并且pkg-config
已经存在。
我正在使用pip包:
opencv-python 4.4
opencv-contrib-python 4.4
我正在使用的P4A食谱:
opencv
opencv_extras
在笔记本电脑上测试时不会出现此问题。在我的笔记本电脑上,网络摄像头可以正常工作。在Android上会发生此问题。
我在网上发现了这一点:
MacOS和Linux轮子目前有一些限制:
video related functionality is not supported (not compiled with FFmpeg) for example cv2.imshow() will not work (not compiled with GTK+ 2.x or Carbon support)
我没有使用imshow()
属性,但确实使用了VideoCapture(0)
。
非常感谢任何帮助。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。