setParameters初始化Python和SL4A Android的摄像头时失败初始化、摄像头、setParameters、Python

2023-09-08 10:19:09 作者:我的正能量超乎你想象*

我使用的是SL4A平台上的Andr​​oid 4.0的平板电脑,并试图使用 droid.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-机器人脚本/