Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
Toggle table of contents sidebar

# DetectedFace.getDistanceToCamera Method

Module: DetectedFace

## Definition

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

Python

    get_distance_to_camera(self, depth_image: Image) -> int

Parameters

> `depth_image` Image
> in Depth image to process.

Returns

> `int`
> The estimated distance to camera in pixels.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Dart

    int getDistanceToCamera(Image depthImage)

Parameters

> `depthImage` Image
> in Depth image to process.

Returns

> `int`
> The estimated distance to camera in pixels.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

C#

    public int GetDistanceToCamera(Image depthImage)

Parameters

> `depthImage` Image
> in Depth image to process.

Returns

> `int`
> The estimated distance to camera in pixels.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Java

    public int getDistanceToCamera(Image depthImage) throws FaceException

Parameters

> `depthImage` Image
> in Depth image to process.

Returns

> `int`
> The estimated distance to camera in pixels.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

Swift

    public func getDistanceToCamera(depthImage: Image) throws -> Int32

Parameters

> `depthImage` Image
> in Depth image to process.

Returns

> `Int`
> The estimated distance to camera in pixels.

Exceptions

> FaceException
> An error has occurred during Face Library execution.

C

    int id3DetectedFace_GetDistanceToCamera (
        ID3_DETECTED_FACE hDetectedFace,
        ID3_FACE_IMAGE hDepthImage,
        int * distanceToCamera)

Parameters

> `hDetectedFace` ID3_DETECTED_FACE
> in Handle to the DetectedFace object.
> `hDepthImage` ID3_FACE_IMAGE
> in Depth image to process.
> `distanceToCamera` int *
> out The estimated distance to camera in pixels.

Returns

> `int`
> An error code.
> See id3FaceError file for the list of possible error codes.