Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 4 - Camera White Balancing stops after autoFocus

In my current application, I've got a class holding an instance of a Camera object and trying to do the following:

1) Wait for a specified time, e.g. nothing (this is done via a TimerTask) 2) Request to focus via autoFocus 3) In autoFocus callback, request OneShotPreviewCallback 4) In preview callback, save image 5) Repeat

While the white balancing is working fine prior to the first autoFocus, it stops after the first focussing has been done. Well, of course I looked up the API, and there is one interesting statement in the autoFocus description.

But auto-focus routine may stop auto-exposure and auto-white balance transiently during focusing.

But it seems it is non stopped only transiently, but permantly. Funny enough, with the subsequent call of autoFocus, the camera tries to ajust the whitening again, but the correct value is mostly only with the second or third autoFocus.

I also tried to set the white balancing in code, but it didn't change anything.

setWhiteBalance(Camera.Parameters.WHITE_BALANCE_AUTO);

Does anyone else know this issue, or am I missing some point ? I know that I could permanently call autoFocus to force the white balancing, but that doesn't seem the optimal way for me, because prior to the first call auf autoFocus, it works perfectly fine.

P.S.: I'm testing on a Samsung Galaxy S2 with Android 4.0.3.

like image 365
s.krueger Avatar asked Jun 13 '12 21:06

s.krueger


2 Answers

I have ran into similar issue on Samsung Galaxy 2 Duos 2. In this case, the auto exposure settings have stopped working instead of the WB. I tried to cycle (on/off) the auto exposure param and it worked for me.

mCamera.autoFocus(new Camera.AutoFocusCallback() {

    @Override
    public void onAutoFocus(boolean b, Camera camera) {

        Camera.Parameters params = camera.getParameters();
        if (params.isAutoExposureLockSupported()) {
            params.setAutoExposureLock(true);
            camera.setParameters(params);

            params = camera.getParameters();
            params.setAutoExposureLock(false);
            camera.setParameters(params);
        }
     }

 });
like image 152
mja Avatar answered Oct 20 '22 09:10

mja


I've got the similar problem on Samsung Galaxy Ace - after first autofocus, camera white balancing turns off and does not turn on again, no matter how much I do autofocus after.

As there are no API methods to tell camera to resume white balancing, and resetting the camera parameters in autofocus callback doesn't do the trick, my guess is that it is a bug in camera driver in Samsung phones - I've tried my application with different phones and only on this Samsung Galaxy Ace (GT-S5830; updated to Android 2.3.3), camera white balancing does not resume after autofocusing.

Maybe we should issue a bug ticket on developer.samsung.com?

like image 33
DoDo Avatar answered Oct 20 '22 11:10

DoDo