Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Camera continuous focus

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...

like image 580
zulfiqar Avatar asked Mar 08 '26 00:03

zulfiqar


1 Answers

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.

like image 119
Joey van der Bie Avatar answered Mar 10 '26 14:03

Joey van der Bie