FaceClient.Group 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
Group(RequestContent, RequestContext) |
[Protocol Method] Divide candidate faces into groups based on face similarity.
|
Group(IEnumerable<Guid>, CancellationToken) |
Divide candidate faces into groups based on face similarity. |
Group(RequestContent, RequestContext)
- Source:
- FaceClient.cs
[Protocol Method] Divide candidate faces into groups based on face similarity.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler Group(IEnumerable<Guid>, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response Group (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member Group : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.Group : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function Group (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 Group 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
{
faceIds = new object[]
{
"c5c24a82-6845-4031-9d5d-978df9175426",
"015839fb-fbd9-4f79-ace9-7675fc2f1dd9",
"65d083d4-9447-47d1-af30-b626144bf0fb",
"fce92aed-d578-4d2e-8114-068f8af4492e",
"30ea1073-cc9e-4652-b1e3-d08fb7b95315",
"be386ab3-af91-4104-9e6d-4dae4c9fddb7",
"fbd2a038-dbff-452c-8e79-2ee81b1aa84e",
"b64d5e15-8257-4af2-b20a-5a750f8940e7"
},
});
Response response = client.Group(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("groups")[0][0].ToString());
Console.WriteLine(result.GetProperty("messyGroup")[0].ToString());
Applies to
Group(IEnumerable<Guid>, CancellationToken)
- Source:
- FaceClient.cs
Divide candidate faces into groups based on face similarity.
public virtual Azure.Response<Azure.AI.Vision.Face.FaceGroupingResult> Group (System.Collections.Generic.IEnumerable<Guid> faceIds, System.Threading.CancellationToken cancellationToken = default);
abstract member Group : seq<Guid> * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Vision.Face.FaceGroupingResult>
override this.Group : seq<Guid> * System.Threading.CancellationToken -> Azure.Response<Azure.AI.Vision.Face.FaceGroupingResult>
Public Overridable Function Group (faceIds As IEnumerable(Of Guid), Optional cancellationToken As CancellationToken = Nothing) As Response(Of FaceGroupingResult)
Parameters
- faceIds
- IEnumerable<Guid>
Array of candidate faceIds created by "Detect". The maximum is 1000 faces.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
faceIds
is null.
Examples
This sample shows how to call Group.
Uri endpoint = new Uri("<endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<key>");
FaceClient client = new FaceClient(endpoint, credential);
Response<FaceGroupingResult> response = client.Group(new Guid[] { Guid.Parse("c5c24a82-6845-4031-9d5d-978df9175426"), Guid.Parse("015839fb-fbd9-4f79-ace9-7675fc2f1dd9"), Guid.Parse("65d083d4-9447-47d1-af30-b626144bf0fb"), Guid.Parse("fce92aed-d578-4d2e-8114-068f8af4492e"), Guid.Parse("30ea1073-cc9e-4652-b1e3-d08fb7b95315"), Guid.Parse("be386ab3-af91-4104-9e6d-4dae4c9fddb7"), Guid.Parse("fbd2a038-dbff-452c-8e79-2ee81b1aa84e"), Guid.Parse("b64d5e15-8257-4af2-b20a-5a750f8940e7") });
Remarks
Please refer to https://learn.microsoft.com/rest/api/face/face-recognition-operations/group for more details.
Applies to
Azure SDK for .NET