setParameters failed when initializing android webcam with python and SL4A

Deadly 提交于 2019-12-10 14:33:12

问题


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.

The python code is simple:

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

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

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?

Thanks


回答1:


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

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://code.google.com/r/olapaola-android-scripting/



来源:https://stackoverflow.com/questions/14159483/setparameters-failed-when-initializing-android-webcam-with-python-and-sl4a

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