title: Android camera2 face detection
body: <p>There is not enough info about camera2 face detection mechanism. I used the Camera2 sample from Google: <a href="https://github.com/android/camera-samples" rel="noreferrer">https://github.com/android/camera-samples</a></p>
  <p>I set face detection mode to FULL.</p>
  <pre><code>mPreviewRequestBuilder.set(CaptureRequest.STATISTICS_FACE_DETECT_MODE,
                                      CameraMetadata.STATISTICS_FACE_DETECT_MODE_FULL);
  </code></pre>
  <p>Also, I checked</p>
  <p><code>STATISTICS_INFO_MAX_FACE_COUNT</code> and <code>STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES</code>:</p>
  <pre><code>int max_count = characteristics.get(
  CameraCharacteristics.STATISTICS_INFO_MAX_FACE_COUNT);
  int modes [] = characteristics.get(
  CameraCharacteristics.STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES);
  </code></pre>
  <p><strong>Output</strong>: <em>maxCount : 5 , modes : [0, 2]</em></p>
  <p>My CaptureCallback:</p>
  <pre><code> private CameraCaptureSession.CaptureCallback mCaptureCallback
   = new CameraCaptureSession.CaptureCallback() {
  
      private void process(CaptureResult result) {
                  Integer mode = result.get(CaptureResult.STATISTICS_FACE_DETECT_MODE);
                  Face [] faces = result.get(CaptureResult.STATISTICS_FACES);
                  if(faces != null &amp;&amp; mode != null)
                      Log.e(&quot;tag&quot;, &quot;faces : &quot; + faces.length + &quot; , mode : &quot; + mode ); 
      }
  
      @Override
      public void onCaptureProgressed(CameraCaptureSession session, CaptureRequest request,
                                      CaptureResult partialResult) {
          process(partialResult);
      }
  
      @Override
      public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request,
                                     TotalCaptureResult result) {
          process(result);
      }
  </code></pre>
  <p><strong>Output</strong>: <em>faces : 0 , mode : 2</em></p>
  <pre><code> public static final int STATISTICS_FACE_DETECT_MODE_FULL = 2;
  </code></pre>
  <p>Faces length is constantly 0. Looks like it doesn't detect a face properly or I missed something.</p>
  <p>I know the approach with <a href="https://developer.android.com/reference/android/media/FaceDetector.html" rel="noreferrer">FaceDetector</a>. I just wanted to check how it works with the new camera2 <a href="https://developer.android.com/reference/android/hardware/camera2/params/Face.html" rel="noreferrer">Face</a>.</p>