setParameters初始化Python和SL4A Android的摄像头时失败 [英] setParameters failed when initializing android webcam with python and SL4A

查看:762
本文介绍了setParameters初始化Python和SL4A Android的摄像头时失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是SL4A平台上的Andr​​oid 4.0的平板电脑,并试图使用 droid.webcamStart()这里找到方法来初始化一个摄像头流:<一href=\"http://$c$c.google.com/p/android-scripting/wiki/ApiReference#webcamStart\">http://$c$c.google.com/p/android-scripting/wiki/ApiReference#webcamStart我的问题是,当我执行以下code我得到一个setParameters失败的错误。

I'm using the SL4A platform on an android 4.0 tablet and attempting to initialize a webcam stream using the droid.webcamStart() method found here: http://code.google.com/p/android-scripting/wiki/ApiReference#webcamStart my problem is when I execute the following code I get a setParameters failed error.

蟒蛇code是简单的:

The python code is simple:

 import android
 droid = android.Android()
 address = droid.webcamStart(100,80,0).result

如果一切按计划进行,这应该初始化一个网络摄像头preVIEW流,而是我得到一个错误,说明云:

if all goes according to plan this should initialize a webcam preview stream but instead I am getting an error stating:

 java.lang.RuntimeException: setParameters failed

我见过有些与此相同的问题的其他职位,不过开发人员使用Java进行开发,而不是蟒蛇。我能做些什么在Python来解决这个问题?

I've seen other posts somewhat related to this same issue however the developers were using java for development, not python. What can I do to fix this issue in python?

感谢

推荐答案

这可能是因为您的设备不支持是在SL4A WebcamFacade.java的openCamera方法的设置preVIEW格式。

It could be because your device doesn't support the preview format that is being set in openCamera method of WebcamFacade.java at SL4A.

我已经通过了Android文档根据ImageFormat.NV21改变了它的一贯支持,它为我工作!

I have changed it by ImageFormat.NV21 that according with Android docs is always supported and it worked for me!

您可以从这里下载这一变化:

You can download this change from here:

的https://$c$c.google.com/r / olapaola-机器人脚本/

这篇关于setParameters初始化Python和SL4A Android的摄像头时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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