Android Camera2 API - Detect when we have focus -


so, managed create functionality wanted old camera way wanted it.

with mcamera.autofocus(autofocuscallback); detect when have focus , run required code while in preview-mode.

now have hard time grasping how same in camera2 api. first idea i'd use

        private void process(captureresult result) {         switch (mstate) {             case state_preview: {                 // have nothing when camera preview working normally.                 int afstate = result.get(captureresult.control_af_state);                 //if (captureresult.control_af_state == afstate) {                     log.d("some kind of focus", "we have");                 //}                  break;             } } 

but fail find kind of state tells me have gotten focus. have idea how can done camera2 api?

you've got it. list of states can check , transitions can found here.

it depends on control_af_mode using, check focused_locked or perhaps passive_focused, though may want have cases not_focused_locked , passive_unfocused in case camera just cannot focus on scene.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -