/// <summary> /// List all persons in a large person group, and retrieve person information /// (including personId, name, userData and persistedFaceIds of registered /// faces of the person). /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='largePersonGroupId'> /// Id referencing a particular large person group. /// </param> /// <param name='start'> /// Starting person id to return (used to list a range of persons). /// </param> /// <param name='top'> /// Number of persons to return starting with the person id indicated by the /// 'start' parameter. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <Person> > ListAsync(this ILargePersonGroupPerson operations, string largePersonGroupId, string start = default(string), int?top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(largePersonGroupId, start, top, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Create a new person in a specified large person group. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='largePersonGroupId'> /// Id referencing a particular large person group. /// </param> /// <param name='name'> /// User defined name, maximum length is 128. /// </param> /// <param name='userData'> /// User specified data. Length should not exceed 16KB. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Person> CreateAsync(this ILargePersonGroupPerson operations, string largePersonGroupId, string name = default(string), string userData = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateWithHttpMessagesAsync(largePersonGroupId, name, userData, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Add a face to a person into a large person group for face identification or /// verification. To deal with an image contains multiple faces, input face can /// be specified as an image with a targetFace rectangle. It returns a /// persistedFaceId representing the added face. No image will be stored. Only /// the extracted face feature will be stored on server until [LargePersonGroup /// PersonFace - /// Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/largepersongroupperson/deleteface), /// [LargePersonGroup Person - /// Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/largepersongroupperson/delete) /// or [LargePersonGroup - /// Delete](https://docs.microsoft.com/rest/api/cognitiveservices/face/largepersongroup/delete) /// is called. /// <br /> Note persistedFaceId is different from faceId generated by /// [Face - /// Detect](https://docs.microsoft.com/rest/api/cognitiveservices/face/face/detectwithurl). /// * Higher face image quality means better recognition precision. Please /// consider high-quality faces: frontal, clear, and face size is 200x200 /// pixels (100 pixels between eyes) or bigger. /// * Each person entry can hold up to 248 faces. /// * JPEG, PNG, GIF (the first frame), and BMP format are supported. The /// allowed image file size is from 1KB to 6MB. /// * "targetFace" rectangle should contain one face. Zero or multiple faces /// will be regarded as an error. If the provided "targetFace" rectangle is not /// returned from [Face - /// Detect](https://docs.microsoft.com/rest/api/cognitiveservices/face/face/detectwithurl), /// there’s no guarantee to detect and add the face successfully. /// * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, /// or large occlusions will cause failures. /// * Adding/deleting faces to/from a same person will be processed /// sequentially. Adding/deleting faces to/from different persons are processed /// in parallel. /// * The minimum detectable face size is 36x36 pixels in an image no larger /// than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels /// will need a proportionally larger minimum face size. /// * Different 'detectionModel' values can be provided. To use and compare /// different detection models, please refer to [How to specify a detection /// model](https://docs.microsoft.com/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) /// | Model | Recommended use-case(s) | /// | ---------- | -------- | /// | 'detection_01': | The default detection model for [LargePersonGroup /// Person - Add /// Face](https://docs.microsoft.com/rest/api/cognitiveservices/face/largepersongroupperson/addfacefromurl). /// Recommend for near frontal face detection. For scenarios with exceptionally /// large angle (head-pose) faces, occluded faces or wrong image orientation, /// the faces in such cases may not be detected. | /// | 'detection_02': | Detection model released in 2019 May with improved /// accuracy especially on small, side and blurry faces. | /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='largePersonGroupId'> /// Id referencing a particular large person group. /// </param> /// <param name='personId'> /// Id referencing a particular person. /// </param> /// <param name='image'> /// An image stream. /// </param> /// <param name='userData'> /// User-specified data about the face for any purpose. The maximum length is /// 1KB. /// </param> /// <param name='targetFace'> /// A face rectangle to specify the target face to be added to a person in the /// format of "targetFace=left,top,width,height". E.g. /// "targetFace=10,10,100,100". If there is more than one face in the image, /// targetFace is required to specify which face to add. No targetFace means /// there is only one face detected in the entire image. /// </param> /// <param name='detectionModel'> /// Name of detection model. Detection model is used to detect faces in the /// submitted image. A detection model name can be provided when performing /// Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add /// Face. The default value is 'detection_01', if another model is needed, /// please explicitly specify it. Possible values include: 'detection_01', /// 'detection_02' /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <PersistedFace> AddFaceFromStreamAsync(this ILargePersonGroupPerson operations, string largePersonGroupId, System.Guid personId, Stream image, string userData = default(string), IList <int?> targetFace = default(IList <int?>), string detectionModel = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.AddFaceFromStreamWithHttpMessagesAsync(largePersonGroupId, personId, image, userData, targetFace, detectionModel, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Retrieve information about a persisted face (specified by persistedFaceId, /// personId and its belonging largePersonGroupId). /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='largePersonGroupId'> /// Id referencing a particular large person group. /// </param> /// <param name='personId'> /// Id referencing a particular person. /// </param> /// <param name='persistedFaceId'> /// Id referencing a particular persistedFaceId of an existing face. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <PersistedFace> GetFaceAsync(this ILargePersonGroupPerson operations, string largePersonGroupId, System.Guid personId, System.Guid persistedFaceId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetFaceWithHttpMessagesAsync(largePersonGroupId, personId, persistedFaceId, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Delete an existing person from a large person group. The persistedFaceId, /// userData, person name and face feature in the person entry will all be /// deleted. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='largePersonGroupId'> /// Id referencing a particular large person group. /// </param> /// <param name='personId'> /// Id referencing a particular person. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task DeleteAsync(this ILargePersonGroupPerson operations, string largePersonGroupId, System.Guid personId, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteWithHttpMessagesAsync(largePersonGroupId, personId, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Update a person persisted face's userData field. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='largePersonGroupId'> /// Id referencing a particular large person group. /// </param> /// <param name='personId'> /// Id referencing a particular person. /// </param> /// <param name='persistedFaceId'> /// Id referencing a particular persistedFaceId of an existing face. /// </param> /// <param name='userData'> /// User-provided data attached to the face. The size limit is 1KB. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task UpdateFaceAsync(this ILargePersonGroupPerson operations, string largePersonGroupId, System.Guid personId, System.Guid persistedFaceId, string userData = default(string), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateFaceWithHttpMessagesAsync(largePersonGroupId, personId, persistedFaceId, userData, null, cancellationToken).ConfigureAwait(false)).Dispose(); }