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.

Container for the parameters to the IndexFaces operation. Detects faces in the input image and adds them to the specified collection.

Amazon Rekognition does not save the actual faces detected. Instead, the underlying detection algorithm first detects the faces in the input image, and for each face extracts facial features into a feature vector, and stores it in the back-end database. Amazon Rekognition uses feature vectors when performing face match and search operations using the and operations.

If you provide the optional externalImageID for the input image you provided, Amazon Rekognition associates this ID with all faces that it detects. When you call the operation, the response returns the external ID. You can use this external image ID to create a client-side index to associate the faces with each image. You can then use the index to find all faces in an image.

In response, the operation returns an array of metadata for all detected faces. This includes, the bounding box of the detected face, confidence value (indicating the bounding box contains a face), a face ID assigned by the service for each face that is detected and stored, and an image ID assigned by the service for the input image. If you request all facial attributes (using the detectionAttributes parameter, Amazon Rekognition returns detailed facial attributes such as facial landmarks (for example, location of eye and mount) and other facial attributes such gender. If you provide the same image, specify the same collection, and use the same external ID in the IndexFaces operation, Amazon Rekognition doesn't save duplicate face metadata.

For an example, see example2.

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

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.Rekognition.AmazonRekognitionRequest
      Amazon.Rekognition.Model.IndexFacesRequest

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

Syntax

C#
public class IndexFacesRequest : AmazonRekognitionRequest
         IAmazonWebServiceRequest

The IndexFacesRequest type exposes the following members

Constructors

NameDescription
Public Method IndexFacesRequest()

Properties

NameTypeDescription
Public Property CollectionId System.String

Gets and sets the property CollectionId.

The ID of an existing collection to which you want to add the faces that are detected in the input images.

Public Property DetectionAttributes System.Collections.Generic.List<System.String>

Gets and sets the property DetectionAttributes.

An array of facial attributes that you want to be returned. This can be the default list of attributes or all attributes. If you don't specify a value for Attributes or if you specify ["DEFAULT"], the API returns the following subset of facial attributes: BoundingBox, Confidence, Pose, Quality and Landmarks. If you provide ["ALL"], all facial attributes are returned but the operation will take longer to complete.

If you provide both, ["ALL", "DEFAULT"], the service uses a logical AND operator to determine which attributes to return (in this case, all attributes).

Public Property ExternalImageId System.String

Gets and sets the property ExternalImageId.

ID you want to assign to all the faces detected in the image.

Public Property Image Amazon.Rekognition.Model.Image

Gets and sets the property Image.

The input image as bytes or an S3 object.

Examples

This operation detects faces in an image and adds them to the specified Rekognition collection.

To add a face to a collection


var response = client.IndexFaces(new IndexFacesRequest 
{
    CollectionId = "myphotos",
    DetectionAttributes = new List {
                    
    },
    ExternalImageId = "myphotoid",
    Image = new Image { S3Object = new S3Object {
        Bucket = "mybucket",
        Name = "myphoto"
    } }
});

List faceRecords = response.FaceRecords;
string orientationCorrection = response.OrientationCorrection;

            

Version Information

.NET Standard:
Supported in: 1.3

.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