How to Use OpenCV Wait Key With Chaquopy

青春壹個敷衍的年華 提交于 2019-12-24 04:07:09

问题


I am attempting to use Chaquopy to port a computer vision application to android. When I try to run my script the following error occurs on the following line:

cv2.waitKey(100)

The error which prints to the embedded python console is:

java.chaquopy.CQPEnv.check_exception
com.chaquo.python.PyException: error: OpenCV(3.4.2) /home/smith/git/chaquo/python/server/pypi/packages/opencv-python/build/3.4.2.16/cp36-cp36m-android_15_armeabi_v7a/src/opencv/modules/highgui/src/window.cpp:698: error: (-2: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 function 'cvWaitKey'

I have installed openCV in the build gradle as follows:

        pip {
            install "opencv-python"
        }

Which is according to the Chaquopy documentation found here: Chaquopy openCV discussion


回答1:


It looks like OpenCV only has support for key events on desktop platforms, not mobile ones. The same is probably true of all the other "High-level GUI" functions.

Anyway, unless your Android device actually has a keyboard, waiting for a keypress doesn't really make sense. You might be better off creating a simple Android UI like in the Chaquopy demo app, and interacting with the user that way.



来源:https://stackoverflow.com/questions/56224122/how-to-use-opencv-wait-key-with-chaquopy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!