# getDistanceToCamera method

int getDistanceToCamera(

1. Image depthImage

)

Gets the distance between the detected face and the camera when using a depth map in pixels.

param depthImage Depth image to process. return The estimated distance to camera in pixels. throws FaceException An error has occurred during Face Library execution.

## Implementation

    int getDistanceToCamera(Image depthImage) {
      Pointer<Int> pDistanceToCamera = calloc();
      try {
        var err = faceSDK.id3TrackedFace_GetDistanceToCamera(_pHandle.value, depthImage.handle, pDistanceToCamera);
        if (err != FaceError.success.value) {
          throw FaceException(err);
        }
        final vDistanceToCamera = pDistanceToCamera.value;
        return vDistanceToCamera;
      } finally {
        calloc.free(pDistanceToCamera);
      }
    }