Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setParameters failed when initializing android webcam with python and SL4A

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

like image 793
sadmicrowave Avatar asked Nov 13 '22 13:11

sadmicrowave


1 Answers

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/

like image 115
Paola G Avatar answered Nov 15 '22 04:11

Paola G