Problems with turning off the autofocus on Android phone

1k views Asked by At

Working on my Samsung S6 camera calibration as a first step for further app development. One of the perquisites for correctly working app is that the autofocus is disabled. I used something like this:

mCamera.cancelAutoFocus();
Camera.Parameters mParam = mCamera.getParameters();
mParam.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
mCamera.setParameters(mParam);

Previously, I checked that the "infinity" focus mode is available on my device. Still, when running the app, I can clearly see that the focus is changing depending on the distance of the object in frame. "Fixed" mode is not available.

Am I doing something wrong? I just want to have focus that will not change while running app.

I'm using OpenCV3.1 with Android Studio.

1

There are 1 answers

0
page47250 On BEST ANSWER

Olivier's answer helped me alot. Did it as it is described. Had to edit layout a bit. Put the setInfinityFocusMode under the onCameraViewStarted.

Thanks Olivier ! ;)