FaceClient.VerifyFaceToFace Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
VerifyFaceToFace(RequestContent, RequestContext) |
[Protocol Method] Verify whether two faces belong to a same person.
|
VerifyFaceToFace(Guid, Guid, CancellationToken) |
Verify whether two faces belong to a same person. |
VerifyFaceToFace(RequestContent, RequestContext)
- Source:
- FaceClient.cs
[Protocol Method] Verify whether two faces belong to a same person.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler VerifyFaceToFace(Guid, Guid, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response VerifyFaceToFace (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member VerifyFaceToFace : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.VerifyFaceToFace : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function VerifyFaceToFace (content As RequestContent, Optional context As RequestContext = Nothing) As 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 VerifyFaceToFace and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
FaceClient client = new FaceClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
faceId1 = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
faceId2 = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
});
Response response = client.VerifyFaceToFace(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("isIdentical").ToString());
Console.WriteLine(result.GetProperty("confidence").ToString());
This sample shows how to call VerifyFaceToFace with all request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
FaceClient client = new FaceClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
faceId1 = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
faceId2 = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a",
});
Response response = client.VerifyFaceToFace(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("isIdentical").ToString());
Console.WriteLine(result.GetProperty("confidence").ToString());
Applies to
VerifyFaceToFace(Guid, Guid, CancellationToken)
- Source:
- FaceClient.cs
Verify whether two faces belong to a same person.
public virtual Azure.Response<Azure.AI.Vision.Face.FaceVerificationResult> VerifyFaceToFace (Guid faceId1, Guid faceId2, System.Threading.CancellationToken cancellationToken = default);
abstract member VerifyFaceToFace : Guid * Guid * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Vision.Face.FaceVerificationResult>
override this.VerifyFaceToFace : Guid * Guid * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Vision.Face.FaceVerificationResult>
Public Overridable Function VerifyFaceToFace (faceId1 As Guid, faceId2 As Guid, Optional cancellationToken As CancellationToken = Nothing) As 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 VerifyFaceToFace.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
FaceClient client = new FaceClient(endpoint, credential);
Response<FaceVerificationResult> response = client.VerifyFaceToFace(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"));
This sample shows how to call VerifyFaceToFace with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
FaceClient client = new FaceClient(endpoint, credential);
Response<FaceVerificationResult> response = client.VerifyFaceToFace(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"));
Remarks
> [!NOTE] > > * > * Higher face image quality means better identification precision. Please consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger. > * For the scenarios that are sensitive to accuracy please make your own judgment. > * The 'recognitionModel' associated with the both faces should be the same.
Applies to
Azure SDK for .NET