Android 4 - White camera battery stops after autofocus

In my current application, I have a class containing an instance of the Camera object and trying to do the following:

1) Wait for a while, for example. nothing (this is done through TimerTask) 2) Request focus through autofocus 3) In the autoFocus callback, request OneShotPreviewCallback 4) Save the image when calling the preview callback 5) Repeat

While the white balance works fine until the first autofocus, it stops after the first focus has been performed. Well, of course, I looked at the API, and there is one interesting statement in the description of autoFocus.

But auto focus may temporarily stop auto exposure and auto white balance during focus.

But it seems that he is not stopped only temporarily, but persistently. Funny, with a subsequent call to autofocus, the camera again tries to whiten the whitening, but the correct value mainly happens only with the second or third autofocus.

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

setWhiteBalance(Camera.Parameters.WHITE_BALANCE_AUTO); 

Does anyone else know this problem, or did I miss some point? I know that I can call autoFocus for a long time to force white alignment, but for me this does not seem optimal, because before the first call to auf autoFocus, it works fine.

PS: I am testing Samsung Galaxy S2 with Android 4.0.3.

+6
source share
3 answers

I encountered a similar problem on the Samsung Galaxy 2 Duos 2. In this case, the automatic exposure settings stopped working instead of WB. I tried to enable (disable) the AE option, 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); } } }); 
+3
source

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

As there are no API methods to say that the camera resumes white balancing, and resetting the camera in the autofocus callback does not do this trick, I assume that this is an error in the camera drivers in Samsung phones - I have tried my application with different phones and only on this Samsung Galaxy Ace (GT-S5830, updated to Android 2.3.3), camera balancing does not resume after autofocus.

Maybe we need to issue a bug on developer.samsung.com?

+1
source

It seems that mCamera.stopPreview (); mCamera.startPreview (); in AutoFocusCallback, you can turn on auto exposure again, but with a very short pause in preview as a side effect.

-1
source

Source: https://habr.com/ru/post/918030/


All Articles