0

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.

page47250
  • 301
  • 1
  • 3
  • 13
  • Please, could you be more specific? Why are you using deprecated Camera API 1? where are you using your autofocus disabling, I mean do you use this command before open the camera or before? Do you have any logcat relevant message? – uelordi Jan 03 '17 at 11:51
  • Camera API looked much easier for me to implement than the Camera2. I can see that I made a mistake by putting the whole thing under: protected void onCreate(Bundle savedInstanceState) First, I open the camera and then I disable the autofocus. – page47250 Jan 03 '17 at 21:30
  • @uelordi Found this [answer](http://stackoverflow.com/questions/32018814/how-to-disable-modify-autofocus-and-autowhitebalance-on-android-camera-using-ope?rq=1). That is something I could use, just i'm not sure where could I call `setFlashMode` from (or in my case `setFocusMode`). – page47250 Jan 04 '17 at 06:47

1 Answers1

0

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 ! ;)

Community
  • 1
  • 1
page47250
  • 301
  • 1
  • 3
  • 13