| | 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 FaceOperations. |
| | 22 | | /// </summary> |
| | 23 | | public static partial class FaceOperationsExtensions |
| | 24 | | { |
| | 25 | | /// <summary> |
| | 26 | | /// Given query face's faceId, to search the similar-looking faces from a |
| | 27 | | /// faceId array, a face list or a large face list. faceId array contains the |
| | 28 | | /// faces created by [Face - |
| | 29 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), |
| | 30 | | /// which will expire 24 hours after creation. A "faceListId" is created by |
| | 31 | | /// [FaceList - |
| | 32 | | /// Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039524b) |
| | 33 | | /// containing persistedFaceIds that will not expire. And a "largeFaceListId" |
| | 34 | | /// is created by [LargeFaceList - |
| | 35 | | /// Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc) |
| | 36 | | /// containing persistedFaceIds that will also not expire. Depending on the |
| | 37 | | /// input the returned similar faces list contains faceIds or persistedFaceIds |
| | 38 | | /// ranked by similarity. |
| | 39 | | /// <br/>Find similar has two working modes, "matchPerson" and |
| | 40 | | /// "matchFace". "matchPerson" is the default mode that it tries to find faces |
| | 41 | | /// of the same person as possible by using internal same-person thresholds. It |
| | 42 | | /// is useful to find a known person's other photos. Note that an empty list |
| | 43 | | /// will be returned if no faces pass the internal thresholds. "matchFace" mode |
| | 44 | | /// ignores same-person thresholds and returns ranked similar faces anyway, |
| | 45 | | /// even the similarity is low. It can be used in the cases like searching |
| | 46 | | /// celebrity-looking faces. |
| | 47 | | /// <br/>The 'recognitionModel' associated with the query face's faceId |
| | 48 | | /// should be the same as the 'recognitionModel' used by the target faceId |
| | 49 | | /// array, face list or large face list. |
| | 50 | | /// |
| | 51 | | /// </summary> |
| | 52 | | /// <param name='operations'> |
| | 53 | | /// The operations group for this extension method. |
| | 54 | | /// </param> |
| | 55 | | /// <param name='faceId'> |
| | 56 | | /// FaceId of the query face. User needs to call Face - Detect first to get a |
| | 57 | | /// valid faceId. Note that this faceId is not persisted and will expire 24 |
| | 58 | | /// hours after the detection call |
| | 59 | | /// </param> |
| | 60 | | /// <param name='faceListId'> |
| | 61 | | /// An existing user-specified unique candidate face list, created in Face List |
| | 62 | | /// - Create a Face List. Face list contains a set of persistedFaceIds which |
| | 63 | | /// are persisted and will never expire. Parameter faceListId, largeFaceListId |
| | 64 | | /// and faceIds should not be provided at the same time. |
| | 65 | | /// </param> |
| | 66 | | /// <param name='largeFaceListId'> |
| | 67 | | /// An existing user-specified unique candidate large face list, created in |
| | 68 | | /// LargeFaceList - Create. Large face list contains a set of persistedFaceIds |
| | 69 | | /// which are persisted and will never expire. Parameter faceListId, |
| | 70 | | /// largeFaceListId and faceIds should not be provided at the same time. |
| | 71 | | /// </param> |
| | 72 | | /// <param name='faceIds'> |
| | 73 | | /// An array of candidate faceIds. All of them are created by Face - Detect and |
| | 74 | | /// the faceIds will expire 24 hours after the detection call. The number of |
| | 75 | | /// faceIds is limited to 1000. Parameter faceListId, largeFaceListId and |
| | 76 | | /// faceIds should not be provided at the same time. |
| | 77 | | /// </param> |
| | 78 | | /// <param name='maxNumOfCandidatesReturned'> |
| | 79 | | /// The number of top similar faces returned. The valid range is [1, 1000]. |
| | 80 | | /// </param> |
| | 81 | | /// <param name='mode'> |
| | 82 | | /// Similar face searching mode. It can be "matchPerson" or "matchFace". |
| | 83 | | /// Possible values include: 'matchPerson', 'matchFace' |
| | 84 | | /// </param> |
| | 85 | | /// <param name='cancellationToken'> |
| | 86 | | /// The cancellation token. |
| | 87 | | /// </param> |
| | 88 | | public static async Task<IList<SimilarFace>> FindSimilarAsync(this IFaceOperations operations, System.Guid f |
| | 89 | | { |
| 6 | 90 | | using (var _result = await operations.FindSimilarWithHttpMessagesAsync(faceId, faceListId, largeFaceList |
| | 91 | | { |
| 6 | 92 | | return _result.Body; |
| | 93 | | } |
| 6 | 94 | | } |
| | 95 | |
|
| | 96 | | /// <summary> |
| | 97 | | /// Divide candidate faces into groups based on face similarity.<br /> |
| | 98 | | /// * The output is one or more disjointed face groups and a messyGroup. A face |
| | 99 | | /// group contains faces that have similar looking, often of the same person. |
| | 100 | | /// Face groups are ranked by group size, i.e. number of faces. Notice that |
| | 101 | | /// faces belonging to a same person might be split into several groups in the |
| | 102 | | /// result. |
| | 103 | | /// * MessyGroup is a special face group containing faces that cannot find any |
| | 104 | | /// similar counterpart face from original faces. The messyGroup will not |
| | 105 | | /// appear in the result if all faces found their counterparts. |
| | 106 | | /// * Group API needs at least 2 candidate faces and 1000 at most. We suggest |
| | 107 | | /// to try [Face - |
| | 108 | | /// Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a) |
| | 109 | | /// when you only have 2 candidate faces. |
| | 110 | | /// * The 'recognitionModel' associated with the query faces' faceIds should be |
| | 111 | | /// the same. |
| | 112 | | /// |
| | 113 | | /// </summary> |
| | 114 | | /// <param name='operations'> |
| | 115 | | /// The operations group for this extension method. |
| | 116 | | /// </param> |
| | 117 | | /// <param name='faceIds'> |
| | 118 | | /// Array of candidate faceId created by Face - Detect. The maximum is 1000 |
| | 119 | | /// faces |
| | 120 | | /// </param> |
| | 121 | | /// <param name='cancellationToken'> |
| | 122 | | /// The cancellation token. |
| | 123 | | /// </param> |
| | 124 | | public static async Task<GroupResult> GroupAsync(this IFaceOperations operations, IList<System.Guid> faceIds |
| | 125 | | { |
| 0 | 126 | | using (var _result = await operations.GroupWithHttpMessagesAsync(faceIds, null, cancellationToken).Confi |
| | 127 | | { |
| 0 | 128 | | return _result.Body; |
| | 129 | | } |
| 0 | 130 | | } |
| | 131 | |
|
| | 132 | | /// <summary> |
| | 133 | | /// 1-to-many identification to find the closest matches of the specific query |
| | 134 | | /// person face from a person group or large person group. |
| | 135 | | /// <br/> For each face in the faceIds array, Face Identify will compute |
| | 136 | | /// similarities between the query face and all the faces in the person group |
| | 137 | | /// (given by personGroupId) or large person group (given by |
| | 138 | | /// largePersonGroupId), and return candidate person(s) for that face ranked by |
| | 139 | | /// similarity confidence. The person group/large person group should be |
| | 140 | | /// trained to make it ready for identification. See more in [PersonGroup - |
| | 141 | | /// Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249) |
| | 142 | | /// and [LargePersonGroup - |
| | 143 | | /// Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4). |
| | 144 | | /// <br/> |
| | 145 | | /// |
| | 146 | | /// Remarks:<br /> |
| | 147 | | /// * The algorithm allows more than one face to be identified independently at |
| | 148 | | /// the same request, but no more than 10 faces. |
| | 149 | | /// * Each person in the person group/large person group could have more than |
| | 150 | | /// one face, but no more than 248 faces. |
| | 151 | | /// * Higher face image quality means better identification precision. Please |
| | 152 | | /// consider high-quality faces: frontal, clear, and face size is 200x200 |
| | 153 | | /// pixels (100 pixels between eyes) or bigger. |
| | 154 | | /// * Number of candidates returned is restricted by maxNumOfCandidatesReturned |
| | 155 | | /// and confidenceThreshold. If no person is identified, the returned |
| | 156 | | /// candidates will be an empty array. |
| | 157 | | /// * Try [Face - Find |
| | 158 | | /// Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237) |
| | 159 | | /// when you need to find similar faces from a face list/large face list |
| | 160 | | /// instead of a person group/large person group. |
| | 161 | | /// * The 'recognitionModel' associated with the query faces' faceIds should be |
| | 162 | | /// the same as the 'recognitionModel' used by the target person group or large |
| | 163 | | /// person group. |
| | 164 | | /// |
| | 165 | | /// </summary> |
| | 166 | | /// <param name='operations'> |
| | 167 | | /// The operations group for this extension method. |
| | 168 | | /// </param> |
| | 169 | | /// <param name='faceIds'> |
| | 170 | | /// Array of query faces faceIds, created by the Face - Detect. Each of the |
| | 171 | | /// faces are identified independently. The valid number of faceIds is between |
| | 172 | | /// [1, 10]. |
| | 173 | | /// </param> |
| | 174 | | /// <param name='personGroupId'> |
| | 175 | | /// PersonGroupId of the target person group, created by PersonGroup - Create. |
| | 176 | | /// Parameter personGroupId and largePersonGroupId should not be provided at |
| | 177 | | /// the same time. |
| | 178 | | /// </param> |
| | 179 | | /// <param name='largePersonGroupId'> |
| | 180 | | /// LargePersonGroupId of the target large person group, created by |
| | 181 | | /// LargePersonGroup - Create. Parameter personGroupId and largePersonGroupId |
| | 182 | | /// should not be provided at the same time. |
| | 183 | | /// </param> |
| | 184 | | /// <param name='maxNumOfCandidatesReturned'> |
| | 185 | | /// The range of maxNumOfCandidatesReturned is between 1 and 5 (default is 1). |
| | 186 | | /// </param> |
| | 187 | | /// <param name='confidenceThreshold'> |
| | 188 | | /// Confidence threshold of identification, used to judge whether one face |
| | 189 | | /// belong to one person. The range of confidenceThreshold is [0, 1] (default |
| | 190 | | /// specified by algorithm). |
| | 191 | | /// </param> |
| | 192 | | /// <param name='cancellationToken'> |
| | 193 | | /// The cancellation token. |
| | 194 | | /// </param> |
| | 195 | | public static async Task<IList<IdentifyResult>> IdentifyAsync(this IFaceOperations operations, IList<System. |
| | 196 | | { |
| 4 | 197 | | using (var _result = await operations.IdentifyWithHttpMessagesAsync(faceIds, personGroupId, largePersonG |
| | 198 | | { |
| 4 | 199 | | return _result.Body; |
| | 200 | | } |
| 4 | 201 | | } |
| | 202 | |
|
| | 203 | | /// <summary> |
| | 204 | | /// Verify whether two faces belong to a same person or whether one face |
| | 205 | | /// belongs to a person. |
| | 206 | | /// <br/> |
| | 207 | | /// Remarks:<br /> |
| | 208 | | /// * Higher face image quality means better identification precision. Please |
| | 209 | | /// consider high-quality faces: frontal, clear, and face size is 200x200 |
| | 210 | | /// pixels (100 pixels between eyes) or bigger. |
| | 211 | | /// * For the scenarios that are sensitive to accuracy please make your own |
| | 212 | | /// judgment. |
| | 213 | | /// * The 'recognitionModel' associated with the query faces' faceIds should be |
| | 214 | | /// the same as the 'recognitionModel' used by the target face, person group or |
| | 215 | | /// large person group. |
| | 216 | | /// |
| | 217 | | /// </summary> |
| | 218 | | /// <param name='operations'> |
| | 219 | | /// The operations group for this extension method. |
| | 220 | | /// </param> |
| | 221 | | /// <param name='faceId1'> |
| | 222 | | /// FaceId of the first face, comes from Face - Detect |
| | 223 | | /// </param> |
| | 224 | | /// <param name='faceId2'> |
| | 225 | | /// FaceId of the second face, comes from Face - Detect |
| | 226 | | /// </param> |
| | 227 | | /// <param name='cancellationToken'> |
| | 228 | | /// The cancellation token. |
| | 229 | | /// </param> |
| | 230 | | public static async Task<VerifyResult> VerifyFaceToFaceAsync(this IFaceOperations operations, System.Guid fa |
| | 231 | | { |
| 4 | 232 | | using (var _result = await operations.VerifyFaceToFaceWithHttpMessagesAsync(faceId1, faceId2, null, canc |
| | 233 | | { |
| 4 | 234 | | return _result.Body; |
| | 235 | | } |
| 4 | 236 | | } |
| | 237 | |
|
| | 238 | | /// <summary> |
| | 239 | | /// Detect human faces in an image, return face rectangles, and optionally with |
| | 240 | | /// faceIds, landmarks, and attributes.<br /> |
| | 241 | | /// * No image will be stored. Only the extracted face feature will be stored |
| | 242 | | /// on server. The faceId is an identifier of the face feature and will be used |
| | 243 | | /// in [Face - |
| | 244 | | /// Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239), |
| | 245 | | /// [Face - |
| | 246 | | /// Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a), |
| | 247 | | /// and [Face - Find |
| | 248 | | /// Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). |
| | 249 | | /// The stored face feature(s) will expire and be deleted 24 hours after the |
| | 250 | | /// original detection call. |
| | 251 | | /// * Optional parameters include faceId, landmarks, and attributes. Attributes |
| | 252 | | /// include age, gender, headPose, smile, facialHair, glasses, emotion, hair, |
| | 253 | | /// makeup, occlusion, accessories, blur, exposure and noise. Some of the |
| | 254 | | /// results returned for specific attributes may not be highly accurate. |
| | 255 | | /// * JPEG, PNG, GIF (the first frame), and BMP format are supported. The |
| | 256 | | /// allowed image file size is from 1KB to 6MB. |
| | 257 | | /// * Up to 100 faces can be returned for an image. Faces are ranked by face |
| | 258 | | /// rectangle size from large to small. |
| | 259 | | /// * For optimal results when querying [Face - |
| | 260 | | /// Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239), |
| | 261 | | /// [Face - |
| | 262 | | /// Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a), |
| | 263 | | /// and [Face - Find |
| | 264 | | /// Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237) |
| | 265 | | /// ('returnFaceId' is true), please use faces that are: frontal, clear, and |
| | 266 | | /// with a minimum size of 200x200 pixels (100 pixels between eyes). |
| | 267 | | /// * The minimum detectable face size is 36x36 pixels in an image no larger |
| | 268 | | /// than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels |
| | 269 | | /// will need a proportionally larger minimum face size. |
| | 270 | | /// * Different 'detectionModel' values can be provided. To use and compare |
| | 271 | | /// different detection models, please refer to [How to specify a detection |
| | 272 | | /// model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-det |
| | 273 | | /// | Model | Recommended use-case(s) | |
| | 274 | | /// | ---------- | -------- | |
| | 275 | | /// | 'detection_01': | The default detection model for [Face - |
| | 276 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236). |
| | 277 | | /// Recommend for near frontal face detection. For scenarios with exceptionally |
| | 278 | | /// large angle (head-pose) faces, occluded faces or wrong image orientation, |
| | 279 | | /// the faces in such cases may not be detected. | |
| | 280 | | /// | 'detection_02': | Detection model released in 2019 May with improved |
| | 281 | | /// accuracy especially on small, side and blurry faces. | |
| | 282 | | /// |
| | 283 | | /// * Different 'recognitionModel' values are provided. If follow-up operations |
| | 284 | | /// like Verify, Identify, Find Similar are needed, please specify the |
| | 285 | | /// recognition model with 'recognitionModel' parameter. The default value for |
| | 286 | | /// 'recognitionModel' is 'recognition_01', if latest model needed, please |
| | 287 | | /// explicitly specify the model you need in this parameter. Once specified, |
| | 288 | | /// the detected faceIds will be associated with the specified recognition |
| | 289 | | /// model. More details, please refer to [How to specify a recognition |
| | 290 | | /// model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-rec |
| | 291 | | /// | Model | Recommended use-case(s) | |
| | 292 | | /// | ---------- | -------- | |
| | 293 | | /// | 'recognition_01': | The default recognition model for [Face - |
| | 294 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236). |
| | 295 | | /// All those faceIds created before 2019 March are bonded with this |
| | 296 | | /// recognition model. | |
| | 297 | | /// | 'recognition_02': | Recognition model released in 2019 March. |
| | 298 | | /// 'recognition_02' is recommended since its overall accuracy is improved |
| | 299 | | /// compared with 'recognition_01'. | |
| | 300 | | /// </summary> |
| | 301 | | /// <param name='operations'> |
| | 302 | | /// The operations group for this extension method. |
| | 303 | | /// </param> |
| | 304 | | /// <param name='url'> |
| | 305 | | /// Publicly reachable URL of an image |
| | 306 | | /// </param> |
| | 307 | | /// <param name='returnFaceId'> |
| | 308 | | /// A value indicating whether the operation should return faceIds of detected |
| | 309 | | /// faces. |
| | 310 | | /// </param> |
| | 311 | | /// <param name='returnFaceLandmarks'> |
| | 312 | | /// A value indicating whether the operation should return landmarks of the |
| | 313 | | /// detected faces. |
| | 314 | | /// </param> |
| | 315 | | /// <param name='returnFaceAttributes'> |
| | 316 | | /// Analyze and return the one or more specified face attributes in the |
| | 317 | | /// comma-separated string like "returnFaceAttributes=age,gender". Supported |
| | 318 | | /// face attributes include age, gender, headPose, smile, facialHair, glasses |
| | 319 | | /// and emotion. Note that each face attribute analysis has additional |
| | 320 | | /// computational and time cost. |
| | 321 | | /// </param> |
| | 322 | | /// <param name='recognitionModel'> |
| | 323 | | /// Name of recognition model. Recognition model is used when the face features |
| | 324 | | /// are extracted and associated with detected faceIds, (Large)FaceList or |
| | 325 | | /// (Large)PersonGroup. A recognition model name can be provided when |
| | 326 | | /// performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup |
| | 327 | | /// - Create. The default value is 'recognition_01', if latest model needed, |
| | 328 | | /// please explicitly specify the model you need. Possible values include: |
| | 329 | | /// 'recognition_01', 'recognition_02' |
| | 330 | | /// </param> |
| | 331 | | /// <param name='returnRecognitionModel'> |
| | 332 | | /// A value indicating whether the operation should return 'recognitionModel' |
| | 333 | | /// in response. |
| | 334 | | /// </param> |
| | 335 | | /// <param name='detectionModel'> |
| | 336 | | /// Name of detection model. Detection model is used to detect faces in the |
| | 337 | | /// submitted image. A detection model name can be provided when performing |
| | 338 | | /// Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add |
| | 339 | | /// Face. The default value is 'detection_01', if another model is needed, |
| | 340 | | /// please explicitly specify it. Possible values include: 'detection_01', |
| | 341 | | /// 'detection_02' |
| | 342 | | /// </param> |
| | 343 | | /// <param name='cancellationToken'> |
| | 344 | | /// The cancellation token. |
| | 345 | | /// </param> |
| | 346 | | public static async Task<IList<DetectedFace>> DetectWithUrlAsync(this IFaceOperations operations, string url |
| | 347 | | { |
| 0 | 348 | | using (var _result = await operations.DetectWithUrlWithHttpMessagesAsync(url, returnFaceId, returnFaceLa |
| | 349 | | { |
| 0 | 350 | | return _result.Body; |
| | 351 | | } |
| 0 | 352 | | } |
| | 353 | |
|
| | 354 | | /// <summary> |
| | 355 | | /// Verify whether two faces belong to a same person. Compares a face Id with a |
| | 356 | | /// Person Id |
| | 357 | | /// </summary> |
| | 358 | | /// <param name='operations'> |
| | 359 | | /// The operations group for this extension method. |
| | 360 | | /// </param> |
| | 361 | | /// <param name='faceId'> |
| | 362 | | /// FaceId of the face, comes from Face - Detect |
| | 363 | | /// </param> |
| | 364 | | /// <param name='personId'> |
| | 365 | | /// Specify a certain person in a person group or a large person group. |
| | 366 | | /// personId is created in PersonGroup Person - Create or LargePersonGroup |
| | 367 | | /// Person - Create. |
| | 368 | | /// </param> |
| | 369 | | /// <param name='personGroupId'> |
| | 370 | | /// Using existing personGroupId and personId for fast loading a specified |
| | 371 | | /// person. personGroupId is created in PersonGroup - Create. Parameter |
| | 372 | | /// personGroupId and largePersonGroupId should not be provided at the same |
| | 373 | | /// time. |
| | 374 | | /// </param> |
| | 375 | | /// <param name='largePersonGroupId'> |
| | 376 | | /// Using existing largePersonGroupId and personId for fast loading a specified |
| | 377 | | /// person. largePersonGroupId is created in LargePersonGroup - Create. |
| | 378 | | /// Parameter personGroupId and largePersonGroupId should not be provided at |
| | 379 | | /// the same time. |
| | 380 | | /// </param> |
| | 381 | | /// <param name='cancellationToken'> |
| | 382 | | /// The cancellation token. |
| | 383 | | /// </param> |
| | 384 | | public static async Task<VerifyResult> VerifyFaceToPersonAsync(this IFaceOperations operations, System.Guid |
| | 385 | | { |
| 8 | 386 | | using (var _result = await operations.VerifyFaceToPersonWithHttpMessagesAsync(faceId, personId, personGr |
| | 387 | | { |
| 8 | 388 | | return _result.Body; |
| | 389 | | } |
| 8 | 390 | | } |
| | 391 | |
|
| | 392 | | /// <summary> |
| | 393 | | /// Detect human faces in an image, return face rectangles, and optionally with |
| | 394 | | /// faceIds, landmarks, and attributes.<br /> |
| | 395 | | /// * No image will be stored. Only the extracted face feature will be stored |
| | 396 | | /// on server. The faceId is an identifier of the face feature and will be used |
| | 397 | | /// in [Face - |
| | 398 | | /// Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239), |
| | 399 | | /// [Face - |
| | 400 | | /// Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a), |
| | 401 | | /// and [Face - Find |
| | 402 | | /// Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). |
| | 403 | | /// The stored face feature(s) will expire and be deleted 24 hours after the |
| | 404 | | /// original detection call. |
| | 405 | | /// * Optional parameters include faceId, landmarks, and attributes. Attributes |
| | 406 | | /// include age, gender, headPose, smile, facialHair, glasses, emotion, hair, |
| | 407 | | /// makeup, occlusion, accessories, blur, exposure and noise. Some of the |
| | 408 | | /// results returned for specific attributes may not be highly accurate. |
| | 409 | | /// * JPEG, PNG, GIF (the first frame), and BMP format are supported. The |
| | 410 | | /// allowed image file size is from 1KB to 6MB. |
| | 411 | | /// * Up to 100 faces can be returned for an image. Faces are ranked by face |
| | 412 | | /// rectangle size from large to small. |
| | 413 | | /// * For optimal results when querying [Face - |
| | 414 | | /// Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239), |
| | 415 | | /// [Face - |
| | 416 | | /// Verify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523a), |
| | 417 | | /// and [Face - Find |
| | 418 | | /// Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237) |
| | 419 | | /// ('returnFaceId' is true), please use faces that are: frontal, clear, and |
| | 420 | | /// with a minimum size of 200x200 pixels (100 pixels between eyes). |
| | 421 | | /// * The minimum detectable face size is 36x36 pixels in an image no larger |
| | 422 | | /// than 1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels |
| | 423 | | /// will need a proportionally larger minimum face size. |
| | 424 | | /// * Different 'detectionModel' values can be provided. To use and compare |
| | 425 | | /// different detection models, please refer to [How to specify a detection |
| | 426 | | /// model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-det |
| | 427 | | /// | Model | Recommended use-case(s) | |
| | 428 | | /// | ---------- | -------- | |
| | 429 | | /// | 'detection_01': | The default detection model for [Face - |
| | 430 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236). |
| | 431 | | /// Recommend for near frontal face detection. For scenarios with exceptionally |
| | 432 | | /// large angle (head-pose) faces, occluded faces or wrong image orientation, |
| | 433 | | /// the faces in such cases may not be detected. | |
| | 434 | | /// | 'detection_02': | Detection model released in 2019 May with improved |
| | 435 | | /// accuracy especially on small, side and blurry faces. | |
| | 436 | | /// |
| | 437 | | /// * Different 'recognitionModel' values are provided. If follow-up operations |
| | 438 | | /// like Verify, Identify, Find Similar are needed, please specify the |
| | 439 | | /// recognition model with 'recognitionModel' parameter. The default value for |
| | 440 | | /// 'recognitionModel' is 'recognition_01', if latest model needed, please |
| | 441 | | /// explicitly specify the model you need in this parameter. Once specified, |
| | 442 | | /// the detected faceIds will be associated with the specified recognition |
| | 443 | | /// model. More details, please refer to [How to specify a recognition |
| | 444 | | /// model](https://docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-rec |
| | 445 | | /// | Model | Recommended use-case(s) | |
| | 446 | | /// | ---------- | -------- | |
| | 447 | | /// | 'recognition_01': | The default recognition model for [Face - |
| | 448 | | /// Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236). |
| | 449 | | /// All those faceIds created before 2019 March are bonded with this |
| | 450 | | /// recognition model. | |
| | 451 | | /// | 'recognition_02': | Recognition model released in 2019 March. |
| | 452 | | /// 'recognition_02' is recommended since its overall accuracy is improved |
| | 453 | | /// compared with 'recognition_01'. | |
| | 454 | | /// </summary> |
| | 455 | | /// <param name='operations'> |
| | 456 | | /// The operations group for this extension method. |
| | 457 | | /// </param> |
| | 458 | | /// <param name='image'> |
| | 459 | | /// An image stream. |
| | 460 | | /// </param> |
| | 461 | | /// <param name='returnFaceId'> |
| | 462 | | /// A value indicating whether the operation should return faceIds of detected |
| | 463 | | /// faces. |
| | 464 | | /// </param> |
| | 465 | | /// <param name='returnFaceLandmarks'> |
| | 466 | | /// A value indicating whether the operation should return landmarks of the |
| | 467 | | /// detected faces. |
| | 468 | | /// </param> |
| | 469 | | /// <param name='returnFaceAttributes'> |
| | 470 | | /// Analyze and return the one or more specified face attributes in the |
| | 471 | | /// comma-separated string like "returnFaceAttributes=age,gender". Supported |
| | 472 | | /// face attributes include age, gender, headPose, smile, facialHair, glasses |
| | 473 | | /// and emotion. Note that each face attribute analysis has additional |
| | 474 | | /// computational and time cost. |
| | 475 | | /// </param> |
| | 476 | | /// <param name='recognitionModel'> |
| | 477 | | /// Name of recognition model. Recognition model is used when the face features |
| | 478 | | /// are extracted and associated with detected faceIds, (Large)FaceList or |
| | 479 | | /// (Large)PersonGroup. A recognition model name can be provided when |
| | 480 | | /// performing Face - Detect or (Large)FaceList - Create or (Large)PersonGroup |
| | 481 | | /// - Create. The default value is 'recognition_01', if latest model needed, |
| | 482 | | /// please explicitly specify the model you need. Possible values include: |
| | 483 | | /// 'recognition_01', 'recognition_02' |
| | 484 | | /// </param> |
| | 485 | | /// <param name='returnRecognitionModel'> |
| | 486 | | /// A value indicating whether the operation should return 'recognitionModel' |
| | 487 | | /// in response. |
| | 488 | | /// </param> |
| | 489 | | /// <param name='detectionModel'> |
| | 490 | | /// Name of detection model. Detection model is used to detect faces in the |
| | 491 | | /// submitted image. A detection model name can be provided when performing |
| | 492 | | /// Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add |
| | 493 | | /// Face. The default value is 'detection_01', if another model is needed, |
| | 494 | | /// please explicitly specify it. Possible values include: 'detection_01', |
| | 495 | | /// 'detection_02' |
| | 496 | | /// </param> |
| | 497 | | /// <param name='cancellationToken'> |
| | 498 | | /// The cancellation token. |
| | 499 | | /// </param> |
| | 500 | | public static async Task<IList<DetectedFace>> DetectWithStreamAsync(this IFaceOperations operations, Stream |
| | 501 | | { |
| 90 | 502 | | using (var _result = await operations.DetectWithStreamWithHttpMessagesAsync(image, returnFaceId, returnF |
| | 503 | | { |
| 90 | 504 | | return _result.Body; |
| | 505 | | } |
| 90 | 506 | | } |
| | 507 | |
|
| | 508 | | } |
| | 509 | | } |