| | 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.ComputerVision |
| | 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 ComputerVisionClient. |
| | 22 | | /// </summary> |
| | 23 | | public static partial class ComputerVisionClientExtensions |
| | 24 | | { |
| | 25 | | /// <summary> |
| | 26 | | /// This operation extracts a rich set of visual features based on the image |
| | 27 | | /// content. |
| | 28 | | /// Two input methods are supported -- (1) Uploading an image or (2) specifying |
| | 29 | | /// an image URL. Within your request, there is an optional parameter to allow |
| | 30 | | /// you to choose which features to return. By default, image categories are |
| | 31 | | /// returned in the response. |
| | 32 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 33 | | /// response will contain an error code and a message to help understand what |
| | 34 | | /// went wrong. |
| | 35 | | /// </summary> |
| | 36 | | /// <param name='operations'> |
| | 37 | | /// The operations group for this extension method. |
| | 38 | | /// </param> |
| | 39 | | /// <param name='url'> |
| | 40 | | /// Publicly reachable URL of an image. |
| | 41 | | /// </param> |
| | 42 | | /// <param name='visualFeatures'> |
| | 43 | | /// A string indicating what visual feature types to return. Multiple values |
| | 44 | | /// should be comma-separated. Valid visual feature types include: Categories - |
| | 45 | | /// categorizes image content according to a taxonomy defined in documentation. |
| | 46 | | /// Tags - tags the image with a detailed list of words related to the image |
| | 47 | | /// content. Description - describes the image content with a complete English |
| | 48 | | /// sentence. Faces - detects if faces are present. If present, generate |
| | 49 | | /// coordinates, gender and age. ImageType - detects if image is clipart or a |
| | 50 | | /// line drawing. Color - determines the accent color, dominant color, and |
| | 51 | | /// whether an image is black&white. Adult - detects if the image is |
| | 52 | | /// pornographic in nature (depicts nudity or a sex act), or is gory (depicts |
| | 53 | | /// extreme violence or blood). Sexually suggestive content (aka racy content) |
| | 54 | | /// is also detected. Objects - detects various objects within an image, |
| | 55 | | /// including the approximate location. The Objects argument is only available |
| | 56 | | /// in English. Brands - detects various brands within an image, including the |
| | 57 | | /// approximate location. The Brands argument is only available in English. |
| | 58 | | /// </param> |
| | 59 | | /// <param name='details'> |
| | 60 | | /// A string indicating which domain-specific details to return. Multiple |
| | 61 | | /// values should be comma-separated. Valid visual feature types include: |
| | 62 | | /// Celebrities - identifies celebrities if detected in the image, Landmarks - |
| | 63 | | /// identifies notable landmarks in the image. |
| | 64 | | /// </param> |
| | 65 | | /// <param name='language'> |
| | 66 | | /// The desired language for output generation. If this parameter is not |
| | 67 | | /// specified, the default value is &quot;en&quot;.Supported |
| | 68 | | /// languages:en - English, Default. es - Spanish, ja - Japanese, pt - |
| | 69 | | /// Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', |
| | 70 | | /// 'ja', 'pt', 'zh' |
| | 71 | | /// </param> |
| | 72 | | /// <param name='descriptionExclude'> |
| | 73 | | /// Turn off specified domain models when generating the description. |
| | 74 | | /// </param> |
| | 75 | | /// <param name='cancellationToken'> |
| | 76 | | /// The cancellation token. |
| | 77 | | /// </param> |
| | 78 | | public static async Task<ImageAnalysis> AnalyzeImageAsync(this IComputerVisionClient operations, string url, |
| | 79 | | { |
| 4 | 80 | | using (var _result = await operations.AnalyzeImageWithHttpMessagesAsync(url, visualFeatures, details, la |
| | 81 | | { |
| 2 | 82 | | return _result.Body; |
| | 83 | | } |
| 2 | 84 | | } |
| | 85 | |
|
| | 86 | | /// <summary> |
| | 87 | | /// This operation generates a description of an image in human readable |
| | 88 | | /// language with complete sentences. The description is based on a collection |
| | 89 | | /// of content tags, which are also returned by the operation. More than one |
| | 90 | | /// description can be generated for each image. Descriptions are ordered by |
| | 91 | | /// their confidence score. Descriptions may include results from celebrity and |
| | 92 | | /// landmark domain models, if applicable. |
| | 93 | | /// Two input methods are supported -- (1) Uploading an image or (2) specifying |
| | 94 | | /// an image URL. |
| | 95 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 96 | | /// response will contain an error code and a message to help understand what |
| | 97 | | /// went wrong. |
| | 98 | | /// </summary> |
| | 99 | | /// <param name='operations'> |
| | 100 | | /// The operations group for this extension method. |
| | 101 | | /// </param> |
| | 102 | | /// <param name='url'> |
| | 103 | | /// Publicly reachable URL of an image. |
| | 104 | | /// </param> |
| | 105 | | /// <param name='maxCandidates'> |
| | 106 | | /// Maximum number of candidate descriptions to be returned. The default is 1. |
| | 107 | | /// </param> |
| | 108 | | /// <param name='language'> |
| | 109 | | /// The desired language for output generation. If this parameter is not |
| | 110 | | /// specified, the default value is &quot;en&quot;.Supported |
| | 111 | | /// languages:en - English, Default. es - Spanish, ja - Japanese, pt - |
| | 112 | | /// Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', |
| | 113 | | /// 'ja', 'pt', 'zh' |
| | 114 | | /// </param> |
| | 115 | | /// <param name='descriptionExclude'> |
| | 116 | | /// Turn off specified domain models when generating the description. |
| | 117 | | /// </param> |
| | 118 | | /// <param name='cancellationToken'> |
| | 119 | | /// The cancellation token. |
| | 120 | | /// </param> |
| | 121 | | public static async Task<ImageDescription> DescribeImageAsync(this IComputerVisionClient operations, string |
| | 122 | | { |
| 4 | 123 | | using (var _result = await operations.DescribeImageWithHttpMessagesAsync(url, maxCandidates, language, d |
| | 124 | | { |
| 4 | 125 | | return _result.Body; |
| | 126 | | } |
| 4 | 127 | | } |
| | 128 | |
|
| | 129 | | /// <summary> |
| | 130 | | /// Performs object detection on the specified image. |
| | 131 | | /// Two input methods are supported -- (1) Uploading an image or (2) specifying |
| | 132 | | /// an image URL. |
| | 133 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 134 | | /// response will contain an error code and a message to help understand what |
| | 135 | | /// went wrong. |
| | 136 | | /// </summary> |
| | 137 | | /// <param name='operations'> |
| | 138 | | /// The operations group for this extension method. |
| | 139 | | /// </param> |
| | 140 | | /// <param name='url'> |
| | 141 | | /// Publicly reachable URL of an image. |
| | 142 | | /// </param> |
| | 143 | | /// <param name='cancellationToken'> |
| | 144 | | /// The cancellation token. |
| | 145 | | /// </param> |
| | 146 | | public static async Task<DetectResult> DetectObjectsAsync(this IComputerVisionClient operations, string url, |
| | 147 | | { |
| 2 | 148 | | using (var _result = await operations.DetectObjectsWithHttpMessagesAsync(url, null, cancellationToken).C |
| | 149 | | { |
| 2 | 150 | | return _result.Body; |
| | 151 | | } |
| 2 | 152 | | } |
| | 153 | |
|
| | 154 | | /// <summary> |
| | 155 | | /// This operation returns the list of domain-specific models that are |
| | 156 | | /// supported by the Computer Vision API. Currently, the API supports following |
| | 157 | | /// domain-specific models: celebrity recognizer, landmark recognizer. |
| | 158 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 159 | | /// response will contain an error code and a message to help understand what |
| | 160 | | /// went wrong. |
| | 161 | | /// </summary> |
| | 162 | | /// <param name='operations'> |
| | 163 | | /// The operations group for this extension method. |
| | 164 | | /// </param> |
| | 165 | | /// <param name='cancellationToken'> |
| | 166 | | /// The cancellation token. |
| | 167 | | /// </param> |
| | 168 | | public static async Task<ListModelsResult> ListModelsAsync(this IComputerVisionClient operations, Cancellati |
| | 169 | | { |
| 0 | 170 | | using (var _result = await operations.ListModelsWithHttpMessagesAsync(null, cancellationToken).Configure |
| | 171 | | { |
| 0 | 172 | | return _result.Body; |
| | 173 | | } |
| 0 | 174 | | } |
| | 175 | |
|
| | 176 | | /// <summary> |
| | 177 | | /// This operation recognizes content within an image by applying a |
| | 178 | | /// domain-specific model. The list of domain-specific models that are |
| | 179 | | /// supported by the Computer Vision API can be retrieved using the /models GET |
| | 180 | | /// request. Currently, the API provides following domain-specific models: |
| | 181 | | /// celebrities, landmarks. |
| | 182 | | /// Two input methods are supported -- (1) Uploading an image or (2) specifying |
| | 183 | | /// an image URL. |
| | 184 | | /// A successful response will be returned in JSON. |
| | 185 | | /// If the request failed, the response will contain an error code and a |
| | 186 | | /// message to help understand what went wrong. |
| | 187 | | /// </summary> |
| | 188 | | /// <param name='operations'> |
| | 189 | | /// The operations group for this extension method. |
| | 190 | | /// </param> |
| | 191 | | /// <param name='model'> |
| | 192 | | /// The domain-specific content to recognize. |
| | 193 | | /// </param> |
| | 194 | | /// <param name='url'> |
| | 195 | | /// Publicly reachable URL of an image. |
| | 196 | | /// </param> |
| | 197 | | /// <param name='language'> |
| | 198 | | /// The desired language for output generation. If this parameter is not |
| | 199 | | /// specified, the default value is &quot;en&quot;.Supported |
| | 200 | | /// languages:en - English, Default. es - Spanish, ja - Japanese, pt - |
| | 201 | | /// Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', |
| | 202 | | /// 'ja', 'pt', 'zh' |
| | 203 | | /// </param> |
| | 204 | | /// <param name='cancellationToken'> |
| | 205 | | /// The cancellation token. |
| | 206 | | /// </param> |
| | 207 | | public static async Task<DomainModelResults> AnalyzeImageByDomainAsync(this IComputerVisionClient operations |
| | 208 | | { |
| 4 | 209 | | using (var _result = await operations.AnalyzeImageByDomainWithHttpMessagesAsync(model, url, language, nu |
| | 210 | | { |
| 4 | 211 | | return _result.Body; |
| | 212 | | } |
| 4 | 213 | | } |
| | 214 | |
|
| | 215 | | /// <summary> |
| | 216 | | /// Optical Character Recognition (OCR) detects text in an image and extracts |
| | 217 | | /// the recognized characters into a machine-usable character stream. |
| | 218 | | /// Upon success, the OCR results will be returned. |
| | 219 | | /// Upon failure, the error code together with an error message will be |
| | 220 | | /// returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, |
| | 221 | | /// InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or |
| | 222 | | /// InternalServerError. |
| | 223 | | /// </summary> |
| | 224 | | /// <param name='operations'> |
| | 225 | | /// The operations group for this extension method. |
| | 226 | | /// </param> |
| | 227 | | /// <param name='detectOrientation'> |
| | 228 | | /// Whether detect the text orientation in the image. With |
| | 229 | | /// detectOrientation=true the OCR service tries to detect the image |
| | 230 | | /// orientation and correct it before further processing (e.g. if it's |
| | 231 | | /// upside-down). |
| | 232 | | /// </param> |
| | 233 | | /// <param name='url'> |
| | 234 | | /// Publicly reachable URL of an image. |
| | 235 | | /// </param> |
| | 236 | | /// <param name='language'> |
| | 237 | | /// The BCP-47 language code of the text to be detected in the image. The |
| | 238 | | /// default value is 'unk'. Possible values include: 'unk', 'zh-Hans', |
| | 239 | | /// 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', 'el', 'hu', 'it', |
| | 240 | | /// 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', 'tr', 'ar', 'ro', |
| | 241 | | /// 'sr-Cyrl', 'sr-Latn', 'sk' |
| | 242 | | /// </param> |
| | 243 | | /// <param name='cancellationToken'> |
| | 244 | | /// The cancellation token. |
| | 245 | | /// </param> |
| | 246 | | public static async Task<OcrResult> RecognizePrintedTextAsync(this IComputerVisionClient operations, bool de |
| | 247 | | { |
| 2 | 248 | | using (var _result = await operations.RecognizePrintedTextWithHttpMessagesAsync(detectOrientation, url, |
| | 249 | | { |
| 2 | 250 | | return _result.Body; |
| | 251 | | } |
| 2 | 252 | | } |
| | 253 | |
|
| | 254 | | /// <summary> |
| | 255 | | /// This operation generates a list of words, or tags, that are relevant to the |
| | 256 | | /// content of the supplied image. The Computer Vision API can return tags |
| | 257 | | /// based on objects, living beings, scenery or actions found in images. Unlike |
| | 258 | | /// categories, tags are not organized according to a hierarchical |
| | 259 | | /// classification system, but correspond to image content. Tags may contain |
| | 260 | | /// hints to avoid ambiguity or provide context, for example the tag |
| | 261 | | /// "ascomycete" may be accompanied by the hint "fungus". |
| | 262 | | /// Two input methods are supported -- (1) Uploading an image or (2) specifying |
| | 263 | | /// an image URL. |
| | 264 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 265 | | /// response will contain an error code and a message to help understand what |
| | 266 | | /// went wrong. |
| | 267 | | /// </summary> |
| | 268 | | /// <param name='operations'> |
| | 269 | | /// The operations group for this extension method. |
| | 270 | | /// </param> |
| | 271 | | /// <param name='url'> |
| | 272 | | /// Publicly reachable URL of an image. |
| | 273 | | /// </param> |
| | 274 | | /// <param name='language'> |
| | 275 | | /// The desired language for output generation. If this parameter is not |
| | 276 | | /// specified, the default value is &quot;en&quot;.Supported |
| | 277 | | /// languages:en - English, Default. es - Spanish, ja - Japanese, pt - |
| | 278 | | /// Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', |
| | 279 | | /// 'ja', 'pt', 'zh' |
| | 280 | | /// </param> |
| | 281 | | /// <param name='cancellationToken'> |
| | 282 | | /// The cancellation token. |
| | 283 | | /// </param> |
| | 284 | | public static async Task<TagResult> TagImageAsync(this IComputerVisionClient operations, string url, string |
| | 285 | | { |
| 2 | 286 | | using (var _result = await operations.TagImageWithHttpMessagesAsync(url, language, null, cancellationTok |
| | 287 | | { |
| 2 | 288 | | return _result.Body; |
| | 289 | | } |
| 2 | 290 | | } |
| | 291 | |
|
| | 292 | | /// <summary> |
| | 293 | | /// This operation generates a thumbnail image with the user-specified width |
| | 294 | | /// and height. By default, the service analyzes the image, identifies the |
| | 295 | | /// region of interest (ROI), and generates smart cropping coordinates based on |
| | 296 | | /// the ROI. Smart cropping helps when you specify an aspect ratio that differs |
| | 297 | | /// from that of the input image. |
| | 298 | | /// A successful response contains the thumbnail image binary. If the request |
| | 299 | | /// failed, the response contains an error code and a message to help determine |
| | 300 | | /// what went wrong. |
| | 301 | | /// Upon failure, the error code and an error message are returned. The error |
| | 302 | | /// code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, |
| | 303 | | /// InvalidThumbnailSize, NotSupportedImage, FailedToProcess, Timeout, or |
| | 304 | | /// InternalServerError. |
| | 305 | | /// </summary> |
| | 306 | | /// <param name='operations'> |
| | 307 | | /// The operations group for this extension method. |
| | 308 | | /// </param> |
| | 309 | | /// <param name='width'> |
| | 310 | | /// Width of the thumbnail, in pixels. It must be between 1 and 1024. |
| | 311 | | /// Recommended minimum of 50. |
| | 312 | | /// </param> |
| | 313 | | /// <param name='height'> |
| | 314 | | /// Height of the thumbnail, in pixels. It must be between 1 and 1024. |
| | 315 | | /// Recommended minimum of 50. |
| | 316 | | /// </param> |
| | 317 | | /// <param name='url'> |
| | 318 | | /// Publicly reachable URL of an image. |
| | 319 | | /// </param> |
| | 320 | | /// <param name='smartCropping'> |
| | 321 | | /// Boolean flag for enabling smart cropping. |
| | 322 | | /// </param> |
| | 323 | | /// <param name='cancellationToken'> |
| | 324 | | /// The cancellation token. |
| | 325 | | /// </param> |
| | 326 | | public static async Task<Stream> GenerateThumbnailAsync(this IComputerVisionClient operations, int width, in |
| | 327 | | { |
| 10 | 328 | | var _result = await operations.GenerateThumbnailWithHttpMessagesAsync(width, height, url, smartCropping, |
| 2 | 329 | | _result.Request.Dispose(); |
| 2 | 330 | | return _result.Body; |
| 2 | 331 | | } |
| | 332 | |
|
| | 333 | | /// <summary> |
| | 334 | | /// This operation returns a bounding box around the most important area of the |
| | 335 | | /// image. |
| | 336 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 337 | | /// response contains an error code and a message to help determine what went |
| | 338 | | /// wrong. |
| | 339 | | /// Upon failure, the error code and an error message are returned. The error |
| | 340 | | /// code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, |
| | 341 | | /// NotSupportedImage, FailedToProcess, Timeout, or InternalServerError. |
| | 342 | | /// </summary> |
| | 343 | | /// <param name='operations'> |
| | 344 | | /// The operations group for this extension method. |
| | 345 | | /// </param> |
| | 346 | | /// <param name='url'> |
| | 347 | | /// Publicly reachable URL of an image. |
| | 348 | | /// </param> |
| | 349 | | /// <param name='cancellationToken'> |
| | 350 | | /// The cancellation token. |
| | 351 | | /// </param> |
| | 352 | | public static async Task<AreaOfInterestResult> GetAreaOfInterestAsync(this IComputerVisionClient operations, |
| | 353 | | { |
| 2 | 354 | | using (var _result = await operations.GetAreaOfInterestWithHttpMessagesAsync(url, null, cancellationToke |
| | 355 | | { |
| 2 | 356 | | return _result.Body; |
| | 357 | | } |
| 2 | 358 | | } |
| | 359 | |
|
| | 360 | | /// <summary> |
| | 361 | | /// This operation extracts a rich set of visual features based on the image |
| | 362 | | /// content. |
| | 363 | | /// Two input methods are supported -- (1) Uploading an image or (2) specifying |
| | 364 | | /// an image URL. Within your request, there is an optional parameter to allow |
| | 365 | | /// you to choose which features to return. By default, image categories are |
| | 366 | | /// returned in the response. |
| | 367 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 368 | | /// response will contain an error code and a message to help understand what |
| | 369 | | /// went wrong. |
| | 370 | | /// </summary> |
| | 371 | | /// <param name='operations'> |
| | 372 | | /// The operations group for this extension method. |
| | 373 | | /// </param> |
| | 374 | | /// <param name='image'> |
| | 375 | | /// An image stream. |
| | 376 | | /// </param> |
| | 377 | | /// <param name='visualFeatures'> |
| | 378 | | /// A string indicating what visual feature types to return. Multiple values |
| | 379 | | /// should be comma-separated. Valid visual feature types include: Categories - |
| | 380 | | /// categorizes image content according to a taxonomy defined in documentation. |
| | 381 | | /// Tags - tags the image with a detailed list of words related to the image |
| | 382 | | /// content. Description - describes the image content with a complete English |
| | 383 | | /// sentence. Faces - detects if faces are present. If present, generate |
| | 384 | | /// coordinates, gender and age. ImageType - detects if image is clipart or a |
| | 385 | | /// line drawing. Color - determines the accent color, dominant color, and |
| | 386 | | /// whether an image is black&white. Adult - detects if the image is |
| | 387 | | /// pornographic in nature (depicts nudity or a sex act), or is gory (depicts |
| | 388 | | /// extreme violence or blood). Sexually suggestive content (aka racy content) |
| | 389 | | /// is also detected. Objects - detects various objects within an image, |
| | 390 | | /// including the approximate location. The Objects argument is only available |
| | 391 | | /// in English. Brands - detects various brands within an image, including the |
| | 392 | | /// approximate location. The Brands argument is only available in English. |
| | 393 | | /// </param> |
| | 394 | | /// <param name='details'> |
| | 395 | | /// A string indicating which domain-specific details to return. Multiple |
| | 396 | | /// values should be comma-separated. Valid visual feature types include: |
| | 397 | | /// Celebrities - identifies celebrities if detected in the image, Landmarks - |
| | 398 | | /// identifies notable landmarks in the image. |
| | 399 | | /// </param> |
| | 400 | | /// <param name='language'> |
| | 401 | | /// The desired language for output generation. If this parameter is not |
| | 402 | | /// specified, the default value is &quot;en&quot;.Supported |
| | 403 | | /// languages:en - English, Default. es - Spanish, ja - Japanese, pt - |
| | 404 | | /// Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', |
| | 405 | | /// 'ja', 'pt', 'zh' |
| | 406 | | /// </param> |
| | 407 | | /// <param name='descriptionExclude'> |
| | 408 | | /// Turn off specified domain models when generating the description. |
| | 409 | | /// </param> |
| | 410 | | /// <param name='cancellationToken'> |
| | 411 | | /// The cancellation token. |
| | 412 | | /// </param> |
| | 413 | | public static async Task<ImageAnalysis> AnalyzeImageInStreamAsync(this IComputerVisionClient operations, Str |
| | 414 | | { |
| 2 | 415 | | using (var _result = await operations.AnalyzeImageInStreamWithHttpMessagesAsync(image, visualFeatures, d |
| | 416 | | { |
| 2 | 417 | | return _result.Body; |
| | 418 | | } |
| 2 | 419 | | } |
| | 420 | |
|
| | 421 | | /// <summary> |
| | 422 | | /// This operation returns a bounding box around the most important area of the |
| | 423 | | /// image. |
| | 424 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 425 | | /// response contains an error code and a message to help determine what went |
| | 426 | | /// wrong. |
| | 427 | | /// Upon failure, the error code and an error message are returned. The error |
| | 428 | | /// code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, |
| | 429 | | /// NotSupportedImage, FailedToProcess, Timeout, or InternalServerError. |
| | 430 | | /// </summary> |
| | 431 | | /// <param name='operations'> |
| | 432 | | /// The operations group for this extension method. |
| | 433 | | /// </param> |
| | 434 | | /// <param name='image'> |
| | 435 | | /// An image stream. |
| | 436 | | /// </param> |
| | 437 | | /// <param name='cancellationToken'> |
| | 438 | | /// The cancellation token. |
| | 439 | | /// </param> |
| | 440 | | public static async Task<AreaOfInterestResult> GetAreaOfInterestInStreamAsync(this IComputerVisionClient ope |
| | 441 | | { |
| 4 | 442 | | using (var _result = await operations.GetAreaOfInterestInStreamWithHttpMessagesAsync(image, null, cancel |
| | 443 | | { |
| 4 | 444 | | return _result.Body; |
| | 445 | | } |
| 4 | 446 | | } |
| | 447 | |
|
| | 448 | | /// <summary> |
| | 449 | | /// This operation generates a description of an image in human readable |
| | 450 | | /// language with complete sentences. The description is based on a collection |
| | 451 | | /// of content tags, which are also returned by the operation. More than one |
| | 452 | | /// description can be generated for each image. Descriptions are ordered by |
| | 453 | | /// their confidence score. Descriptions may include results from celebrity and |
| | 454 | | /// landmark domain models, if applicable. |
| | 455 | | /// Two input methods are supported -- (1) Uploading an image or (2) specifying |
| | 456 | | /// an image URL. |
| | 457 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 458 | | /// response will contain an error code and a message to help understand what |
| | 459 | | /// went wrong. |
| | 460 | | /// </summary> |
| | 461 | | /// <param name='operations'> |
| | 462 | | /// The operations group for this extension method. |
| | 463 | | /// </param> |
| | 464 | | /// <param name='image'> |
| | 465 | | /// An image stream. |
| | 466 | | /// </param> |
| | 467 | | /// <param name='maxCandidates'> |
| | 468 | | /// Maximum number of candidate descriptions to be returned. The default is 1. |
| | 469 | | /// </param> |
| | 470 | | /// <param name='language'> |
| | 471 | | /// The desired language for output generation. If this parameter is not |
| | 472 | | /// specified, the default value is &quot;en&quot;.Supported |
| | 473 | | /// languages:en - English, Default. es - Spanish, ja - Japanese, pt - |
| | 474 | | /// Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', |
| | 475 | | /// 'ja', 'pt', 'zh' |
| | 476 | | /// </param> |
| | 477 | | /// <param name='descriptionExclude'> |
| | 478 | | /// Turn off specified domain models when generating the description. |
| | 479 | | /// </param> |
| | 480 | | /// <param name='cancellationToken'> |
| | 481 | | /// The cancellation token. |
| | 482 | | /// </param> |
| | 483 | | public static async Task<ImageDescription> DescribeImageInStreamAsync(this IComputerVisionClient operations, |
| | 484 | | { |
| 2 | 485 | | using (var _result = await operations.DescribeImageInStreamWithHttpMessagesAsync(image, maxCandidates, l |
| | 486 | | { |
| 2 | 487 | | return _result.Body; |
| | 488 | | } |
| 2 | 489 | | } |
| | 490 | |
|
| | 491 | | /// <summary> |
| | 492 | | /// Performs object detection on the specified image. |
| | 493 | | /// Two input methods are supported -- (1) Uploading an image or (2) specifying |
| | 494 | | /// an image URL. |
| | 495 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 496 | | /// response will contain an error code and a message to help understand what |
| | 497 | | /// went wrong. |
| | 498 | | /// </summary> |
| | 499 | | /// <param name='operations'> |
| | 500 | | /// The operations group for this extension method. |
| | 501 | | /// </param> |
| | 502 | | /// <param name='image'> |
| | 503 | | /// An image stream. |
| | 504 | | /// </param> |
| | 505 | | /// <param name='cancellationToken'> |
| | 506 | | /// The cancellation token. |
| | 507 | | /// </param> |
| | 508 | | public static async Task<DetectResult> DetectObjectsInStreamAsync(this IComputerVisionClient operations, Str |
| | 509 | | { |
| 2 | 510 | | using (var _result = await operations.DetectObjectsInStreamWithHttpMessagesAsync(image, null, cancellati |
| | 511 | | { |
| 2 | 512 | | return _result.Body; |
| | 513 | | } |
| 2 | 514 | | } |
| | 515 | |
|
| | 516 | | /// <summary> |
| | 517 | | /// This operation generates a thumbnail image with the user-specified width |
| | 518 | | /// and height. By default, the service analyzes the image, identifies the |
| | 519 | | /// region of interest (ROI), and generates smart cropping coordinates based on |
| | 520 | | /// the ROI. Smart cropping helps when you specify an aspect ratio that differs |
| | 521 | | /// from that of the input image. |
| | 522 | | /// A successful response contains the thumbnail image binary. If the request |
| | 523 | | /// failed, the response contains an error code and a message to help determine |
| | 524 | | /// what went wrong. |
| | 525 | | /// Upon failure, the error code and an error message are returned. The error |
| | 526 | | /// code could be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, |
| | 527 | | /// InvalidThumbnailSize, NotSupportedImage, FailedToProcess, Timeout, or |
| | 528 | | /// InternalServerError. |
| | 529 | | /// </summary> |
| | 530 | | /// <param name='operations'> |
| | 531 | | /// The operations group for this extension method. |
| | 532 | | /// </param> |
| | 533 | | /// <param name='width'> |
| | 534 | | /// Width of the thumbnail, in pixels. It must be between 1 and 1024. |
| | 535 | | /// Recommended minimum of 50. |
| | 536 | | /// </param> |
| | 537 | | /// <param name='height'> |
| | 538 | | /// Height of the thumbnail, in pixels. It must be between 1 and 1024. |
| | 539 | | /// Recommended minimum of 50. |
| | 540 | | /// </param> |
| | 541 | | /// <param name='image'> |
| | 542 | | /// An image stream. |
| | 543 | | /// </param> |
| | 544 | | /// <param name='smartCropping'> |
| | 545 | | /// Boolean flag for enabling smart cropping. |
| | 546 | | /// </param> |
| | 547 | | /// <param name='cancellationToken'> |
| | 548 | | /// The cancellation token. |
| | 549 | | /// </param> |
| | 550 | | public static async Task<Stream> GenerateThumbnailInStreamAsync(this IComputerVisionClient operations, int w |
| | 551 | | { |
| 2 | 552 | | var _result = await operations.GenerateThumbnailInStreamWithHttpMessagesAsync(width, height, image, smar |
| 2 | 553 | | _result.Request.Dispose(); |
| 2 | 554 | | return _result.Body; |
| 2 | 555 | | } |
| | 556 | |
|
| | 557 | | /// <summary> |
| | 558 | | /// This operation recognizes content within an image by applying a |
| | 559 | | /// domain-specific model. The list of domain-specific models that are |
| | 560 | | /// supported by the Computer Vision API can be retrieved using the /models GET |
| | 561 | | /// request. Currently, the API provides following domain-specific models: |
| | 562 | | /// celebrities, landmarks. |
| | 563 | | /// Two input methods are supported -- (1) Uploading an image or (2) specifying |
| | 564 | | /// an image URL. |
| | 565 | | /// A successful response will be returned in JSON. |
| | 566 | | /// If the request failed, the response will contain an error code and a |
| | 567 | | /// message to help understand what went wrong. |
| | 568 | | /// </summary> |
| | 569 | | /// <param name='operations'> |
| | 570 | | /// The operations group for this extension method. |
| | 571 | | /// </param> |
| | 572 | | /// <param name='model'> |
| | 573 | | /// The domain-specific content to recognize. |
| | 574 | | /// </param> |
| | 575 | | /// <param name='image'> |
| | 576 | | /// An image stream. |
| | 577 | | /// </param> |
| | 578 | | /// <param name='language'> |
| | 579 | | /// The desired language for output generation. If this parameter is not |
| | 580 | | /// specified, the default value is &quot;en&quot;.Supported |
| | 581 | | /// languages:en - English, Default. es - Spanish, ja - Japanese, pt - |
| | 582 | | /// Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', |
| | 583 | | /// 'ja', 'pt', 'zh' |
| | 584 | | /// </param> |
| | 585 | | /// <param name='cancellationToken'> |
| | 586 | | /// The cancellation token. |
| | 587 | | /// </param> |
| | 588 | | public static async Task<DomainModelResults> AnalyzeImageByDomainInStreamAsync(this IComputerVisionClient op |
| | 589 | | { |
| 2 | 590 | | using (var _result = await operations.AnalyzeImageByDomainInStreamWithHttpMessagesAsync(model, image, la |
| | 591 | | { |
| 2 | 592 | | return _result.Body; |
| | 593 | | } |
| 2 | 594 | | } |
| | 595 | |
|
| | 596 | | /// <summary> |
| | 597 | | /// Optical Character Recognition (OCR) detects text in an image and extracts |
| | 598 | | /// the recognized characters into a machine-usable character stream. |
| | 599 | | /// Upon success, the OCR results will be returned. |
| | 600 | | /// Upon failure, the error code together with an error message will be |
| | 601 | | /// returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, |
| | 602 | | /// InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or |
| | 603 | | /// InternalServerError. |
| | 604 | | /// </summary> |
| | 605 | | /// <param name='operations'> |
| | 606 | | /// The operations group for this extension method. |
| | 607 | | /// </param> |
| | 608 | | /// <param name='detectOrientation'> |
| | 609 | | /// Whether detect the text orientation in the image. With |
| | 610 | | /// detectOrientation=true the OCR service tries to detect the image |
| | 611 | | /// orientation and correct it before further processing (e.g. if it's |
| | 612 | | /// upside-down). |
| | 613 | | /// </param> |
| | 614 | | /// <param name='image'> |
| | 615 | | /// An image stream. |
| | 616 | | /// </param> |
| | 617 | | /// <param name='language'> |
| | 618 | | /// The BCP-47 language code of the text to be detected in the image. The |
| | 619 | | /// default value is 'unk'. Possible values include: 'unk', 'zh-Hans', |
| | 620 | | /// 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', 'el', 'hu', 'it', |
| | 621 | | /// 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', 'tr', 'ar', 'ro', |
| | 622 | | /// 'sr-Cyrl', 'sr-Latn', 'sk' |
| | 623 | | /// </param> |
| | 624 | | /// <param name='cancellationToken'> |
| | 625 | | /// The cancellation token. |
| | 626 | | /// </param> |
| | 627 | | public static async Task<OcrResult> RecognizePrintedTextInStreamAsync(this IComputerVisionClient operations, |
| | 628 | | { |
| 2 | 629 | | using (var _result = await operations.RecognizePrintedTextInStreamWithHttpMessagesAsync(detectOrientatio |
| | 630 | | { |
| 2 | 631 | | return _result.Body; |
| | 632 | | } |
| 2 | 633 | | } |
| | 634 | |
|
| | 635 | | /// <summary> |
| | 636 | | /// This operation generates a list of words, or tags, that are relevant to the |
| | 637 | | /// content of the supplied image. The Computer Vision API can return tags |
| | 638 | | /// based on objects, living beings, scenery or actions found in images. Unlike |
| | 639 | | /// categories, tags are not organized according to a hierarchical |
| | 640 | | /// classification system, but correspond to image content. Tags may contain |
| | 641 | | /// hints to avoid ambiguity or provide context, for example the tag |
| | 642 | | /// "ascomycete" may be accompanied by the hint "fungus". |
| | 643 | | /// Two input methods are supported -- (1) Uploading an image or (2) specifying |
| | 644 | | /// an image URL. |
| | 645 | | /// A successful response will be returned in JSON. If the request failed, the |
| | 646 | | /// response will contain an error code and a message to help understand what |
| | 647 | | /// went wrong. |
| | 648 | | /// </summary> |
| | 649 | | /// <param name='operations'> |
| | 650 | | /// The operations group for this extension method. |
| | 651 | | /// </param> |
| | 652 | | /// <param name='image'> |
| | 653 | | /// An image stream. |
| | 654 | | /// </param> |
| | 655 | | /// <param name='language'> |
| | 656 | | /// The desired language for output generation. If this parameter is not |
| | 657 | | /// specified, the default value is &quot;en&quot;.Supported |
| | 658 | | /// languages:en - English, Default. es - Spanish, ja - Japanese, pt - |
| | 659 | | /// Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', |
| | 660 | | /// 'ja', 'pt', 'zh' |
| | 661 | | /// </param> |
| | 662 | | /// <param name='cancellationToken'> |
| | 663 | | /// The cancellation token. |
| | 664 | | /// </param> |
| | 665 | | public static async Task<TagResult> TagImageInStreamAsync(this IComputerVisionClient operations, Stream imag |
| | 666 | | { |
| 2 | 667 | | using (var _result = await operations.TagImageInStreamWithHttpMessagesAsync(image, language, null, cance |
| | 668 | | { |
| 2 | 669 | | return _result.Body; |
| | 670 | | } |
| 2 | 671 | | } |
| | 672 | |
|
| | 673 | | /// <summary> |
| | 674 | | /// Use this interface to get the result of a Read operation, employing the |
| | 675 | | /// state-of-the-art Optical Character Recognition (OCR) algorithms optimized |
| | 676 | | /// for text-heavy documents. When you use the Read interface, the response |
| | 677 | | /// contains a field called 'Operation-Location'. The 'Operation-Location' |
| | 678 | | /// field contains the URL that you must use for your 'GetReadResult' operation |
| | 679 | | /// to access OCR results. |
| | 680 | | /// </summary> |
| | 681 | | /// <param name='operations'> |
| | 682 | | /// The operations group for this extension method. |
| | 683 | | /// </param> |
| | 684 | | /// <param name='url'> |
| | 685 | | /// Publicly reachable URL of an image. |
| | 686 | | /// </param> |
| | 687 | | /// <param name='language'> |
| | 688 | | /// The BCP-47 language code of the text in the document. Currently, only |
| | 689 | | /// English ('en'), Dutch (‘nl’), French (‘fr’), German (‘de’), Italian (‘it’), |
| | 690 | | /// Portuguese (‘pt), and Spanish ('es') are supported. Read supports auto |
| | 691 | | /// language identification and multilanguage documents, so only provide a |
| | 692 | | /// language code if you would like to force the documented to be processed as |
| | 693 | | /// that specific language. Possible values include: 'en', 'es', 'fr', 'de', |
| | 694 | | /// 'it', 'nl', 'pt' |
| | 695 | | /// </param> |
| | 696 | | /// <param name='cancellationToken'> |
| | 697 | | /// The cancellation token. |
| | 698 | | /// </param> |
| | 699 | | public static async Task<ReadHeaders> ReadAsync(this IComputerVisionClient operations, string url, string la |
| | 700 | | { |
| 0 | 701 | | using (var _result = await operations.ReadWithHttpMessagesAsync(url, language, null, cancellationToken). |
| | 702 | | { |
| 0 | 703 | | return _result.Headers; |
| | 704 | | } |
| 0 | 705 | | } |
| | 706 | |
|
| | 707 | | /// <summary> |
| | 708 | | /// This interface is used for getting OCR results of Read operation. The URL |
| | 709 | | /// to this interface should be retrieved from 'Operation-Location' field |
| | 710 | | /// returned from Read interface. |
| | 711 | | /// </summary> |
| | 712 | | /// <param name='operations'> |
| | 713 | | /// The operations group for this extension method. |
| | 714 | | /// </param> |
| | 715 | | /// <param name='operationId'> |
| | 716 | | /// Id of read operation returned in the response of the 'Read' interface. |
| | 717 | | /// </param> |
| | 718 | | /// <param name='cancellationToken'> |
| | 719 | | /// The cancellation token. |
| | 720 | | /// </param> |
| | 721 | | public static async Task<ReadOperationResult> GetReadResultAsync(this IComputerVisionClient operations, Syst |
| | 722 | | { |
| 0 | 723 | | using (var _result = await operations.GetReadResultWithHttpMessagesAsync(operationId, null, cancellation |
| | 724 | | { |
| 0 | 725 | | return _result.Body; |
| | 726 | | } |
| 0 | 727 | | } |
| | 728 | |
|
| | 729 | | /// <summary> |
| | 730 | | /// Use this interface to get the result of a Read operation, employing the |
| | 731 | | /// state-of-the-art Optical Character Recognition (OCR) algorithms optimized |
| | 732 | | /// for text-heavy documents. When you use the Read interface, the response |
| | 733 | | /// contains a field called 'Operation-Location'. The 'Operation-Location' |
| | 734 | | /// field contains the URL that you must use for your 'GetReadResult' operation |
| | 735 | | /// to access OCR results. |
| | 736 | | /// </summary> |
| | 737 | | /// <param name='operations'> |
| | 738 | | /// The operations group for this extension method. |
| | 739 | | /// </param> |
| | 740 | | /// <param name='image'> |
| | 741 | | /// An image stream. |
| | 742 | | /// </param> |
| | 743 | | /// <param name='language'> |
| | 744 | | /// The BCP-47 language code of the text in the document. Currently, only |
| | 745 | | /// English ('en'), Dutch (‘nl’), French (‘fr’), German (‘de’), Italian (‘it’), |
| | 746 | | /// Portuguese (‘pt), and Spanish ('es') are supported. Read supports auto |
| | 747 | | /// language identification and multilanguage documents, so only provide a |
| | 748 | | /// language code if you would like to force the documented to be processed as |
| | 749 | | /// that specific language. Possible values include: 'en', 'es', 'fr', 'de', |
| | 750 | | /// 'it', 'nl', 'pt' |
| | 751 | | /// </param> |
| | 752 | | /// <param name='cancellationToken'> |
| | 753 | | /// The cancellation token. |
| | 754 | | /// </param> |
| | 755 | | public static async Task<ReadInStreamHeaders> ReadInStreamAsync(this IComputerVisionClient operations, Strea |
| | 756 | | { |
| 0 | 757 | | using (var _result = await operations.ReadInStreamWithHttpMessagesAsync(image, language, null, cancellat |
| | 758 | | { |
| 0 | 759 | | return _result.Headers; |
| | 760 | | } |
| 0 | 761 | | } |
| | 762 | |
|
| | 763 | | } |
| | 764 | | } |