| | 1 | | // <auto-generated> |
| | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 4 | | // license information. |
| | 5 | | // |
| | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.CognitiveServices.Vision.Face |
| | 12 | | { |
| | 13 | | using Models; |
| | 14 | | using System.Collections; |
| | 15 | | using System.Collections.Generic; |
| | 16 | | using System.IO; |
| | 17 | | using System.Threading; |
| | 18 | | using System.Threading.Tasks; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Extension methods for LargeFaceListOperations. |
| | 22 | | /// </summary> |
| | 23 | | public static partial class LargeFaceListOperationsExtensions |
| | 24 | | { |
| | 25 | | /// <summary> |
| | 26 | | /// Create an empty large face list with user-specified largeFaceListId, name, |
| | 27 | | /// an optional userData and recognitionModel. |
| | 28 | | /// <br /> Large face list is a list of faces, up to 1,000,000 faces, and |
| | 29 | | /// used by [Face - Find |
| | 30 | | /// Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). |
| | 31 | | /// <br /> After creation, user should use [LargeFaceList Face - |
| | 32 | | /// Add](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3) |
| | 33 | | /// to import the faces and [LargeFaceList - |
| | 34 | | /// Train](/docs/services/563879b61984550e40cbbe8d/operations/5a158422d2de3616c086f2d1) |
| | 35 | | /// to make it ready for [Face - Find |
| | 36 | | /// Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). |
| | 37 | | /// No image will be stored. Only the extracted face features are stored on |
| | 38 | | /// server until [LargeFaceList - |
| | 39 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) |
| | 40 | | /// is called. |
| | 41 | | /// <br /> Find Similar is used for scenario like finding celebrity-like |
| | 42 | | /// faces, similar face filtering, or as a light way face identification. But |
| | 43 | | /// if the actual use is to identify person, please use |
| | 44 | | /// [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244) |
| | 45 | | /// / |
| | 46 | | /// [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d) |
| | 47 | | /// and [Face - |
| | 48 | | /// Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). |
| | 49 | | /// <br/>'recognitionModel' should be specified to associate with this |
| | 50 | | /// large face list. The default value for 'recognitionModel' is |
| | 51 | | /// 'recognition_01', if the latest model needed, please explicitly specify the |
| | 52 | | /// model you need in this parameter. New faces that are added to an existing |
| | 53 | | /// large face list will use the recognition model that's already associated |
| | 54 | | /// with the collection. Existing face features in a large face list can't be |
| | 55 | | /// updated to features extracted by another version of recognition model. |
| | 56 | | /// * 'recognition_01': The default recognition model for [LargeFaceList- |
| | 57 | | /// Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc). |
| | 58 | | /// All those large face lists created before 2019 March are bonded with this |
| | 59 | | /// recognition model. |
| | 60 | | /// * 'recognition_02': Recognition model released in 2019 March. |
| | 61 | | /// 'recognition_02' is recommended since its overall accuracy is improved |
| | 62 | | /// compared with 'recognition_01'. |
| | 63 | | /// |
| | 64 | | /// Large face list quota: |
| | 65 | | /// * Free-tier subscription quota: 64 large face lists. |
| | 66 | | /// * S0-tier subscription quota: 1,000,000 large face lists. |
| | 67 | | /// </summary> |
| | 68 | | /// <param name='operations'> |
| | 69 | | /// The operations group for this extension method. |
| | 70 | | /// </param> |
| | 71 | | /// <param name='largeFaceListId'> |
| | 72 | | /// Id referencing a particular large face list. |
| | 73 | | /// </param> |
| | 74 | | /// <param name='name'> |
| | 75 | | /// User defined name, maximum length is 128. |
| | 76 | | /// </param> |
| | 77 | | /// <param name='userData'> |
| | 78 | | /// User specified data. Length should not exceed 16KB. |
| | 79 | | /// </param> |
| | 80 | | /// <param name='recognitionModel'> |
| | 81 | | /// Possible values include: 'recognition_01', 'recognition_02' |
| | 82 | | /// </param> |
| | 83 | | /// <param name='cancellationToken'> |
| | 84 | | /// The cancellation token. |
| | 85 | | /// </param> |
| | 86 | | public static async Task CreateAsync(this ILargeFaceListOperations operations, string largeFaceListId, strin |
| | 87 | | { |
| 4 | 88 | | (await operations.CreateWithHttpMessagesAsync(largeFaceListId, name, userData, recognitionModel, null, c |
| 4 | 89 | | } |
| | 90 | |
|
| | 91 | | /// <summary> |
| | 92 | | /// Retrieve a large face list’s largeFaceListId, name, userData and |
| | 93 | | /// recognitionModel. |
| | 94 | | /// </summary> |
| | 95 | | /// <param name='operations'> |
| | 96 | | /// The operations group for this extension method. |
| | 97 | | /// </param> |
| | 98 | | /// <param name='largeFaceListId'> |
| | 99 | | /// Id referencing a particular large face list. |
| | 100 | | /// </param> |
| | 101 | | /// <param name='returnRecognitionModel'> |
| | 102 | | /// A value indicating whether the operation should return 'recognitionModel' |
| | 103 | | /// in response. |
| | 104 | | /// </param> |
| | 105 | | /// <param name='cancellationToken'> |
| | 106 | | /// The cancellation token. |
| | 107 | | /// </param> |
| | 108 | | public static async Task<LargeFaceList> GetAsync(this ILargeFaceListOperations operations, string largeFaceL |
| | 109 | | { |
| 2 | 110 | | using (var _result = await operations.GetWithHttpMessagesAsync(largeFaceListId, returnRecognitionModel, |
| | 111 | | { |
| 2 | 112 | | return _result.Body; |
| | 113 | | } |
| 2 | 114 | | } |
| | 115 | |
|
| | 116 | | /// <summary> |
| | 117 | | /// Update information of a large face list. |
| | 118 | | /// </summary> |
| | 119 | | /// <param name='operations'> |
| | 120 | | /// The operations group for this extension method. |
| | 121 | | /// </param> |
| | 122 | | /// <param name='largeFaceListId'> |
| | 123 | | /// Id referencing a particular large face list. |
| | 124 | | /// </param> |
| | 125 | | /// <param name='name'> |
| | 126 | | /// User defined name, maximum length is 128. |
| | 127 | | /// </param> |
| | 128 | | /// <param name='userData'> |
| | 129 | | /// User specified data. Length should not exceed 16KB. |
| | 130 | | /// </param> |
| | 131 | | /// <param name='cancellationToken'> |
| | 132 | | /// The cancellation token. |
| | 133 | | /// </param> |
| | 134 | | public static async Task UpdateAsync(this ILargeFaceListOperations operations, string largeFaceListId, strin |
| | 135 | | { |
| 0 | 136 | | (await operations.UpdateWithHttpMessagesAsync(largeFaceListId, name, userData, null, cancellationToken). |
| 0 | 137 | | } |
| | 138 | |
|
| | 139 | | /// <summary> |
| | 140 | | /// Delete a specified large face list. |
| | 141 | | /// </summary> |
| | 142 | | /// <param name='operations'> |
| | 143 | | /// The operations group for this extension method. |
| | 144 | | /// </param> |
| | 145 | | /// <param name='largeFaceListId'> |
| | 146 | | /// Id referencing a particular large face list. |
| | 147 | | /// </param> |
| | 148 | | /// <param name='cancellationToken'> |
| | 149 | | /// The cancellation token. |
| | 150 | | /// </param> |
| | 151 | | public static async Task DeleteAsync(this ILargeFaceListOperations operations, string largeFaceListId, Cance |
| | 152 | | { |
| 6 | 153 | | (await operations.DeleteWithHttpMessagesAsync(largeFaceListId, null, cancellationToken).ConfigureAwait(f |
| 6 | 154 | | } |
| | 155 | |
|
| | 156 | | /// <summary> |
| | 157 | | /// Retrieve the training status of a large face list (completed or ongoing). |
| | 158 | | /// </summary> |
| | 159 | | /// <param name='operations'> |
| | 160 | | /// The operations group for this extension method. |
| | 161 | | /// </param> |
| | 162 | | /// <param name='largeFaceListId'> |
| | 163 | | /// Id referencing a particular large face list. |
| | 164 | | /// </param> |
| | 165 | | /// <param name='cancellationToken'> |
| | 166 | | /// The cancellation token. |
| | 167 | | /// </param> |
| | 168 | | public static async Task<TrainingStatus> GetTrainingStatusAsync(this ILargeFaceListOperations operations, st |
| | 169 | | { |
| 8 | 170 | | using (var _result = await operations.GetTrainingStatusWithHttpMessagesAsync(largeFaceListId, null, canc |
| | 171 | | { |
| 8 | 172 | | return _result.Body; |
| | 173 | | } |
| 8 | 174 | | } |
| | 175 | |
|
| | 176 | | /// <summary> |
| | 177 | | /// List large face lists’ information of largeFaceListId, name, userData and |
| | 178 | | /// recognitionModel. <br /> |
| | 179 | | /// To get face information inside largeFaceList use [LargeFaceList Face - |
| | 180 | | /// Get](/docs/services/563879b61984550e40cbbe8d/operations/5a158cf2d2de3616c086f2d5)<br |
| | 181 | | /// /> |
| | 182 | | /// * Large face lists are stored in alphabetical order of largeFaceListId. |
| | 183 | | /// * "start" parameter (string, optional) is a user-provided largeFaceListId |
| | 184 | | /// value that returned entries have larger ids by string comparison. "start" |
| | 185 | | /// set to empty to indicate return from the first item. |
| | 186 | | /// * "top" parameter (int, optional) specifies the number of entries to |
| | 187 | | /// return. A maximal of 1000 entries can be returned in one call. To fetch |
| | 188 | | /// more, you can specify "start" with the last returned entry’s Id of the |
| | 189 | | /// current call. |
| | 190 | | /// <br /> |
| | 191 | | /// For example, total 5 large person lists: "list1", ..., "list5". |
| | 192 | | /// <br /> "start=&top=" will return all 5 lists. |
| | 193 | | /// <br /> "start=&top=2" will return "list1", "list2". |
| | 194 | | /// <br /> "start=list2&top=3" will return "list3", "list4", "list5". |
| | 195 | | /// |
| | 196 | | /// </summary> |
| | 197 | | /// <param name='operations'> |
| | 198 | | /// The operations group for this extension method. |
| | 199 | | /// </param> |
| | 200 | | /// <param name='returnRecognitionModel'> |
| | 201 | | /// A value indicating whether the operation should return 'recognitionModel' |
| | 202 | | /// in response. |
| | 203 | | /// </param> |
| | 204 | | /// <param name='cancellationToken'> |
| | 205 | | /// The cancellation token. |
| | 206 | | /// </param> |
| | 207 | | public static async Task<IList<LargeFaceList>> ListAsync(this ILargeFaceListOperations operations, bool? ret |
| | 208 | | { |
| 0 | 209 | | using (var _result = await operations.ListWithHttpMessagesAsync(returnRecognitionModel, null, cancellati |
| | 210 | | { |
| 0 | 211 | | return _result.Body; |
| | 212 | | } |
| 0 | 213 | | } |
| | 214 | |
|
| | 215 | | /// <summary> |
| | 216 | | /// Queue a large face list training task, the training task may not be started |
| | 217 | | /// immediately. |
| | 218 | | /// </summary> |
| | 219 | | /// <param name='operations'> |
| | 220 | | /// The operations group for this extension method. |
| | 221 | | /// </param> |
| | 222 | | /// <param name='largeFaceListId'> |
| | 223 | | /// Id referencing a particular large face list. |
| | 224 | | /// </param> |
| | 225 | | /// <param name='cancellationToken'> |
| | 226 | | /// The cancellation token. |
| | 227 | | /// </param> |
| | 228 | | public static async Task TrainAsync(this ILargeFaceListOperations operations, string largeFaceListId, Cancel |
| | 229 | | { |
| 4 | 230 | | (await operations.TrainWithHttpMessagesAsync(largeFaceListId, null, cancellationToken).ConfigureAwait(fa |
| 4 | 231 | | } |
| | 232 | |
|
| | 233 | | /// <summary> |
| | 234 | | /// Delete a face from a large face list by specified largeFaceListId and |
| | 235 | | /// persistedFaceId. |
| | 236 | | /// <br /> Adding/deleting faces to/from a same large face list are |
| | 237 | | /// processed sequentially and to/from different large face lists are in |
| | 238 | | /// parallel. |
| | 239 | | /// </summary> |
| | 240 | | /// <param name='operations'> |
| | 241 | | /// The operations group for this extension method. |
| | 242 | | /// </param> |
| | 243 | | /// <param name='largeFaceListId'> |
| | 244 | | /// Id referencing a particular large face list. |
| | 245 | | /// </param> |
| | 246 | | /// <param name='persistedFaceId'> |
| | 247 | | /// Id referencing a particular persistedFaceId of an existing face. |
| | 248 | | /// </param> |
| | 249 | | /// <param name='cancellationToken'> |
| | 250 | | /// The cancellation token. |
| | 251 | | /// </param> |
| | 252 | | public static async Task DeleteFaceAsync(this ILargeFaceListOperations operations, string largeFaceListId, S |
| | 253 | | { |
| 0 | 254 | | (await operations.DeleteFaceWithHttpMessagesAsync(largeFaceListId, persistedFaceId, null, cancellationTo |
| 0 | 255 | | } |
| | 256 | |
|
| | 257 | | /// <summary> |
| | 258 | | /// Retrieve information about a persisted face (specified by persistedFaceId |
| | 259 | | /// and its belonging largeFaceListId). |
| | 260 | | /// </summary> |
| | 261 | | /// <param name='operations'> |
| | 262 | | /// The operations group for this extension method. |
| | 263 | | /// </param> |
| | 264 | | /// <param name='largeFaceListId'> |
| | 265 | | /// Id referencing a particular large face list. |
| | 266 | | /// </param> |
| | 267 | | /// <param name='persistedFaceId'> |
| | 268 | | /// Id referencing a particular persistedFaceId of an existing face. |
| | 269 | | /// </param> |
| | 270 | | /// <param name='cancellationToken'> |
| | 271 | | /// The cancellation token. |
| | 272 | | /// </param> |
| | 273 | | public static async Task<PersistedFace> GetFaceAsync(this ILargeFaceListOperations operations, string largeF |
| | 274 | | { |
| 0 | 275 | | using (var _result = await operations.GetFaceWithHttpMessagesAsync(largeFaceListId, persistedFaceId, nul |
| | 276 | | { |
| 0 | 277 | | return _result.Body; |
| | 278 | | } |
| 0 | 279 | | } |
| | 280 | |
|
| | 281 | | /// <summary> |
| | 282 | | /// Update a persisted face's userData field. |
| | 283 | | /// </summary> |
| | 284 | | /// <param name='operations'> |
| | 285 | | /// The operations group for this extension method. |
| | 286 | | /// </param> |
| | 287 | | /// <param name='largeFaceListId'> |
| | 288 | | /// Id referencing a particular large face list. |
| | 289 | | /// </param> |
| | 290 | | /// <param name='persistedFaceId'> |
| | 291 | | /// Id referencing a particular persistedFaceId of an existing face. |
| | 292 | | /// </param> |
| | 293 | | /// <param name='userData'> |
| | 294 | | /// User-provided data attached to the face. The size limit is 1KB. |
| | 295 | | /// </param> |
| | 296 | | /// <param name='cancellationToken'> |
| | 297 | | /// The cancellation token. |
| | 298 | | /// </param> |
| | 299 | | public static async Task UpdateFaceAsync(this ILargeFaceListOperations operations, string largeFaceListId, S |
| | 300 | | { |
| 0 | 301 | | (await operations.UpdateFaceWithHttpMessagesAsync(largeFaceListId, persistedFaceId, userData, null, canc |
| 0 | 302 | | } |
| | 303 | |
|
| | 304 | | /// <summary> |
| | 305 | | /// Add a face to a specified large face list, up to 1,000,000 faces. |
| | 306 | | /// <br /> To deal with an image contains multiple faces, input face can |
| | 307 | | /// be specified as an image with a targetFace rectangle. It returns a |
| | 308 | | /// persistedFaceId representing the added face. No image will be stored. Only |
| | 309 | | /// the extracted face feature will be stored on server until [LargeFaceList |
| | 310 | | /// Face - |
| | 311 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a158c8ad2de3616c086f2d4) |
| | 312 | | /// or [LargeFaceList - |
| | 313 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) |
| | 314 | | /// is called. |
| | 315 | | /// <br /> Note persistedFaceId is different from faceId generated by |
| | 316 | | /// [Face - |
| | 317 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236). |
| | 318 | | /// * Higher face image quality means better recognition precision. Please |
| | 319 | | /// consider high-quality faces: frontal, clear, and face size is 200x200 |
| | 320 | | /// pixels (100 pixels between eyes) or bigger. |
| | 321 | | /// * JPEG, PNG, GIF (the first frame), and BMP format are supported. The |
| | 322 | | /// allowed image file size is from 1KB to 6MB. |
| | 323 | | /// * "targetFace" rectangle should contain one face. Zero or multiple faces |
| | 324 | | /// will be regarded as an error. If the provided "targetFace" rectangle is not |
| | 325 | | /// returned from [Face - |
| | 326 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), |
| | 327 | | /// there’s no guarantee to detect and add the face successfully. |
| | 328 | | /// * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, |
| | 329 | | /// or large occlusions will cause failures. |
| | 330 | | /// * Adding/deleting faces to/from a same face list are processed sequentially |
| | 331 | | /// and to/from different face lists are in parallel. |
| | 332 | | /// * The minimum detectable face size is 36x36 pixels in an image no larger |
| | 333 | | /// than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels |
| | 334 | | /// will need a proportionally larger minimum face size. |
| | 335 | | /// * Different 'detectionModel' values can be provided. To use and compare |
| | 336 | | /// different detection models, please refer to [How to specify a detection |
| | 337 | | /// model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-det |
| | 338 | | /// | Model | Recommended use-case(s) | |
| | 339 | | /// | ---------- | -------- | |
| | 340 | | /// | 'detection_01': | The default detection model for [LargeFaceList - Add |
| | 341 | | /// Face](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3). |
| | 342 | | /// Recommend for near frontal face detection. For scenarios with exceptionally |
| | 343 | | /// large angle (head-pose) faces, occluded faces or wrong image orientation, |
| | 344 | | /// the faces in such cases may not be detected. | |
| | 345 | | /// | 'detection_02': | Detection model released in 2019 May with improved |
| | 346 | | /// accuracy especially on small, side and blurry faces. | |
| | 347 | | /// |
| | 348 | | /// Quota: |
| | 349 | | /// * Free-tier subscription quota: 1,000 faces per large face list. |
| | 350 | | /// * S0-tier subscription quota: 1,000,000 faces per large face list. |
| | 351 | | /// </summary> |
| | 352 | | /// <param name='operations'> |
| | 353 | | /// The operations group for this extension method. |
| | 354 | | /// </param> |
| | 355 | | /// <param name='largeFaceListId'> |
| | 356 | | /// Id referencing a particular large face list. |
| | 357 | | /// </param> |
| | 358 | | /// <param name='url'> |
| | 359 | | /// Publicly reachable URL of an image |
| | 360 | | /// </param> |
| | 361 | | /// <param name='userData'> |
| | 362 | | /// User-specified data about the face for any purpose. The maximum length is |
| | 363 | | /// 1KB. |
| | 364 | | /// </param> |
| | 365 | | /// <param name='targetFace'> |
| | 366 | | /// A face rectangle to specify the target face to be added to a person in the |
| | 367 | | /// format of "targetFace=left,top,width,height". E.g. |
| | 368 | | /// "targetFace=10,10,100,100". If there is more than one face in the image, |
| | 369 | | /// targetFace is required to specify which face to add. No targetFace means |
| | 370 | | /// there is only one face detected in the entire image. |
| | 371 | | /// </param> |
| | 372 | | /// <param name='detectionModel'> |
| | 373 | | /// Name of detection model. Detection model is used to detect faces in the |
| | 374 | | /// submitted image. A detection model name can be provided when performing |
| | 375 | | /// Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add |
| | 376 | | /// Face. The default value is 'detection_01', if another model is needed, |
| | 377 | | /// please explicitly specify it. Possible values include: 'detection_01', |
| | 378 | | /// 'detection_02' |
| | 379 | | /// </param> |
| | 380 | | /// <param name='cancellationToken'> |
| | 381 | | /// The cancellation token. |
| | 382 | | /// </param> |
| | 383 | | public static async Task<PersistedFace> AddFaceFromUrlAsync(this ILargeFaceListOperations operations, string |
| | 384 | | { |
| 0 | 385 | | using (var _result = await operations.AddFaceFromUrlWithHttpMessagesAsync(largeFaceListId, url, userData |
| | 386 | | { |
| 0 | 387 | | return _result.Body; |
| | 388 | | } |
| 0 | 389 | | } |
| | 390 | |
|
| | 391 | | /// <summary> |
| | 392 | | /// List all faces in a large face list, and retrieve face information |
| | 393 | | /// (including userData and persistedFaceIds of registered faces of the face). |
| | 394 | | /// </summary> |
| | 395 | | /// <param name='operations'> |
| | 396 | | /// The operations group for this extension method. |
| | 397 | | /// </param> |
| | 398 | | /// <param name='largeFaceListId'> |
| | 399 | | /// Id referencing a particular large face list. |
| | 400 | | /// </param> |
| | 401 | | /// <param name='start'> |
| | 402 | | /// Starting face id to return (used to list a range of faces). |
| | 403 | | /// </param> |
| | 404 | | /// <param name='top'> |
| | 405 | | /// Number of faces to return starting with the face id indicated by the |
| | 406 | | /// 'start' parameter. |
| | 407 | | /// </param> |
| | 408 | | /// <param name='cancellationToken'> |
| | 409 | | /// The cancellation token. |
| | 410 | | /// </param> |
| | 411 | | public static async Task<IList<PersistedFace>> ListFacesAsync(this ILargeFaceListOperations operations, stri |
| | 412 | | { |
| 2 | 413 | | using (var _result = await operations.ListFacesWithHttpMessagesAsync(largeFaceListId, start, top, null, |
| | 414 | | { |
| 2 | 415 | | return _result.Body; |
| | 416 | | } |
| 2 | 417 | | } |
| | 418 | |
|
| | 419 | | /// <summary> |
| | 420 | | /// Add a face to a specified large face list, up to 1,000,000 faces. |
| | 421 | | /// <br /> To deal with an image contains multiple faces, input face can |
| | 422 | | /// be specified as an image with a targetFace rectangle. It returns a |
| | 423 | | /// persistedFaceId representing the added face. No image will be stored. Only |
| | 424 | | /// the extracted face feature will be stored on server until [LargeFaceList |
| | 425 | | /// Face - |
| | 426 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a158c8ad2de3616c086f2d4) |
| | 427 | | /// or [LargeFaceList - |
| | 428 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) |
| | 429 | | /// is called. |
| | 430 | | /// <br /> Note persistedFaceId is different from faceId generated by |
| | 431 | | /// [Face - |
| | 432 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236). |
| | 433 | | /// * Higher face image quality means better recognition precision. Please |
| | 434 | | /// consider high-quality faces: frontal, clear, and face size is 200x200 |
| | 435 | | /// pixels (100 pixels between eyes) or bigger. |
| | 436 | | /// * JPEG, PNG, GIF (the first frame), and BMP format are supported. The |
| | 437 | | /// allowed image file size is from 1KB to 6MB. |
| | 438 | | /// * "targetFace" rectangle should contain one face. Zero or multiple faces |
| | 439 | | /// will be regarded as an error. If the provided "targetFace" rectangle is not |
| | 440 | | /// returned from [Face - |
| | 441 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), |
| | 442 | | /// there’s no guarantee to detect and add the face successfully. |
| | 443 | | /// * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, |
| | 444 | | /// or large occlusions will cause failures. |
| | 445 | | /// * Adding/deleting faces to/from a same face list are processed sequentially |
| | 446 | | /// and to/from different face lists are in parallel. |
| | 447 | | /// * The minimum detectable face size is 36x36 pixels in an image no larger |
| | 448 | | /// than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels |
| | 449 | | /// will need a proportionally larger minimum face size. |
| | 450 | | /// * Different 'detectionModel' values can be provided. To use and compare |
| | 451 | | /// different detection models, please refer to [How to specify a detection |
| | 452 | | /// model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-det |
| | 453 | | /// | Model | Recommended use-case(s) | |
| | 454 | | /// | ---------- | -------- | |
| | 455 | | /// | 'detection_01': | The default detection model for [LargeFaceList - Add |
| | 456 | | /// Face](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3). |
| | 457 | | /// Recommend for near frontal face detection. For scenarios with exceptionally |
| | 458 | | /// large angle (head-pose) faces, occluded faces or wrong image orientation, |
| | 459 | | /// the faces in such cases may not be detected. | |
| | 460 | | /// | 'detection_02': | Detection model released in 2019 May with improved |
| | 461 | | /// accuracy especially on small, side and blurry faces. | |
| | 462 | | /// |
| | 463 | | /// Quota: |
| | 464 | | /// * Free-tier subscription quota: 1,000 faces per large face list. |
| | 465 | | /// * S0-tier subscription quota: 1,000,000 faces per large face list. |
| | 466 | | /// </summary> |
| | 467 | | /// <param name='operations'> |
| | 468 | | /// The operations group for this extension method. |
| | 469 | | /// </param> |
| | 470 | | /// <param name='largeFaceListId'> |
| | 471 | | /// Id referencing a particular large face list. |
| | 472 | | /// </param> |
| | 473 | | /// <param name='image'> |
| | 474 | | /// An image stream. |
| | 475 | | /// </param> |
| | 476 | | /// <param name='userData'> |
| | 477 | | /// User-specified data about the face for any purpose. The maximum length is |
| | 478 | | /// 1KB. |
| | 479 | | /// </param> |
| | 480 | | /// <param name='targetFace'> |
| | 481 | | /// A face rectangle to specify the target face to be added to a person in the |
| | 482 | | /// format of "targetFace=left,top,width,height". E.g. |
| | 483 | | /// "targetFace=10,10,100,100". If there is more than one face in the image, |
| | 484 | | /// targetFace is required to specify which face to add. No targetFace means |
| | 485 | | /// there is only one face detected in the entire image. |
| | 486 | | /// </param> |
| | 487 | | /// <param name='detectionModel'> |
| | 488 | | /// Name of detection model. Detection model is used to detect faces in the |
| | 489 | | /// submitted image. A detection model name can be provided when performing |
| | 490 | | /// Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add |
| | 491 | | /// Face. The default value is 'detection_01', if another model is needed, |
| | 492 | | /// please explicitly specify it. Possible values include: 'detection_01', |
| | 493 | | /// 'detection_02' |
| | 494 | | /// </param> |
| | 495 | | /// <param name='cancellationToken'> |
| | 496 | | /// The cancellation token. |
| | 497 | | /// </param> |
| | 498 | | public static async Task<PersistedFace> AddFaceFromStreamAsync(this ILargeFaceListOperations operations, str |
| | 499 | | { |
| 14 | 500 | | using (var _result = await operations.AddFaceFromStreamWithHttpMessagesAsync(largeFaceListId, image, use |
| | 501 | | { |
| 14 | 502 | | return _result.Body; |
| | 503 | | } |
| 14 | 504 | | } |
| | 505 | |
|
| | 506 | | } |
| | 507 | | } |