Reputation: 302
I'm trying to scan a back of a check (for remote deposit) in Samsung Galaxy S5, but the camera does not focus on the back of the cheque.
On Samsung galaxy S6 this work perfectly, but not on the Samsung galaxy S5.
I'm opening the camera, setting the parameters and processing the data from the stream. My camera focus is set to auto. However, if I stop the preview and start it again, the camera sometimes manage to focus.
I set the camera parameter focus like this:
List<String> supportedFocusMode = parameters.getSupportedFocusModes();
boolean isSupportFocusMode = parameters.getSupportedFocusModes().contains(focusMode);
if (supportedFocusMode != null && isSupportFocusMode)
{
parameters.setFocusMode(focusMode);
int maxNumFocusAreas = parameters.getMaxNumFocusAreas();
if (maxNumFocusAreas > 0)
{
int areaHalfSize = 400;
Rect middelArea = new Rect(-areaHalfSize, -areaHalfSize, areaHalfSize, areaHalfSize); //between -1000 to 1000
List<Camera.Area> focusAreas = new ArrayList<Camera.Area>();
focusAreas.add(new Camera.Area(middelArea, 1));
parameters.setFocusAreas(focusAreas);
}
}
As I mentioned the scan has a timeout after 15 sec that stops the preview, and if I tap the retry button (to re-start the preview) the focus works (not always, but it seems to work better).
any ideas?
Upvotes: 0
Views: 389
Reputation: 96
did you try commiting the parameters with mCamera.setParameters(parameters)? which autofocus mode did you use? FOCUS_MODE_AUTO needs a call to mCamera.autoFocus(), if you want continuous focus, use FOCUS_MODE_CONTINUOUS_PICTURE
Upvotes: 1