title: Unable to access current frame being processed in the "ML Kit Vision Quickstart Sample App"
body: <p>I am working on an android project where I have access <strong>facial landmarks</strong> from the currently processed frame. Then I have to perform some calculation based on the face positions. At last I have to save the current frame being processed.</p>
  <p>For this I am using <a href="https://github.com/googlesamples/mlkit/tree/380fd036bfbcab2f7369148993a811dd73139480/android/vision-quickstart" rel="nofollow noreferrer">ML Kit Vision Quickstart Sample App</a>. This code is doing most of my work. From this code I am using the LivePreviewActivity.java, FaceDetectorProcessor.java and FaceGraphic.java class. I have performed all the calculations inside the FaceGraphics.java class. But I am NOT able to access the frame that is being processed currently.</p>
  <pre><code>LivePreviewActivity.java
  /*
   * Copyright 2020 Google LLC. All rights reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package com.google.mlkit.vision.demo;
  
  import android.content.Context;
  import android.content.Intent;
  import android.content.pm.PackageInfo;
  import android.content.pm.PackageManager;
  import android.os.Bundle;
  
  import androidx.core.app.ActivityCompat;
  import androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback;
  import androidx.core.content.ContextCompat;
  import androidx.appcompat.app.AppCompatActivity;
  
  import android.util.Log;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemSelectedListener;
  import android.widget.ArrayAdapter;
  import android.widget.CompoundButton;
  import android.widget.ImageView;
  import android.widget.Spinner;
  import android.widget.Toast;
  import android.widget.ToggleButton;
  
  import com.google.android.gms.common.annotation.KeepName;
  import com.google.mlkit.common.model.LocalModel;
  import com.google.mlkit.vision.demo.automl.AutoMLImageLabelerProcessor;
  import com.google.mlkit.vision.demo.barcodescanner.BarcodeScannerProcessor;
  import com.google.mlkit.vision.demo.facedetector.FaceDetectorProcessor;
  import com.google.mlkit.vision.demo.labeldetector.LabelDetectorProcessor;
  import com.google.mlkit.vision.demo.objectdetector.ObjectDetectorProcessor;
  import com.google.mlkit.vision.demo.preference.PreferenceUtils;
  import com.google.mlkit.vision.demo.preference.SettingsActivity;
  import com.google.mlkit.vision.demo.preference.SettingsActivity.LaunchSource;
  import com.google.mlkit.vision.demo.textdetector.TextRecognitionProcessor;
  import com.google.mlkit.vision.face.FaceDetectorOptions;
  import com.google.mlkit.vision.label.custom.CustomImageLabelerOptions;
  import com.google.mlkit.vision.label.defaults.ImageLabelerOptions;
  import com.google.mlkit.vision.objects.custom.CustomObjectDetectorOptions;
  import com.google.mlkit.vision.objects.defaults.ObjectDetectorOptions;
  
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.List;
  
  /**
   * Live preview demo for ML Kit APIs.
   */
  @KeepName
  public final class LivePreviewActivity extends AppCompatActivity
          implements OnRequestPermissionsResultCallback,
          OnItemSelectedListener,
          CompoundButton.OnCheckedChangeListener {
      private static final String FACE_DETECTION = &quot;Face Detection&quot;;
      private static final String TAG = &quot;LivePreviewActivity&quot;;
      private static final int PERMISSION_REQUESTS = 1;
  
      private CameraSource cameraSource = null;
      private CameraSourcePreview preview;
      private GraphicOverlay graphicOverlay;
      private String selectedModel = FACE_DETECTION;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Log.d(TAG, &quot;onCreate&quot;);
  
          setContentView(R.layout.activity_vision_live_preview);
  
          preview = findViewById(R.id.preview);
  
          if (preview == null) {
              Log.d(TAG, &quot;Preview is null&quot;);
          }
          graphicOverlay = findViewById(R.id.graphic_overlay);
          if (graphicOverlay == null) {
              Log.d(TAG, &quot;graphicOverlay is null&quot;);
          }
  
          Spinner spinner = findViewById(R.id.spinner);
          List&lt;String&gt; options = new ArrayList&lt;&gt;();
          options.add(FACE_DETECTION);
          // Creating adapter for spinner
          ArrayAdapter&lt;String&gt; dataAdapter = new ArrayAdapter&lt;&gt;(this, R.layout.spinner_style, options);
          // Drop down layout style - list view with radio button
          dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          // attaching data adapter to spinner
          spinner.setAdapter(dataAdapter);
          spinner.setOnItemSelectedListener(this);
  
          ToggleButton facingSwitch = findViewById(R.id.facing_switch);
          facingSwitch.setOnCheckedChangeListener(this);
  
          ImageView settingsButton = findViewById(R.id.settings_button);
          settingsButton.setOnClickListener(
                  v -&gt; {
                      Intent intent = new Intent(getApplicationContext(), SettingsActivity.class);
                      intent.putExtra(SettingsActivity.EXTRA_LAUNCH_SOURCE,
                              SettingsActivity.LaunchSource.LIVE_PREVIEW);
                      startActivity(intent);
                  });
  
          if (allPermissionsGranted()) {
              createCameraSource(selectedModel);
          } else {
              getRuntimePermissions();
          }
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.live_preview_menu, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          if (item.getItemId() == R.id.settings) {
              Intent intent = new Intent(this, SettingsActivity.class);
              intent.putExtra(SettingsActivity.EXTRA_LAUNCH_SOURCE, LaunchSource.LIVE_PREVIEW);
              startActivity(intent);
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      @Override
      public synchronized void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) {
          // An item was selected. You can retrieve the selected item using
          // parent.getItemAtPosition(pos)
          selectedModel = parent.getItemAtPosition(pos).toString();
          Log.d(TAG, &quot;Selected model: &quot; + selectedModel);
          preview.stop();
          if (allPermissionsGranted()) {
              createCameraSource(selectedModel);
              startCameraSource();
          } else {
              getRuntimePermissions();
          }
      }
  
      @Override
      public void onNothingSelected(AdapterView&lt;?&gt; parent) {
          // Do nothing.
      }
  
      @Override
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
          Log.d(TAG, &quot;Set facing&quot;);
          if (cameraSource != null) {
              if (isChecked) {
                  cameraSource.setFacing(CameraSource.CAMERA_FACING_FRONT);
              } else {
                  cameraSource.setFacing(CameraSource.CAMERA_FACING_BACK);
              }
          }
          preview.stop();
          startCameraSource();
      }
  
      private void createCameraSource(String model) {
          // If there's no existing cameraSource, create one.
          if (cameraSource == null) {
              cameraSource = new CameraSource(this, graphicOverlay);
          }
  
          try {
              Log.i(TAG, &quot;Using Face Detector Processor&quot;);
              FaceDetectorOptions faceDetectorOptions = new FaceDetectorOptions.Builder()
                      .setContourMode(FaceDetectorOptions.CONTOUR_MODE_ALL)
                      .build();
                      // PreferenceUtils.getFaceDetectorOptionsForLivePreview(this);
              cameraSource.setMachineLearningFrameProcessor(
                      new FaceDetectorProcessor(this, faceDetectorOptions));
          } catch (Exception e) {
              Log.e(TAG, &quot;Can not create image processor: &quot; + model, e);
              Toast.makeText(
                      getApplicationContext(),
                      &quot;Can not create image processor: &quot; + e.getMessage(),
                      Toast.LENGTH_LONG)
                      .show();
          }
      }
  
      /**
       * Starts or restarts the camera source, if it exists. If the camera source doesn't exist yet
       * (e.g., because onResume was called before the camera source was created), this will be called
       * again when the camera source is created.
       */
      private void startCameraSource() {
          if (cameraSource != null) {
              try {
                  if (preview == null) {
                      Log.d(TAG, &quot;resume: Preview is null&quot;);
                  }
                  if (graphicOverlay == null) {
                      Log.d(TAG, &quot;resume: graphOverlay is null&quot;);
                  }
                  preview.start(cameraSource, graphicOverlay);
  
              } catch (IOException e) {
                  Log.e(TAG, &quot;Unable to start camera source.&quot;, e);
                  cameraSource.release();
                  cameraSource = null;
              }
          }
      }
  
      @Override
      public void onResume() {
          super.onResume();
          Log.d(TAG, &quot;onResume&quot;);
          createCameraSource(selectedModel);
          startCameraSource();
      }
  
      /**
       * Stops the camera.
       */
      @Override
      protected void onPause() {
          super.onPause();
          preview.stop();
      }
  
      @Override
      public void onDestroy() {
          super.onDestroy();
          if (cameraSource != null) {
              cameraSource.release();
          }
      }
  
      private String[] getRequiredPermissions() {
          try {
              PackageInfo info =
                      this.getPackageManager()
                              .getPackageInfo(this.getPackageName(), PackageManager.GET_PERMISSIONS);
              String[] ps = info.requestedPermissions;
              if (ps != null &amp;&amp; ps.length &gt; 0) {
                  return ps;
              } else {
                  return new String[0];
              }
          } catch (Exception e) {
              return new String[0];
          }
      }
  
      private boolean allPermissionsGranted() {
          for (String permission : getRequiredPermissions()) {
              if (!isPermissionGranted(this, permission)) {
                  return false;
              }
          }
          return true;
      }
  
      private void getRuntimePermissions() {
          List&lt;String&gt; allNeededPermissions = new ArrayList&lt;&gt;();
          for (String permission : getRequiredPermissions()) {
              if (!isPermissionGranted(this, permission)) {
                  allNeededPermissions.add(permission);
              }
          }
  
          if (!allNeededPermissions.isEmpty()) {
              ActivityCompat.requestPermissions(
                      this, allNeededPermissions.toArray(new String[0]), PERMISSION_REQUESTS);
          }
      }
  
      @Override
      public void onRequestPermissionsResult(
              int requestCode, String[] permissions, int[] grantResults) {
          Log.i(TAG, &quot;Permission granted!&quot;);
          if (allPermissionsGranted()) {
              createCameraSource(selectedModel);
          }
          super.onRequestPermissionsResult(requestCode, permissions, grantResults);
      }
  
      private static boolean isPermissionGranted(Context context, String permission) {
          if (ContextCompat.checkSelfPermission(context, permission)
                  == PackageManager.PERMISSION_GRANTED) {
              Log.i(TAG, &quot;Permission granted: &quot; + permission);
              return true;
          }
          Log.i(TAG, &quot;Permission NOT granted: &quot; + permission);
          return false;
      }
  }
  </code></pre>
  <pre><code>FaceDetectorProcessor.java
  /*
   * Copyright 2020 Google LLC. All rights reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package com.google.mlkit.vision.demo.facedetector;
  
  import android.content.Context;
  import android.graphics.PointF;
  import android.util.Log;
  
  import androidx.annotation.NonNull;
  
  import com.google.android.gms.tasks.Task;
  import com.google.mlkit.vision.common.InputImage;
  import com.google.mlkit.vision.demo.GraphicOverlay;
  import com.google.mlkit.vision.demo.VisionProcessorBase;
  import com.google.mlkit.vision.face.Face;
  import com.google.mlkit.vision.face.FaceDetection;
  import com.google.mlkit.vision.face.FaceDetector;
  import com.google.mlkit.vision.face.FaceDetectorOptions;
  import com.google.mlkit.vision.face.FaceLandmark;
  
  import java.util.List;
  import java.util.Locale;
  
  /**
   * Face Detector Demo.
   */
  public class FaceDetectorProcessor extends VisionProcessorBase&lt;List&lt;Face&gt;&gt; {
  
      private static final String TAG = &quot;FaceDetectorProcessor&quot;;
  
      private final FaceDetector detector;
  
      public FaceDetectorProcessor(Context context) {
          this(
                  context,
                  new FaceDetectorOptions.Builder()
                          .setClassificationMode(FaceDetectorOptions.CLASSIFICATION_MODE_ALL)
                          .enableTracking()
                          .build());
      }
  
      public FaceDetectorProcessor(Context context, FaceDetectorOptions options) {
          super(context);
          Log.v(MANUAL_TESTING_LOG, &quot;Face detector options: &quot; + options);
          detector = FaceDetection.getClient(options);
      }
  
      @Override
      public void stop() {
          super.stop();
          detector.close();
      }
  
      @Override
      protected Task&lt;List&lt;Face&gt;&gt; detectInImage(InputImage image) {
          return detector.process(image);
      }
  
      @Override
      protected void onSuccess(@NonNull List&lt;Face&gt; faces, @NonNull GraphicOverlay graphicOverlay) {
          for (Face face : faces) {
              graphicOverlay.add(new FaceGraphic(graphicOverlay, face));
              logExtrasForTesting(face);
          }
      }
  
      private static void logExtrasForTesting(Face face) {
          if (face != null) {
              Log.v(MANUAL_TESTING_LOG, &quot;face bounding box: &quot; + face.getBoundingBox().flattenToString());
              Log.v(MANUAL_TESTING_LOG, &quot;face Euler Angle X: &quot; + face.getHeadEulerAngleX());
              Log.v(MANUAL_TESTING_LOG, &quot;face Euler Angle Y: &quot; + face.getHeadEulerAngleY());
              Log.v(MANUAL_TESTING_LOG, &quot;face Euler Angle Z: &quot; + face.getHeadEulerAngleZ());
  
              // All landmarks
              int[] landMarkTypes =
                      new int[]{
                              FaceLandmark.MOUTH_BOTTOM,
                              FaceLandmark.MOUTH_RIGHT,
                              FaceLandmark.MOUTH_LEFT,
                              FaceLandmark.RIGHT_EYE,
                              FaceLandmark.LEFT_EYE,
                              FaceLandmark.RIGHT_EAR,
                              FaceLandmark.LEFT_EAR,
                              FaceLandmark.RIGHT_CHEEK,
                              FaceLandmark.LEFT_CHEEK,
                              FaceLandmark.NOSE_BASE
                      };
              String[] landMarkTypesStrings =
                      new String[]{
                              &quot;MOUTH_BOTTOM&quot;,
                              &quot;MOUTH_RIGHT&quot;,
                              &quot;MOUTH_LEFT&quot;,
                              &quot;RIGHT_EYE&quot;,
                              &quot;LEFT_EYE&quot;,
                              &quot;RIGHT_EAR&quot;,
                              &quot;LEFT_EAR&quot;,
                              &quot;RIGHT_CHEEK&quot;,
                              &quot;LEFT_CHEEK&quot;,
                              &quot;NOSE_BASE&quot;
                      };
              for (int i = 0; i &lt; landMarkTypes.length; i++) {
                  FaceLandmark landmark = face.getLandmark(landMarkTypes[i]);
                  if (landmark == null) {
                      Log.v(
                              MANUAL_TESTING_LOG,
                              &quot;No landmark of type: &quot; + landMarkTypesStrings[i] + &quot; has been detected&quot;);
                  } else {
                      PointF landmarkPosition = landmark.getPosition();
                      String landmarkPositionStr =
                              String.format(Locale.US, &quot;x: %f , y: %f&quot;, landmarkPosition.x, landmarkPosition.y);
                      Log.v(
                              MANUAL_TESTING_LOG,
                              &quot;Position for face landmark: &quot;
                                      + landMarkTypesStrings[i]
                                      + &quot; is :&quot;
                                      + landmarkPositionStr);
                  }
              }
              Log.v(
                      MANUAL_TESTING_LOG,
                      &quot;face left eye open probability: &quot; + face.getLeftEyeOpenProbability());
              Log.v(
                      MANUAL_TESTING_LOG,
                      &quot;face right eye open probability: &quot; + face.getRightEyeOpenProbability());
              Log.v(MANUAL_TESTING_LOG, &quot;face smiling probability: &quot; + face.getSmilingProbability());
              Log.v(MANUAL_TESTING_LOG, &quot;face tracking id: &quot; + face.getTrackingId());
          }
      }
  
      @Override
      protected void onFailure(@NonNull Exception e) {
          Log.e(TAG, &quot;Face detection failed &quot; + e);
      }
  }
  </code></pre>
  <pre><code>FaceGraphics.java
  /*
   * Copyright 2020 Google LLC. All rights reserved.
   *
   * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package com.google.mlkit.vision.demo.facedetector;
  
  import android.graphics.Canvas;
  import android.graphics.Color;
  import android.graphics.Paint;
  import android.graphics.PointF;
  import android.util.Log;
  
  import com.google.mlkit.vision.demo.GraphicOverlay;
  import com.google.mlkit.vision.demo.GraphicOverlay.Graphic;
  import com.google.mlkit.vision.face.Face;
  import com.google.mlkit.vision.face.FaceContour;
  import com.google.mlkit.vision.face.FaceLandmark;
  import com.google.mlkit.vision.face.FaceLandmark.LandmarkType;
  
  import java.util.Locale;
  
  /**
   * Graphic instance for rendering face position, contour, and landmarks within the associated
   * graphic overlay view.
   */
  public class FaceGraphic extends Graphic {
      private static final float FACE_POSITION_RADIUS = 4.0f;
      private static final float ID_TEXT_SIZE = 30.0f;
      private static final float ID_Y_OFFSET = 40.0f;
      private static final float ID_X_OFFSET = -40.0f;
      private static final float BOX_STROKE_WIDTH = 5.0f;
      private static final int NUM_COLORS = 10;
      private static final int[][] COLORS = new int[][]{
              // {Text color, background color}
              {Color.BLACK, Color.WHITE},
              {Color.WHITE, Color.MAGENTA},
              {Color.BLACK, Color.LTGRAY},
              {Color.WHITE, Color.RED},
              {Color.WHITE, Color.BLUE},
              {Color.WHITE, Color.DKGRAY},
              {Color.BLACK, Color.CYAN},
              {Color.BLACK, Color.YELLOW},
              {Color.WHITE, Color.BLACK},
              {Color.BLACK, Color.GREEN}
      };
  
      private final Paint facePositionPaint;
      private final Paint[] idPaints;
      private final Paint[] boxPaints;
      private final Paint[] labelPaints;
  
      private volatile Face face;
  
      FaceGraphic(GraphicOverlay overlay, Face face) {
          super(overlay);
  
          this.face = face;
          final int selectedColor = Color.WHITE;
  
          facePositionPaint = new Paint();
          facePositionPaint.setColor(selectedColor);
  
          int numColors = COLORS.length;
          idPaints = new Paint[numColors];
          boxPaints = new Paint[numColors];
          labelPaints = new Paint[numColors];
          for (int i = 0; i &lt; numColors; i++) {
              idPaints[i] = new Paint();
              idPaints[i].setColor(COLORS[i][0] /* text color */);
              idPaints[i].setTextSize(ID_TEXT_SIZE);
  
              boxPaints[i] = new Paint();
              boxPaints[i].setColor(COLORS[i][1] /* background color */);
              boxPaints[i].setStyle(Paint.Style.STROKE);
              boxPaints[i].setStrokeWidth(BOX_STROKE_WIDTH);
  
              labelPaints[i] = new Paint();
              labelPaints[i].setColor(COLORS[i][1]  /* background color */);
              labelPaints[i].setStyle(Paint.Style.FILL);
          }
      }
  
      /**
       * Draws the face annotations for position on the supplied canvas.
       */
      @Override
      public void draw(Canvas canvas) {
          Face face = this.face;
  
          if (face == null) {
              return;
          }
  
          // Draws a circle at the position of the detected face, with the face's track id below.
          float x0 = translateX(face.getBoundingBox().centerX());
          float y0 = translateY(face.getBoundingBox().centerY());
          // canvas.drawCircle(x0, y0, FACE_POSITION_RADIUS, facePositionPaint);
  
          // Calculate positions.
          float left = x0 - scale(face.getBoundingBox().width() / 2.0f);
          float top = y0 - scale(face.getBoundingBox().height() / 2.0f);
          float right = x0 + scale(face.getBoundingBox().width() / 2.0f);
          float bottom = y0 + scale(face.getBoundingBox().height() / 2.0f);
          float lineHeight = ID_TEXT_SIZE + BOX_STROKE_WIDTH;
          float yLabelOffset = -lineHeight;
  
          // Decide color based on face ID
          int colorID = (face.getTrackingId() == null)
                  ? 0 : Math.abs(face.getTrackingId() % NUM_COLORS);
  
          /**
          // Calculate width and height of label box
          float textWidth = idPaints[colorID].measureText(&quot;ID: &quot; + face.getTrackingId());
          if (face.getSmilingProbability() != null) {
              yLabelOffset -= lineHeight;
              textWidth = Math.max(textWidth, idPaints[colorID].measureText(
                      String.format(Locale.US, &quot;Happiness: %.2f&quot;, face.getSmilingProbability())));
          }
          if (face.getLeftEyeOpenProbability() != null) {
              yLabelOffset -= lineHeight;
              textWidth = Math.max(textWidth, idPaints[colorID].measureText(
                      String.format(Locale.US, &quot;Left eye: %.2f&quot;, face.getLeftEyeOpenProbability())));
          }
          if (face.getRightEyeOpenProbability() != null) {
              yLabelOffset -= lineHeight;
              textWidth = Math.max(textWidth, idPaints[colorID].measureText(
                      String.format(Locale.US, &quot;Right eye: %.2f&quot;, face.getLeftEyeOpenProbability())));
          }
  
          // Draw labels
          canvas.drawRect(left - BOX_STROKE_WIDTH,
                  top + yLabelOffset,
                  left + textWidth + (2 * BOX_STROKE_WIDTH),
                  top,
                  labelPaints[colorID]);
          yLabelOffset += ID_TEXT_SIZE;
          canvas.drawRect(left, top, right, bottom, boxPaints[colorID]);
          canvas.drawText(&quot;ID: &quot; + face.getTrackingId(), left, top + yLabelOffset,
                  idPaints[colorID]);
          yLabelOffset += lineHeight;
          **/
  
          /**
          // Draws all face contours.
          for (FaceContour contour : face.getAllContours()) {
              for (PointF point : contour.getPoints()) {
                  canvas.drawCircle(
                          translateX(point.x), translateY(point.y), FACE_POSITION_RADIUS, facePositionPaint);
              }
          }
          **/
  
          FaceContour contour = face.getContour(FaceContour.NOSE_BRIDGE);
          float x1 = 0, y1 = 0;
          for (PointF point : contour.getPoints()) {
              // canvas.drawCircle(translateX(point.x), translateY(point.y), FACE_POSITION_RADIUS, facePositionPaint);
              x1 = translateX(point.x);
              y1 = translateY(point.y);
              break;
          }
  
          /**
          // Draws smiling and left/right eye open probabilities.
          if (face.getSmilingProbability() != null) {
              canvas.drawText(
                      &quot;Smiling: &quot; + String.format(Locale.US, &quot;%.2f&quot;, face.getSmilingProbability()),
                      left,
                      top + yLabelOffset,
                      idPaints[colorID]);
              yLabelOffset += lineHeight;
          }
          **/
  
          /**
          FaceLandmark leftEye = face.getLandmark(FaceLandmark.LEFT_EYE);
          if (leftEye != null &amp;&amp; face.getLeftEyeOpenProbability() != null) {
              canvas.drawText(
                      &quot;Left eye open: &quot; + String.format(Locale.US, &quot;%.2f&quot;, face.getLeftEyeOpenProbability()),
                      translateX(leftEye.getPosition().x) + ID_X_OFFSET,
                      translateY(leftEye.getPosition().y) + ID_Y_OFFSET,
                      idPaints[colorID]);
          } else if (leftEye != null &amp;&amp; face.getLeftEyeOpenProbability() == null) {
              canvas.drawText(
                      &quot;Left eye&quot;,
                      left,
                      top + yLabelOffset,
                      idPaints[colorID]);
              yLabelOffset += lineHeight;
          } else if (leftEye == null &amp;&amp; face.getLeftEyeOpenProbability() != null) {
              canvas.drawText(
                      &quot;Left eye open: &quot; + String.format(Locale.US, &quot;%.2f&quot;, face.getLeftEyeOpenProbability()),
                      left,
                      top + yLabelOffset,
                      idPaints[colorID]);
              yLabelOffset += lineHeight;
          }
  
          FaceLandmark rightEye = face.getLandmark(FaceLandmark.RIGHT_EYE);
          if (rightEye != null &amp;&amp; face.getRightEyeOpenProbability() != null) {
              canvas.drawText(
                      &quot;Right eye open: &quot; + String.format(Locale.US, &quot;%.2f&quot;, face.getRightEyeOpenProbability()),
                      translateX(rightEye.getPosition().x) + ID_X_OFFSET,
                      translateY(rightEye.getPosition().y) + ID_Y_OFFSET,
                      idPaints[colorID]);
          } else if (rightEye != null &amp;&amp; face.getRightEyeOpenProbability() == null) {
              canvas.drawText(
                      &quot;Right eye&quot;,
                      left,
                      top + yLabelOffset,
                      idPaints[colorID]);
              yLabelOffset += lineHeight;
          } else if (rightEye == null &amp;&amp; face.getRightEyeOpenProbability() != null) {
              canvas.drawText(
                      &quot;Right eye open: &quot; + String.format(Locale.US, &quot;%.2f&quot;, face.getRightEyeOpenProbability()),
                      left,
                      top + yLabelOffset,
                      idPaints[colorID]);
          }
          **/
  
          /**
          // Draw facial landmarks
          drawFaceLandmark(canvas, FaceLandmark.LEFT_EYE);
          drawFaceLandmark(canvas, FaceLandmark.RIGHT_EYE);
          drawFaceLandmark(canvas, FaceLandmark.LEFT_CHEEK);
          drawFaceLandmark(canvas, FaceLandmark.RIGHT_CHEEK);
          **/
      }
  
      private void drawFaceLandmark(Canvas canvas, @LandmarkType int landmarkType) {
          FaceLandmark faceLandmark = face.getLandmark(landmarkType);
          if (faceLandmark != null) {
              canvas.drawCircle(
                      translateX(faceLandmark.getPosition().x),
                      translateY(faceLandmark.getPosition().y),
                      FACE_POSITION_RADIUS,
                      facePositionPaint);
          }
      }
  }
  
  </code></pre>
  <p>In the above code I want to access the current frame being processed. Either inside the LivePreviewActivity or FaceGraphics.java.</p>
  <p>Please help me.</p>