如何在Chaquopy中使用OpenCV等待键 [英] How to Use OpenCV Wait Key With Chaquopy

查看:445
本文介绍了如何在Chaquopy中使用OpenCV等待键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Chaquopy将计算机视觉应用程序移植到android.当我尝试运行脚本时,以下行会发生以下错误:

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)

打印到嵌入式python控制台的错误是:

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'

我已经在build gradle中安装了openCV,如下所示:

I have installed openCV in the build gradle as follows:

        pip {
            install "opencv-python"
        }

根据其中的Chaquopy文档,其中: Chaquopy openCV讨论

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

推荐答案

看起来OpenCV仅支持桌面平台上的关键事件,而不支持移动平台上的关键事件.所有其他高级GUI" 函数.

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.

无论如何,除非您的Android设备实际上有键盘,否则等待按键实际上没有任何意义.您最好在 Chaquopy演示应用中创建一个简单的Android UI并与用户进行交互这样.

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.

这篇关于如何在Chaquopy中使用OpenCV等待键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆