Partager via


FaceClient.VerifyFaceToFaceAsync Method

Definition

Overloads

VerifyFaceToFaceAsync(RequestContent, RequestContext)

[Protocol Method] Verify whether two faces belong to a same person.

VerifyFaceToFaceAsync(Guid, Guid, CancellationToken)

Verify whether two faces belong to a same person.

VerifyFaceToFaceAsync(RequestContent, RequestContext)

Source:
FaceClient.cs

[Protocol Method] Verify whether two faces belong to a same person.

public virtual System.Threading.Tasks.Task<Azure.Response> VerifyFaceToFaceAsync (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member VerifyFaceToFaceAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.VerifyFaceToFaceAsync : Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function VerifyFaceToFaceAsync (content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

content
RequestContent

The content to send as the body of the request.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

content is null.

Service returned a non-success status code.

Examples

This sample shows how to call VerifyFaceToFaceAsync and parse the result.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
FaceClient client = new FaceClient(endpoint, credential);

using RequestContent content = RequestContent.Create(new
{
    faceId1 = "c5c24a82-6845-4031-9d5d-978df9175426",
    faceId2 = "3aa87e30-b380-48eb-ad9e-1aa54fc52bd3",
});
Response response = await client.VerifyFaceToFaceAsync(content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("isIdentical").ToString());
Console.WriteLine(result.GetProperty("confidence").ToString());

Applies to

VerifyFaceToFaceAsync(Guid, Guid, CancellationToken)

Source:
FaceClient.cs

Verify whether two faces belong to a same person.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.Vision.Face.FaceVerificationResult>> VerifyFaceToFaceAsync (Guid faceId1, Guid faceId2, System.Threading.CancellationToken cancellationToken = default);
abstract member VerifyFaceToFaceAsync : Guid * Guid * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Vision.Face.FaceVerificationResult>>
override this.VerifyFaceToFaceAsync : Guid * Guid * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Vision.Face.FaceVerificationResult>>
Public Overridable Function VerifyFaceToFaceAsync (faceId1 As Guid, faceId2 As Guid, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of FaceVerificationResult))

Parameters

faceId1
Guid

The faceId of one face, come from "Detect".

faceId2
Guid

The faceId of another face, come from "Detect".

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Examples

This sample shows how to call VerifyFaceToFaceAsync.

Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
FaceClient client = new FaceClient(endpoint, credential);

Response<FaceVerificationResult> response = await client.VerifyFaceToFaceAsync(Guid.Parse("c5c24a82-6845-4031-9d5d-978df9175426"), Guid.Parse("3aa87e30-b380-48eb-ad9e-1aa54fc52bd3"));

Remarks

Please refer to https://learn.microsoft.com/rest/api/face/face-recognition-operations/verify-face-to-face for more details.

Applies to