AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Detects faces within an image (JPEG or PNG) that is provided as input.

For each face detected, the operation returns face details including a bounding box of the face, a confidence value (that the bounding box contains a face), and a fixed set of attributes such as facial landmarks (for example, coordinates of eye and mouth), gender, presence of beard, sunglasses, etc.

The face-detection algorithm is most effective on frontal faces. For non-frontal or obscured faces, the algorithm may not detect the faces or might detect faces with lower confidence.

This is a stateless API operation. That is, the operation does not persist any data.

For an example, see get-started-exercise-detect-faces.

This operation requires permissions to perform the rekognition:DetectFaces action.


For PCL this operation is only available in asynchronous form. Please refer to DetectFacesAsync.

Namespace: Amazon.Rekognition
Assembly: AWSSDK.Rekognition.dll
Version: 3.x.y.z


public virtual DetectFacesResponse DetectFaces(
         DetectFacesRequest request
Type: Amazon.Rekognition.Model.DetectFacesRequest

Container for the necessary parameters to execute the DetectFaces service method.

Return Value
The response from the DetectFaces service method, as returned by Rekognition.


AccessDeniedException You are not authorized to perform the action.
ImageTooLargeException The input image size exceeds the allowed limit. For more information, see limits.
InternalServerErrorException Amazon Rekognition experienced a service issue. Try your call again.
InvalidImageFormatException The provided image format is not supported.
InvalidParameterException Input parameter violated a constraint. Validate your parameter before calling the API operation again.
InvalidS3ObjectException Amazon Rekognition is unable to access the S3 object specified in the request.
ProvisionedThroughputExceededException The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.
ThrottlingException Amazon Rekognition is temporarily unable to process the request. Try your call again.


This operation detects faces in an image stored in an AWS S3 bucket.

To detect faces in an image

var response = client.DetectFaces(new DetectFacesRequest 
    Image = new Image { S3Object = new S3Object {
        Bucket = "mybucket",
        Name = "myphoto"
    } }

List faceDetails = response.FaceDetails;
string orientationCorrection = response.OrientationCorrection;


Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

See Also