I need to implement an app on android which uses the camera and it needs to keep the focus continuously on objects. Whenever user changes the camera position, it should autofocus itself for that position (very much like Google Goggles).
Right now I am using the following code:
camera.requestautofocus(autofocuscallbak);
This works well but it's not continuous...
You can use the option: http://developer.android.com/reference/android/hardware/Camera.Parameters.html#FOCUS_MODE_CONTINUOUS_VIDEO
Or you can take a look a the Zxing library http://code.google.com/p/zxing/ (barcode scanner app) which has a loop of events build which comes close to continuous autofocus. It is heavier on your device than you would want to though.
Probably a nicer solution would be to write a function yourself using the accelerometer, and triggering the autofocus when the phone has moved (too much) in a certain direction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With