| | 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 LargePersonGroupPerson. |
| | 22 | | /// </summary> |
| | 23 | | public static partial class LargePersonGroupPersonExtensions |
| | 24 | | { |
| | 25 | | /// <summary> |
| | 26 | | /// Create a new person in a specified large person group. |
| | 27 | | /// </summary> |
| | 28 | | /// <param name='operations'> |
| | 29 | | /// The operations group for this extension method. |
| | 30 | | /// </param> |
| | 31 | | /// <param name='largePersonGroupId'> |
| | 32 | | /// Id referencing a particular large person group. |
| | 33 | | /// </param> |
| | 34 | | /// <param name='name'> |
| | 35 | | /// User defined name, maximum length is 128. |
| | 36 | | /// </param> |
| | 37 | | /// <param name='userData'> |
| | 38 | | /// User specified data. Length should not exceed 16KB. |
| | 39 | | /// </param> |
| | 40 | | /// <param name='cancellationToken'> |
| | 41 | | /// The cancellation token. |
| | 42 | | /// </param> |
| | 43 | | public static async Task<Person> CreateAsync(this ILargePersonGroupPerson operations, string largePersonGrou |
| | 44 | | { |
| 10 | 45 | | using (var _result = await operations.CreateWithHttpMessagesAsync(largePersonGroupId, name, userData, nu |
| | 46 | | { |
| 10 | 47 | | return _result.Body; |
| | 48 | | } |
| 10 | 49 | | } |
| | 50 | |
|
| | 51 | | /// <summary> |
| | 52 | | /// List all persons in a large person group, and retrieve person information |
| | 53 | | /// (including personId, name, userData and persistedFaceIds of registered |
| | 54 | | /// faces of the person). |
| | 55 | | /// </summary> |
| | 56 | | /// <param name='operations'> |
| | 57 | | /// The operations group for this extension method. |
| | 58 | | /// </param> |
| | 59 | | /// <param name='largePersonGroupId'> |
| | 60 | | /// Id referencing a particular large person group. |
| | 61 | | /// </param> |
| | 62 | | /// <param name='start'> |
| | 63 | | /// Starting person id to return (used to list a range of persons). |
| | 64 | | /// </param> |
| | 65 | | /// <param name='top'> |
| | 66 | | /// Number of persons to return starting with the person id indicated by the |
| | 67 | | /// 'start' parameter. |
| | 68 | | /// </param> |
| | 69 | | /// <param name='cancellationToken'> |
| | 70 | | /// The cancellation token. |
| | 71 | | /// </param> |
| | 72 | | public static async Task<IList<Person>> ListAsync(this ILargePersonGroupPerson operations, string largePerso |
| | 73 | | { |
| 0 | 74 | | using (var _result = await operations.ListWithHttpMessagesAsync(largePersonGroupId, start, top, null, ca |
| | 75 | | { |
| 0 | 76 | | return _result.Body; |
| | 77 | | } |
| 0 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> |
| | 81 | | /// Delete an existing person from a large person group. The persistedFaceId, |
| | 82 | | /// userData, person name and face feature in the person entry will all be |
| | 83 | | /// deleted. |
| | 84 | | /// </summary> |
| | 85 | | /// <param name='operations'> |
| | 86 | | /// The operations group for this extension method. |
| | 87 | | /// </param> |
| | 88 | | /// <param name='largePersonGroupId'> |
| | 89 | | /// Id referencing a particular large person group. |
| | 90 | | /// </param> |
| | 91 | | /// <param name='personId'> |
| | 92 | | /// Id referencing a particular person. |
| | 93 | | /// </param> |
| | 94 | | /// <param name='cancellationToken'> |
| | 95 | | /// The cancellation token. |
| | 96 | | /// </param> |
| | 97 | | public static async Task DeleteAsync(this ILargePersonGroupPerson operations, string largePersonGroupId, Sys |
| | 98 | | { |
| 0 | 99 | | (await operations.DeleteWithHttpMessagesAsync(largePersonGroupId, personId, null, cancellationToken).Con |
| 0 | 100 | | } |
| | 101 | |
|
| | 102 | | /// <summary> |
| | 103 | | /// Retrieve a person's name and userData, and the persisted faceIds |
| | 104 | | /// representing the registered person face feature. |
| | 105 | | /// </summary> |
| | 106 | | /// <param name='operations'> |
| | 107 | | /// The operations group for this extension method. |
| | 108 | | /// </param> |
| | 109 | | /// <param name='largePersonGroupId'> |
| | 110 | | /// Id referencing a particular large person group. |
| | 111 | | /// </param> |
| | 112 | | /// <param name='personId'> |
| | 113 | | /// Id referencing a particular person. |
| | 114 | | /// </param> |
| | 115 | | /// <param name='cancellationToken'> |
| | 116 | | /// The cancellation token. |
| | 117 | | /// </param> |
| | 118 | | public static async Task<Person> GetAsync(this ILargePersonGroupPerson operations, string largePersonGroupId |
| | 119 | | { |
| 2 | 120 | | using (var _result = await operations.GetWithHttpMessagesAsync(largePersonGroupId, personId, null, cance |
| | 121 | | { |
| 2 | 122 | | return _result.Body; |
| | 123 | | } |
| 2 | 124 | | } |
| | 125 | |
|
| | 126 | | /// <summary> |
| | 127 | | /// Update name or userData of a person. |
| | 128 | | /// </summary> |
| | 129 | | /// <param name='operations'> |
| | 130 | | /// The operations group for this extension method. |
| | 131 | | /// </param> |
| | 132 | | /// <param name='largePersonGroupId'> |
| | 133 | | /// Id referencing a particular large person group. |
| | 134 | | /// </param> |
| | 135 | | /// <param name='personId'> |
| | 136 | | /// Id referencing a particular person. |
| | 137 | | /// </param> |
| | 138 | | /// <param name='name'> |
| | 139 | | /// User defined name, maximum length is 128. |
| | 140 | | /// </param> |
| | 141 | | /// <param name='userData'> |
| | 142 | | /// User specified data. Length should not exceed 16KB. |
| | 143 | | /// </param> |
| | 144 | | /// <param name='cancellationToken'> |
| | 145 | | /// The cancellation token. |
| | 146 | | /// </param> |
| | 147 | | public static async Task UpdateAsync(this ILargePersonGroupPerson operations, string largePersonGroupId, Sys |
| | 148 | | { |
| 0 | 149 | | (await operations.UpdateWithHttpMessagesAsync(largePersonGroupId, personId, name, userData, null, cancel |
| 0 | 150 | | } |
| | 151 | |
|
| | 152 | | /// <summary> |
| | 153 | | /// Delete a face from a person in a large person group by specified |
| | 154 | | /// largePersonGroupId, personId and persistedFaceId. |
| | 155 | | /// <br /> Adding/deleting faces to/from a same person will be processed |
| | 156 | | /// sequentially. Adding/deleting faces to/from different persons are processed |
| | 157 | | /// in parallel. |
| | 158 | | /// </summary> |
| | 159 | | /// <param name='operations'> |
| | 160 | | /// The operations group for this extension method. |
| | 161 | | /// </param> |
| | 162 | | /// <param name='largePersonGroupId'> |
| | 163 | | /// Id referencing a particular large person group. |
| | 164 | | /// </param> |
| | 165 | | /// <param name='personId'> |
| | 166 | | /// Id referencing a particular person. |
| | 167 | | /// </param> |
| | 168 | | /// <param name='persistedFaceId'> |
| | 169 | | /// Id referencing a particular persistedFaceId of an existing face. |
| | 170 | | /// </param> |
| | 171 | | /// <param name='cancellationToken'> |
| | 172 | | /// The cancellation token. |
| | 173 | | /// </param> |
| | 174 | | public static async Task DeleteFaceAsync(this ILargePersonGroupPerson operations, string largePersonGroupId, |
| | 175 | | { |
| 0 | 176 | | (await operations.DeleteFaceWithHttpMessagesAsync(largePersonGroupId, personId, persistedFaceId, null, c |
| 0 | 177 | | } |
| | 178 | |
|
| | 179 | | /// <summary> |
| | 180 | | /// Retrieve information about a persisted face (specified by persistedFaceId, |
| | 181 | | /// personId and its belonging largePersonGroupId). |
| | 182 | | /// </summary> |
| | 183 | | /// <param name='operations'> |
| | 184 | | /// The operations group for this extension method. |
| | 185 | | /// </param> |
| | 186 | | /// <param name='largePersonGroupId'> |
| | 187 | | /// Id referencing a particular large person group. |
| | 188 | | /// </param> |
| | 189 | | /// <param name='personId'> |
| | 190 | | /// Id referencing a particular person. |
| | 191 | | /// </param> |
| | 192 | | /// <param name='persistedFaceId'> |
| | 193 | | /// Id referencing a particular persistedFaceId of an existing face. |
| | 194 | | /// </param> |
| | 195 | | /// <param name='cancellationToken'> |
| | 196 | | /// The cancellation token. |
| | 197 | | /// </param> |
| | 198 | | public static async Task<PersistedFace> GetFaceAsync(this ILargePersonGroupPerson operations, string largePe |
| | 199 | | { |
| 2 | 200 | | using (var _result = await operations.GetFaceWithHttpMessagesAsync(largePersonGroupId, personId, persist |
| | 201 | | { |
| 2 | 202 | | return _result.Body; |
| | 203 | | } |
| 2 | 204 | | } |
| | 205 | |
|
| | 206 | | /// <summary> |
| | 207 | | /// Update a person persisted face's userData field. |
| | 208 | | /// </summary> |
| | 209 | | /// <param name='operations'> |
| | 210 | | /// The operations group for this extension method. |
| | 211 | | /// </param> |
| | 212 | | /// <param name='largePersonGroupId'> |
| | 213 | | /// Id referencing a particular large person group. |
| | 214 | | /// </param> |
| | 215 | | /// <param name='personId'> |
| | 216 | | /// Id referencing a particular person. |
| | 217 | | /// </param> |
| | 218 | | /// <param name='persistedFaceId'> |
| | 219 | | /// Id referencing a particular persistedFaceId of an existing face. |
| | 220 | | /// </param> |
| | 221 | | /// <param name='userData'> |
| | 222 | | /// User-provided data attached to the face. The size limit is 1KB. |
| | 223 | | /// </param> |
| | 224 | | /// <param name='cancellationToken'> |
| | 225 | | /// The cancellation token. |
| | 226 | | /// </param> |
| | 227 | | public static async Task UpdateFaceAsync(this ILargePersonGroupPerson operations, string largePersonGroupId, |
| | 228 | | { |
| 0 | 229 | | (await operations.UpdateFaceWithHttpMessagesAsync(largePersonGroupId, personId, persistedFaceId, userDat |
| 0 | 230 | | } |
| | 231 | |
|
| | 232 | | /// <summary> |
| | 233 | | /// Add a face to a person into a large person group for face identification or |
| | 234 | | /// verification. To deal with an image contains multiple faces, input face can |
| | 235 | | /// be specified as an image with a targetFace rectangle. It returns a |
| | 236 | | /// persistedFaceId representing the added face. No image will be stored. Only |
| | 237 | | /// the extracted face feature will be stored on server until [LargePersonGroup |
| | 238 | | /// PersonFace - |
| | 239 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ae2966ac60f11b48b5aa3), |
| | 240 | | /// [LargePersonGroup Person - |
| | 241 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2) |
| | 242 | | /// or [LargePersonGroup - |
| | 243 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f) |
| | 244 | | /// is called. |
| | 245 | | /// <br /> Note persistedFaceId is different from faceId generated by |
| | 246 | | /// [Face - |
| | 247 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236). |
| | 248 | | /// * Higher face image quality means better recognition precision. Please |
| | 249 | | /// consider high-quality faces: frontal, clear, and face size is 200x200 |
| | 250 | | /// pixels (100 pixels between eyes) or bigger. |
| | 251 | | /// * Each person entry can hold up to 248 faces. |
| | 252 | | /// * JPEG, PNG, GIF (the first frame), and BMP format are supported. The |
| | 253 | | /// allowed image file size is from 1KB to 6MB. |
| | 254 | | /// * "targetFace" rectangle should contain one face. Zero or multiple faces |
| | 255 | | /// will be regarded as an error. If the provided "targetFace" rectangle is not |
| | 256 | | /// returned from [Face - |
| | 257 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), |
| | 258 | | /// there’s no guarantee to detect and add the face successfully. |
| | 259 | | /// * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, |
| | 260 | | /// or large occlusions will cause failures. |
| | 261 | | /// * Adding/deleting faces to/from a same person will be processed |
| | 262 | | /// sequentially. Adding/deleting faces to/from different persons are processed |
| | 263 | | /// in parallel. |
| | 264 | | /// * The minimum detectable face size is 36x36 pixels in an image no larger |
| | 265 | | /// than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels |
| | 266 | | /// will need a proportionally larger minimum face size. |
| | 267 | | /// * Different 'detectionModel' values can be provided. To use and compare |
| | 268 | | /// different detection models, please refer to [How to specify a detection |
| | 269 | | /// model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-det |
| | 270 | | /// | Model | Recommended use-case(s) | |
| | 271 | | /// | ---------- | -------- | |
| | 272 | | /// | 'detection_01': | The default detection model for [LargePersonGroup |
| | 273 | | /// Person - Add |
| | 274 | | /// Face](/docs/services/563879b61984550e40cbbe8d/operations/599adf2a3a7b9412a4d53f42). |
| | 275 | | /// Recommend for near frontal face detection. For scenarios with exceptionally |
| | 276 | | /// large angle (head-pose) faces, occluded faces or wrong image orientation, |
| | 277 | | /// the faces in such cases may not be detected. | |
| | 278 | | /// | 'detection_02': | Detection model released in 2019 May with improved |
| | 279 | | /// accuracy especially on small, side and blurry faces. | |
| | 280 | | /// </summary> |
| | 281 | | /// <param name='operations'> |
| | 282 | | /// The operations group for this extension method. |
| | 283 | | /// </param> |
| | 284 | | /// <param name='largePersonGroupId'> |
| | 285 | | /// Id referencing a particular large person group. |
| | 286 | | /// </param> |
| | 287 | | /// <param name='personId'> |
| | 288 | | /// Id referencing a particular person. |
| | 289 | | /// </param> |
| | 290 | | /// <param name='url'> |
| | 291 | | /// Publicly reachable URL of an image |
| | 292 | | /// </param> |
| | 293 | | /// <param name='userData'> |
| | 294 | | /// User-specified data about the face for any purpose. The maximum length is |
| | 295 | | /// 1KB. |
| | 296 | | /// </param> |
| | 297 | | /// <param name='targetFace'> |
| | 298 | | /// A face rectangle to specify the target face to be added to a person in the |
| | 299 | | /// format of "targetFace=left,top,width,height". E.g. |
| | 300 | | /// "targetFace=10,10,100,100". If there is more than one face in the image, |
| | 301 | | /// targetFace is required to specify which face to add. No targetFace means |
| | 302 | | /// there is only one face detected in the entire image. |
| | 303 | | /// </param> |
| | 304 | | /// <param name='detectionModel'> |
| | 305 | | /// Name of detection model. Detection model is used to detect faces in the |
| | 306 | | /// submitted image. A detection model name can be provided when performing |
| | 307 | | /// Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add |
| | 308 | | /// Face. The default value is 'detection_01', if another model is needed, |
| | 309 | | /// please explicitly specify it. Possible values include: 'detection_01', |
| | 310 | | /// 'detection_02' |
| | 311 | | /// </param> |
| | 312 | | /// <param name='cancellationToken'> |
| | 313 | | /// The cancellation token. |
| | 314 | | /// </param> |
| | 315 | | public static async Task<PersistedFace> AddFaceFromUrlAsync(this ILargePersonGroupPerson operations, string |
| | 316 | | { |
| 0 | 317 | | using (var _result = await operations.AddFaceFromUrlWithHttpMessagesAsync(largePersonGroupId, personId, |
| | 318 | | { |
| 0 | 319 | | return _result.Body; |
| | 320 | | } |
| 0 | 321 | | } |
| | 322 | |
|
| | 323 | | /// <summary> |
| | 324 | | /// Add a face to a person into a large person group for face identification or |
| | 325 | | /// verification. To deal with an image contains multiple faces, input face can |
| | 326 | | /// be specified as an image with a targetFace rectangle. It returns a |
| | 327 | | /// persistedFaceId representing the added face. No image will be stored. Only |
| | 328 | | /// the extracted face feature will be stored on server until [LargePersonGroup |
| | 329 | | /// PersonFace - |
| | 330 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ae2966ac60f11b48b5aa3), |
| | 331 | | /// [LargePersonGroup Person - |
| | 332 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2) |
| | 333 | | /// or [LargePersonGroup - |
| | 334 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f) |
| | 335 | | /// is called. |
| | 336 | | /// <br /> Note persistedFaceId is different from faceId generated by |
| | 337 | | /// [Face - |
| | 338 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236). |
| | 339 | | /// * Higher face image quality means better recognition precision. Please |
| | 340 | | /// consider high-quality faces: frontal, clear, and face size is 200x200 |
| | 341 | | /// pixels (100 pixels between eyes) or bigger. |
| | 342 | | /// * Each person entry can hold up to 248 faces. |
| | 343 | | /// * JPEG, PNG, GIF (the first frame), and BMP format are supported. The |
| | 344 | | /// allowed image file size is from 1KB to 6MB. |
| | 345 | | /// * "targetFace" rectangle should contain one face. Zero or multiple faces |
| | 346 | | /// will be regarded as an error. If the provided "targetFace" rectangle is not |
| | 347 | | /// returned from [Face - |
| | 348 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), |
| | 349 | | /// there’s no guarantee to detect and add the face successfully. |
| | 350 | | /// * Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, |
| | 351 | | /// or large occlusions will cause failures. |
| | 352 | | /// * Adding/deleting faces to/from a same person will be processed |
| | 353 | | /// sequentially. Adding/deleting faces to/from different persons are processed |
| | 354 | | /// in parallel. |
| | 355 | | /// * The minimum detectable face size is 36x36 pixels in an image no larger |
| | 356 | | /// than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels |
| | 357 | | /// will need a proportionally larger minimum face size. |
| | 358 | | /// * Different 'detectionModel' values can be provided. To use and compare |
| | 359 | | /// different detection models, please refer to [How to specify a detection |
| | 360 | | /// model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-det |
| | 361 | | /// | Model | Recommended use-case(s) | |
| | 362 | | /// | ---------- | -------- | |
| | 363 | | /// | 'detection_01': | The default detection model for [LargePersonGroup |
| | 364 | | /// Person - Add |
| | 365 | | /// Face](/docs/services/563879b61984550e40cbbe8d/operations/599adf2a3a7b9412a4d53f42). |
| | 366 | | /// Recommend for near frontal face detection. For scenarios with exceptionally |
| | 367 | | /// large angle (head-pose) faces, occluded faces or wrong image orientation, |
| | 368 | | /// the faces in such cases may not be detected. | |
| | 369 | | /// | 'detection_02': | Detection model released in 2019 May with improved |
| | 370 | | /// accuracy especially on small, side and blurry faces. | |
| | 371 | | /// </summary> |
| | 372 | | /// <param name='operations'> |
| | 373 | | /// The operations group for this extension method. |
| | 374 | | /// </param> |
| | 375 | | /// <param name='largePersonGroupId'> |
| | 376 | | /// Id referencing a particular large person group. |
| | 377 | | /// </param> |
| | 378 | | /// <param name='personId'> |
| | 379 | | /// Id referencing a particular person. |
| | 380 | | /// </param> |
| | 381 | | /// <param name='image'> |
| | 382 | | /// An image stream. |
| | 383 | | /// </param> |
| | 384 | | /// <param name='userData'> |
| | 385 | | /// User-specified data about the face for any purpose. The maximum length is |
| | 386 | | /// 1KB. |
| | 387 | | /// </param> |
| | 388 | | /// <param name='targetFace'> |
| | 389 | | /// A face rectangle to specify the target face to be added to a person in the |
| | 390 | | /// format of "targetFace=left,top,width,height". E.g. |
| | 391 | | /// "targetFace=10,10,100,100". If there is more than one face in the image, |
| | 392 | | /// targetFace is required to specify which face to add. No targetFace means |
| | 393 | | /// there is only one face detected in the entire image. |
| | 394 | | /// </param> |
| | 395 | | /// <param name='detectionModel'> |
| | 396 | | /// Name of detection model. Detection model is used to detect faces in the |
| | 397 | | /// submitted image. A detection model name can be provided when performing |
| | 398 | | /// Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add |
| | 399 | | /// Face. The default value is 'detection_01', if another model is needed, |
| | 400 | | /// please explicitly specify it. Possible values include: 'detection_01', |
| | 401 | | /// 'detection_02' |
| | 402 | | /// </param> |
| | 403 | | /// <param name='cancellationToken'> |
| | 404 | | /// The cancellation token. |
| | 405 | | /// </param> |
| | 406 | | public static async Task<PersistedFace> AddFaceFromStreamAsync(this ILargePersonGroupPerson operations, stri |
| | 407 | | { |
| 18 | 408 | | using (var _result = await operations.AddFaceFromStreamWithHttpMessagesAsync(largePersonGroupId, personI |
| | 409 | | { |
| 18 | 410 | | return _result.Body; |
| | 411 | | } |
| 18 | 412 | | } |
| | 413 | |
|
| | 414 | | } |
| | 415 | | } |