diff --git a/azure-cognitiveservices-vision-computervision/MANIFEST.in b/azure-cognitiveservices-vision-computervision/MANIFEST.in index bb37a2723dae..e437a6594c1b 100644 --- a/azure-cognitiveservices-vision-computervision/MANIFEST.in +++ b/azure-cognitiveservices-vision-computervision/MANIFEST.in @@ -1 +1,5 @@ include *.rst +include azure/__init__.py +include azure/cognitiveservices/__init__.py +include azure/cognitiveservices/vision/__init__.py + diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/computer_vision_client.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/computer_vision_client.py index 949f9d69e590..a411c2f3c4fa 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/computer_vision_client.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/computer_vision_client.py @@ -22,7 +22,7 @@ class ComputerVisionClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Supported Cognitive Services endpoints + :param endpoint: Supported Cognitive Services endpoints. :type endpoint: str :param credentials: Subscription credentials which uniquely identify client subscription. @@ -52,7 +52,7 @@ class ComputerVisionClient(SDKClient): :ivar config: Configuration for client. :vartype config: ComputerVisionClientConfiguration - :param endpoint: Supported Cognitive Services endpoints + :param endpoint: Supported Cognitive Services endpoints. :type endpoint: str :param credentials: Subscription credentials which uniquely identify client subscription. @@ -71,29 +71,65 @@ def __init__( self._deserialize = Deserializer(client_models) - def list_models( - self, custom_headers=None, raw=False, **operation_config): - """This operation returns the list of domain-specific models that are - supported by the Computer Vision API. Currently, the API only supports - one domain-specific model: a celebrity recognizer. A successful - response will be returned in JSON. If the request failed, the response - will contain an error code and a message to help understand what went - wrong. - + def analyze_image( + self, url, visual_features=None, details=None, language="en", custom_headers=None, raw=False, **operation_config): + """This operation extracts a rich set of visual features based on the + image content. + Two input methods are supported -- (1) Uploading an image or (2) + specifying an image URL. Within your request, there is an optional + parameter to allow you to choose which features to return. By default, + image categories are returned in the response. + A successful response will be returned in JSON. If the request failed, + the response will contain an error code and a message to help + understand what went wrong. + + :param url: Publicly reachable URL of an image. + :type url: str + :param visual_features: A string indicating what visual feature types + to return. Multiple values should be comma-separated. Valid visual + feature types include: Categories - categorizes image content + according to a taxonomy defined in documentation. Tags - tags the + image with a detailed list of words related to the image content. + Description - describes the image content with a complete English + sentence. Faces - detects if faces are present. If present, generate + coordinates, gender and age. ImageType - detects if image is clipart + or a line drawing. Color - determines the accent color, dominant + color, and whether an image is black&white. Adult - detects if the + image is pornographic in nature (depicts nudity or a sex act). + Sexually suggestive content is also detected. Objects - detects + various objects within an image, including the approximate location. + The Objects argument is only available in English. + :type visual_features: list[str or + ~azure.cognitiveservices.vision.computervision.models.VisualFeatureTypes] + :param details: A string indicating which domain-specific details to + return. Multiple values should be comma-separated. Valid visual + feature types include: Celebrities - identifies celebrities if + detected in the image, Landmarks - identifies notable landmarks in the + image. + :type details: list[str or + ~azure.cognitiveservices.vision.computervision.models.Details] + :param language: The desired language for output generation. If this + parameter is not specified, the default value is + "en".Supported languages:en - English, Default. es - + Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. + Possible values include: 'en', 'es', 'ja', 'pt', 'zh' + :type language: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: ListModelsResult or ClientRawResponse if raw=true + :return: ImageAnalysis or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.vision.computervision.models.ListModelsResult - or ~msrest.pipeline.ClientRawResponse + ~azure.cognitiveservices.vision.computervision.models.ImageAnalysis or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ComputerVisionErrorException` """ + image_url = models.ImageUrl(url=url) + # Construct URL - url = self.list_models.metadata['url'] + url = self.analyze_image.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -101,15 +137,25 @@ def list_models( # Construct parameters query_parameters = {} + if visual_features is not None: + query_parameters['visualFeatures'] = self._serialize.query("visual_features", visual_features, '[VisualFeatureTypes]', div=',') + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, '[Details]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) + # Construct body + body_content = self._serialize.body(image_url, 'ImageUrl') + # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -118,45 +164,33 @@ def list_models( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ListModelsResult', response) + deserialized = self._deserialize('ImageAnalysis', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list_models.metadata = {'url': '/models'} - - def analyze_image( - self, url, visual_features=None, details=None, language="en", custom_headers=None, raw=False, **operation_config): - """This operation extracts a rich set of visual features based on the - image content. Two input methods are supported -- (1) Uploading an - image or (2) specifying an image URL. Within your request, there is an - optional parameter to allow you to choose which features to return. By - default, image categories are returned in the response. + analyze_image.metadata = {'url': '/analyze'} - :param url: Publicly reachable URL of an image + def describe_image( + self, url, max_candidates=1, language="en", custom_headers=None, raw=False, **operation_config): + """This operation generates a description of an image in human readable + language with complete sentences. The description is based on a + collection of content tags, which are also returned by the operation. + More than one description can be generated for each image. Descriptions + are ordered by their confidence score. All descriptions are in English. + Two input methods are supported -- (1) Uploading an image or (2) + specifying an image URL. + A successful response will be returned in JSON. If the request failed, + the response will contain an error code and a message to help + understand what went wrong. + + :param url: Publicly reachable URL of an image. :type url: str - :param visual_features: A string indicating what visual feature types - to return. Multiple values should be comma-separated. Valid visual - feature types include:Categories - categorizes image content according - to a taxonomy defined in documentation. Tags - tags the image with a - detailed list of words related to the image content. Description - - describes the image content with a complete English sentence. Faces - - detects if faces are present. If present, generate coordinates, gender - and age. ImageType - detects if image is clipart or a line drawing. - Color - determines the accent color, dominant color, and whether an - image is black&white.Adult - detects if the image is pornographic in - nature (depicts nudity or a sex act). Sexually suggestive content is - also detected. - :type visual_features: list[str or - ~azure.cognitiveservices.vision.computervision.models.VisualFeatureTypes] - :param details: A string indicating which domain-specific details to - return. Multiple values should be comma-separated. Valid visual - feature types include:Celebrities - identifies celebrities if detected - in the image. - :type details: list[str or - ~azure.cognitiveservices.vision.computervision.models.Details] + :param max_candidates: Maximum number of candidate descriptions to be + returned. The default is 1. + :type max_candidates: int :param language: The desired language for output generation. If this parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - @@ -168,17 +202,17 @@ def analyze_image( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: ImageAnalysis or ClientRawResponse if raw=true + :return: ImageDescription or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.vision.computervision.models.ImageAnalysis or - ~msrest.pipeline.ClientRawResponse + ~azure.cognitiveservices.vision.computervision.models.ImageDescription + or ~msrest.pipeline.ClientRawResponse :raises: :class:`ComputerVisionErrorException` """ image_url = models.ImageUrl(url=url) # Construct URL - url = self.analyze_image.metadata['url'] + url = self.describe_image.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -186,10 +220,8 @@ def analyze_image( # Construct parameters query_parameters = {} - if visual_features is not None: - query_parameters['visualFeatures'] = self._serialize.query("visual_features", visual_features, '[VisualFeatureTypes]', div=',') - if details is not None: - query_parameters['details'] = self._serialize.query("details", details, '[Details]', div=',') + if max_candidates is not None: + query_parameters['maxCandidates'] = self._serialize.query("max_candidates", max_candidates, 'int') if language is not None: query_parameters['language'] = self._serialize.query("language", language, 'str') @@ -213,55 +245,42 @@ def analyze_image( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ImageAnalysis', response) + deserialized = self._deserialize('ImageDescription', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - analyze_image.metadata = {'url': '/analyze'} + describe_image.metadata = {'url': '/describe'} - def generate_thumbnail( - self, width, height, url, smart_cropping=False, custom_headers=None, raw=False, callback=None, **operation_config): - """This operation generates a thumbnail image with the user-specified - width and height. By default, the service analyzes the image, - identifies the region of interest (ROI), and generates smart cropping - coordinates based on the ROI. Smart cropping helps when you specify an - aspect ratio that differs from that of the input image. A successful - response contains the thumbnail image binary. If the request failed, - the response contains an error code and a message to help determine - what went wrong. + def detect_objects( + self, url, custom_headers=None, raw=False, **operation_config): + """Performs object detection on the specified image. + Two input methods are supported -- (1) Uploading an image or (2) + specifying an image URL. + A successful response will be returned in JSON. If the request failed, + the response will contain an error code and a message to help + understand what went wrong. - :param width: Width of the thumbnail. It must be between 1 and 1024. - Recommended minimum of 50. - :type width: int - :param height: Height of the thumbnail. It must be between 1 and 1024. - Recommended minimum of 50. - :type height: int - :param url: Publicly reachable URL of an image + :param url: Publicly reachable URL of an image. :type url: str - :param smart_cropping: Boolean flag for enabling smart cropping. - :type smart_cropping: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response - :param callback: When specified, will be called with each chunk of - data that is streamed. The callback should take two arguments, the - bytes of the current chunk of data and the response object. If the - data is uploading, response will be None. - :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse + :return: DetectResult or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.vision.computervision.models.DetectResult or + ~msrest.pipeline.ClientRawResponse :raises: - :class:`HttpOperationError` + :class:`ComputerVisionErrorException` """ image_url = models.ImageUrl(url=url) # Construct URL - url = self.generate_thumbnail.metadata['url'] + url = self.detect_objects.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -269,14 +288,10 @@ def generate_thumbnail( # Construct parameters query_parameters = {} - query_parameters['width'] = self._serialize.query("width", width, 'int', maximum=1023, minimum=1) - query_parameters['height'] = self._serialize.query("height", height, 'int', maximum=1023, minimum=1) - if smart_cropping is not None: - query_parameters['smartCropping'] = self._serialize.query("smart_cropping", smart_cropping, 'bool') # Construct headers header_parameters = {} - header_parameters['Accept'] = 'application/octet-stream' + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -286,39 +301,176 @@ def generate_thumbnail( # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=True, **operation_config) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise HttpOperationError(self._deserialize, response) + raise models.ComputerVisionErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._client.stream_download(response, callback) + deserialized = self._deserialize('DetectResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - generate_thumbnail.metadata = {'url': '/generateThumbnail'} + detect_objects.metadata = {'url': '/detect'} + + def list_models( + self, custom_headers=None, raw=False, **operation_config): + """This operation returns the list of domain-specific models that are + supported by the Computer Vision API. Currently, the API supports + following domain-specific models: celebrity recognizer, landmark + recognizer. + A successful response will be returned in JSON. If the request failed, + the response will contain an error code and a message to help + understand what went wrong. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ListModelsResult or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.vision.computervision.models.ListModelsResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ComputerVisionErrorException` + """ + # Construct URL + url = self.list_models.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ComputerVisionErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ListModelsResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_models.metadata = {'url': '/models'} + + def analyze_image_by_domain( + self, model, url, language="en", custom_headers=None, raw=False, **operation_config): + """This operation recognizes content within an image by applying a + domain-specific model. The list of domain-specific models that are + supported by the Computer Vision API can be retrieved using the /models + GET request. Currently, the API provides following domain-specific + models: celebrities, landmarks. + Two input methods are supported -- (1) Uploading an image or (2) + specifying an image URL. + A successful response will be returned in JSON. + If the request failed, the response will contain an error code and a + message to help understand what went wrong. + + :param model: The domain-specific content to recognize. + :type model: str + :param url: Publicly reachable URL of an image. + :type url: str + :param language: The desired language for output generation. If this + parameter is not specified, the default value is + "en".Supported languages:en - English, Default. es - + Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. + Possible values include: 'en', 'es', 'ja', 'pt', 'zh' + :type language: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DomainModelResults or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.vision.computervision.models.DomainModelResults + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ComputerVisionErrorException` + """ + image_url = models.ImageUrl(url=url) + + # Construct URL + url = self.analyze_image_by_domain.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'model': self._serialize.url("model", model, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(image_url, 'ImageUrl') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ComputerVisionErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DomainModelResults', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + analyze_image_by_domain.metadata = {'url': '/models/{model}/analyze'} def recognize_printed_text( self, url, detect_orientation=True, language="unk", custom_headers=None, raw=False, **operation_config): - """Optical Character Recognition (OCR) detects printed text in an image - and extracts the recognized characters into a machine-usable character - stream. Upon success, the OCR results will be returned. Upon failure, - the error code together with an error message will be returned. The - error code can be one of InvalidImageUrl, InvalidImageFormat, - InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or - InternalServerError. + """Optical Character Recognition (OCR) detects text in an image and + extracts the recognized characters into a machine-usable character + stream. + Upon success, the OCR results will be returned. + Upon failure, the error code together with an error message will be + returned. The error code can be one of InvalidImageUrl, + InvalidImageFormat, InvalidImageSize, NotSupportedImage, + NotSupportedLanguage, or InternalServerError. :param detect_orientation: Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down). :type detect_orientation: bool - :param url: Publicly reachable URL of an image + :param url: Publicly reachable URL of an image. :type url: str :param language: The BCP-47 language code of the text to be detected in the image. The default value is 'unk'. Possible values include: @@ -383,23 +535,24 @@ def recognize_printed_text( return deserialized recognize_printed_text.metadata = {'url': '/ocr'} - def describe_image( - self, url, max_candidates=1, language="en", custom_headers=None, raw=False, **operation_config): - """This operation generates a description of an image in human readable - language with complete sentences. The description is based on a - collection of content tags, which are also returned by the operation. - More than one description can be generated for each image. - Descriptions are ordered by their confidence score. All descriptions - are in English. Two input methods are supported -- (1) Uploading an - image or (2) specifying an image URL.A successful response will be - returned in JSON. If the request failed, the response will contain an - error code and a message to help understand what went wrong. - - :param url: Publicly reachable URL of an image + def tag_image( + self, url, language="en", custom_headers=None, raw=False, **operation_config): + """This operation generates a list of words, or tags, that are relevant to + the content of the supplied image. The Computer Vision API can return + tags based on objects, living beings, scenery or actions found in + images. Unlike categories, tags are not organized according to a + hierarchical classification system, but correspond to image content. + Tags may contain hints to avoid ambiguity or provide context, for + example the tag "cello" may be accompanied by the hint "musical + instrument". All tags are in English. + Two input methods are supported -- (1) Uploading an image or (2) + specifying an image URL. + A successful response will be returned in JSON. If the request failed, + the response will contain an error code and a message to help + understand what went wrong. + + :param url: Publicly reachable URL of an image. :type url: str - :param max_candidates: Maximum number of candidate descriptions to be - returned. The default is 1. - :type max_candidates: int :param language: The desired language for output generation. If this parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - @@ -411,17 +564,17 @@ def describe_image( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: ImageDescription or ClientRawResponse if raw=true + :return: TagResult or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.vision.computervision.models.ImageDescription - or ~msrest.pipeline.ClientRawResponse + ~azure.cognitiveservices.vision.computervision.models.TagResult or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ComputerVisionErrorException` """ image_url = models.ImageUrl(url=url) # Construct URL - url = self.describe_image.metadata['url'] + url = self.tag_image.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -429,8 +582,6 @@ def describe_image( # Construct parameters query_parameters = {} - if max_candidates is not None: - query_parameters['maxCandidates'] = self._serialize.query("max_candidates", max_candidates, 'int') if language is not None: query_parameters['language'] = self._serialize.query("language", language, 'str') @@ -454,50 +605,59 @@ def describe_image( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ImageDescription', response) + deserialized = self._deserialize('TagResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - describe_image.metadata = {'url': '/describe'} - - def tag_image( - self, url, language="en", custom_headers=None, raw=False, **operation_config): - """This operation generates a list of words, or tags, that are relevant to - the content of the supplied image. The Computer Vision API can return - tags based on objects, living beings, scenery or actions found in - images. Unlike categories, tags are not organized according to a - hierarchical classification system, but correspond to image content. - Tags may contain hints to avoid ambiguity or provide context, for - example the tag 'cello' may be accompanied by the hint 'musical - instrument'. All tags are in English. + tag_image.metadata = {'url': '/tag'} - :param url: Publicly reachable URL of an image + def generate_thumbnail( + self, width, height, url, smart_cropping=False, custom_headers=None, raw=False, callback=None, **operation_config): + """This operation generates a thumbnail image with the user-specified + width and height. By default, the service analyzes the image, + identifies the region of interest (ROI), and generates smart cropping + coordinates based on the ROI. Smart cropping helps when you specify an + aspect ratio that differs from that of the input image. + A successful response contains the thumbnail image binary. If the + request failed, the response contains an error code and a message to + help determine what went wrong. + Upon failure, the error code and an error message are returned. The + error code could be one of InvalidImageUrl, InvalidImageFormat, + InvalidImageSize, InvalidThumbnailSize, NotSupportedImage, + FailedToProcess, Timeout, or InternalServerError. + + :param width: Width of the thumbnail, in pixels. It must be between 1 + and 1024. Recommended minimum of 50. + :type width: int + :param height: Height of the thumbnail, in pixels. It must be between + 1 and 1024. Recommended minimum of 50. + :type height: int + :param url: Publicly reachable URL of an image. :type url: str - :param language: The desired language for output generation. If this - parameter is not specified, the default value is - "en".Supported languages:en - English, Default. es - - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. - Possible values include: 'en', 'es', 'ja', 'pt', 'zh' - :type language: str + :param smart_cropping: Boolean flag for enabling smart cropping. + :type smart_cropping: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: TagResult or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.vision.computervision.models.TagResult or - ~msrest.pipeline.ClientRawResponse + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse :raises: - :class:`ComputerVisionErrorException` + :class:`HttpOperationError` """ image_url = models.ImageUrl(url=url) # Construct URL - url = self.tag_image.metadata['url'] + url = self.generate_thumbnail.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -505,12 +665,14 @@ def tag_image( # Construct parameters query_parameters = {} - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') + query_parameters['width'] = self._serialize.query("width", width, 'int', maximum=1024, minimum=1) + query_parameters['height'] = self._serialize.query("height", height, 'int', maximum=1024, minimum=1) + if smart_cropping is not None: + query_parameters['smartCropping'] = self._serialize.query("smart_cropping", smart_cropping, 'bool') # Construct headers header_parameters = {} - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = 'application/octet-stream' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -520,52 +682,45 @@ def tag_image( # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + response = self._client.send(request, stream=True, **operation_config) if response.status_code not in [200]: - raise models.ComputerVisionErrorException(self._deserialize, response) + raise HttpOperationError(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('TagResult', response) + deserialized = self._client.stream_download(response, callback) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - tag_image.metadata = {'url': '/tag'} + generate_thumbnail.metadata = {'url': '/generateThumbnail'} - def analyze_image_by_domain( - self, model, url, language="en", custom_headers=None, raw=False, **operation_config): - """This operation recognizes content within an image by applying a - domain-specific model. The list of domain-specific models that are - supported by the Computer Vision API can be retrieved using the /models - GET request. Currently, the API only provides a single domain-specific - model: celebrities. Two input methods are supported -- (1) Uploading an - image or (2) specifying an image URL. A successful response will be - returned in JSON. If the request failed, the response will contain an - error code and a message to help understand what went wrong. + def get_area_of_interest( + self, url, custom_headers=None, raw=False, **operation_config): + """This operation returns a bounding box around the most important area of + the image. + A successful response will be returned in JSON. If the request failed, + the response contains an error code and a message to help determine + what went wrong. + Upon failure, the error code and an error message are returned. The + error code could be one of InvalidImageUrl, InvalidImageFormat, + InvalidImageSize, NotSupportedImage, FailedToProcess, Timeout, or + InternalServerError. - :param model: The domain-specific content to recognize. - :type model: str - :param url: Publicly reachable URL of an image + :param url: Publicly reachable URL of an image. :type url: str - :param language: The desired language for output generation. If this - parameter is not specified, the default value is - "en".Supported languages:en - English, Default. es - - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. - Possible values include: 'en', 'es', 'ja', 'pt', 'zh' - :type language: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: DomainModelResults or ClientRawResponse if raw=true + :return: AreaOfInterestResult or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.vision.computervision.models.DomainModelResults + ~azure.cognitiveservices.vision.computervision.models.AreaOfInterestResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ComputerVisionErrorException` @@ -573,17 +728,14 @@ def analyze_image_by_domain( image_url = models.ImageUrl(url=url) # Construct URL - url = self.analyze_image_by_domain.metadata['url'] + url = self.get_area_of_interest.metadata['url'] path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), - 'model': self._serialize.url("model", model, 'str') + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') # Construct headers header_parameters = {} @@ -605,14 +757,14 @@ def analyze_image_by_domain( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('DomainModelResults', response) + deserialized = self._deserialize('AreaOfInterestResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - analyze_image_by_domain.metadata = {'url': '/models/{model}/analyze'} + get_area_of_interest.metadata = {'url': '/areaOfInterest'} def recognize_text( self, url, mode, custom_headers=None, raw=False, **operation_config): @@ -625,7 +777,7 @@ def recognize_text( 'Handwritten', 'Printed' :type mode: str or ~azure.cognitiveservices.vision.computervision.models.TextRecognitionMode - :param url: Publicly reachable URL of an image + :param url: Publicly reachable URL of an image. :type url: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -667,39 +819,210 @@ def recognize_text( raise models.ComputerVisionErrorException(self._deserialize, response) if raw: - client_raw_response = ClientRawResponse(None, response) - client_raw_response.add_headers({ - 'Operation-Location': 'str', - }) + client_raw_response = ClientRawResponse(None, response) + client_raw_response.add_headers({ + 'Operation-Location': 'str', + }) + return client_raw_response + recognize_text.metadata = {'url': '/recognizeText'} + + def get_text_operation_result( + self, operation_id, custom_headers=None, raw=False, **operation_config): + """This interface is used for getting text operation result. The URL to + this interface should be retrieved from 'Operation-Location' field + returned from Recognize Text interface. + + :param operation_id: Id of the text operation returned in the response + of the 'Recognize Text' + :type operation_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: TextOperationResult or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.vision.computervision.models.TextOperationResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ComputerVisionErrorException` + """ + # Construct URL + url = self.get_text_operation_result.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'operationId': self._serialize.url("operation_id", operation_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ComputerVisionErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('TextOperationResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_text_operation_result.metadata = {'url': '/textOperations/{operationId}'} + + def analyze_image_in_stream( + self, image, visual_features=None, details=None, language="en", custom_headers=None, raw=False, callback=None, **operation_config): + """This operation extracts a rich set of visual features based on the + image content. + Two input methods are supported -- (1) Uploading an image or (2) + specifying an image URL. Within your request, there is an optional + parameter to allow you to choose which features to return. By default, + image categories are returned in the response. + A successful response will be returned in JSON. If the request failed, + the response will contain an error code and a message to help + understand what went wrong. + + :param image: An image stream. + :type image: Generator + :param visual_features: A string indicating what visual feature types + to return. Multiple values should be comma-separated. Valid visual + feature types include: Categories - categorizes image content + according to a taxonomy defined in documentation. Tags - tags the + image with a detailed list of words related to the image content. + Description - describes the image content with a complete English + sentence. Faces - detects if faces are present. If present, generate + coordinates, gender and age. ImageType - detects if image is clipart + or a line drawing. Color - determines the accent color, dominant + color, and whether an image is black&white. Adult - detects if the + image is pornographic in nature (depicts nudity or a sex act). + Sexually suggestive content is also detected. Objects - detects + various objects within an image, including the approximate location. + The Objects argument is only available in English. + :type visual_features: list[str or + ~azure.cognitiveservices.vision.computervision.models.VisualFeatureTypes] + :param details: A string indicating which domain-specific details to + return. Multiple values should be comma-separated. Valid visual + feature types include: Celebrities - identifies celebrities if + detected in the image, Landmarks - identifies notable landmarks in the + image. + :type details: list[str or + ~azure.cognitiveservices.vision.computervision.models.Details] + :param language: The desired language for output generation. If this + parameter is not specified, the default value is + "en".Supported languages:en - English, Default. es - + Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. + Possible values include: 'en', 'es', 'ja', 'pt', 'zh' + :type language: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ImageAnalysis or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.vision.computervision.models.ImageAnalysis or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ComputerVisionErrorException` + """ + # Construct URL + url = self.analyze_image_in_stream.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if visual_features is not None: + query_parameters['visualFeatures'] = self._serialize.query("visual_features", visual_features, '[VisualFeatureTypes]', div=',') + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, '[Details]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/octet-stream' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._client.stream_upload(image, callback) + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ComputerVisionErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ImageAnalysis', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response - recognize_text.metadata = {'url': '/recognizeText'} - def get_text_operation_result( - self, operation_id, custom_headers=None, raw=False, **operation_config): - """This interface is used for getting text operation result. The URL to - this interface should be retrieved from 'Operation-Location' field - returned from Recognize Text interface. + return deserialized + analyze_image_in_stream.metadata = {'url': '/analyze'} - :param operation_id: Id of the text operation returned in the response - of the 'Recognize Text' - :type operation_id: str + def get_area_of_interest_in_stream( + self, image, custom_headers=None, raw=False, callback=None, **operation_config): + """This operation returns a bounding box around the most important area of + the image. + A successful response will be returned in JSON. If the request failed, + the response contains an error code and a message to help determine + what went wrong. + Upon failure, the error code and an error message are returned. The + error code could be one of InvalidImageUrl, InvalidImageFormat, + InvalidImageSize, NotSupportedImage, FailedToProcess, Timeout, or + InternalServerError. + + :param image: An image stream. + :type image: Generator :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response + :param callback: When specified, will be called with each chunk of + data that is streamed. The callback should take two arguments, the + bytes of the current chunk of data and the response object. If the + data is uploading, response will be None. + :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: TextOperationResult or ClientRawResponse if raw=true + :return: AreaOfInterestResult or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.vision.computervision.models.TextOperationResult + ~azure.cognitiveservices.vision.computervision.models.AreaOfInterestResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ComputerVisionErrorException` """ # Construct URL - url = self.get_text_operation_result.metadata['url'] + url = self.get_area_of_interest_in_stream.metadata['url'] path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), - 'operationId': self._serialize.url("operation_id", operation_id, 'str') + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -709,11 +1032,15 @@ def get_text_operation_result( # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/octet-stream' if custom_headers: header_parameters.update(custom_headers) + # Construct body + body_content = self._client.stream_upload(image, callback) + # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -722,42 +1049,33 @@ def get_text_operation_result( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('TextOperationResult', response) + deserialized = self._deserialize('AreaOfInterestResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - get_text_operation_result.metadata = {'url': '/textOperations/{operationId}'} + get_area_of_interest_in_stream.metadata = {'url': '/areaOfInterest'} - def analyze_image_in_stream( - self, image, visual_features=None, details=None, language="en", custom_headers=None, raw=False, callback=None, **operation_config): - """This operation extracts a rich set of visual features based on the - image content. + def describe_image_in_stream( + self, image, max_candidates=1, language="en", custom_headers=None, raw=False, callback=None, **operation_config): + """This operation generates a description of an image in human readable + language with complete sentences. The description is based on a + collection of content tags, which are also returned by the operation. + More than one description can be generated for each image. Descriptions + are ordered by their confidence score. All descriptions are in English. + Two input methods are supported -- (1) Uploading an image or (2) + specifying an image URL. + A successful response will be returned in JSON. If the request failed, + the response will contain an error code and a message to help + understand what went wrong. :param image: An image stream. :type image: Generator - :param visual_features: A string indicating what visual feature types - to return. Multiple values should be comma-separated. Valid visual - feature types include:Categories - categorizes image content according - to a taxonomy defined in documentation. Tags - tags the image with a - detailed list of words related to the image content. Description - - describes the image content with a complete English sentence. Faces - - detects if faces are present. If present, generate coordinates, gender - and age. ImageType - detects if image is clipart or a line drawing. - Color - determines the accent color, dominant color, and whether an - image is black&white.Adult - detects if the image is pornographic in - nature (depicts nudity or a sex act). Sexually suggestive content is - also detected. - :type visual_features: list[str or - ~azure.cognitiveservices.vision.computervision.models.VisualFeatureTypes] - :param details: A string indicating which domain-specific details to - return. Multiple values should be comma-separated. Valid visual - feature types include:Celebrities - identifies celebrities if detected - in the image. - :type details: list[str or - ~azure.cognitiveservices.vision.computervision.models.Details] + :param max_candidates: Maximum number of candidate descriptions to be + returned. The default is 1. + :type max_candidates: int :param language: The desired language for output generation. If this parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - @@ -774,15 +1092,15 @@ def analyze_image_in_stream( :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: ImageAnalysis or ClientRawResponse if raw=true + :return: ImageDescription or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.vision.computervision.models.ImageAnalysis or - ~msrest.pipeline.ClientRawResponse + ~azure.cognitiveservices.vision.computervision.models.ImageDescription + or ~msrest.pipeline.ClientRawResponse :raises: :class:`ComputerVisionErrorException` """ # Construct URL - url = self.analyze_image_in_stream.metadata['url'] + url = self.describe_image_in_stream.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -790,10 +1108,8 @@ def analyze_image_in_stream( # Construct parameters query_parameters = {} - if visual_features is not None: - query_parameters['visualFeatures'] = self._serialize.query("visual_features", visual_features, '[VisualFeatureTypes]', div=',') - if details is not None: - query_parameters['details'] = self._serialize.query("details", details, '[Details]', div=',') + if max_candidates is not None: + query_parameters['maxCandidates'] = self._serialize.query("max_candidates", max_candidates, 'int') if language is not None: query_parameters['language'] = self._serialize.query("language", language, 'str') @@ -817,36 +1133,26 @@ def analyze_image_in_stream( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ImageAnalysis', response) + deserialized = self._deserialize('ImageDescription', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - analyze_image_in_stream.metadata = {'url': '/analyze'} + describe_image_in_stream.metadata = {'url': '/describe'} - def generate_thumbnail_in_stream( - self, width, height, image, smart_cropping=False, custom_headers=None, raw=False, callback=None, **operation_config): - """This operation generates a thumbnail image with the user-specified - width and height. By default, the service analyzes the image, - identifies the region of interest (ROI), and generates smart cropping - coordinates based on the ROI. Smart cropping helps when you specify an - aspect ratio that differs from that of the input image. A successful - response contains the thumbnail image binary. If the request failed, - the response contains an error code and a message to help determine - what went wrong. + def detect_objects_in_stream( + self, image, custom_headers=None, raw=False, callback=None, **operation_config): + """Performs object detection on the specified image. + Two input methods are supported -- (1) Uploading an image or (2) + specifying an image URL. + A successful response will be returned in JSON. If the request failed, + the response will contain an error code and a message to help + understand what went wrong. - :param width: Width of the thumbnail. It must be between 1 and 1024. - Recommended minimum of 50. - :type width: int - :param height: Height of the thumbnail. It must be between 1 and 1024. - Recommended minimum of 50. - :type height: int :param image: An image stream. :type image: Generator - :param smart_cropping: Boolean flag for enabling smart cropping. - :type smart_cropping: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -857,13 +1163,15 @@ def generate_thumbnail_in_stream( :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: Generator or ~msrest.pipeline.ClientRawResponse + :return: DetectResult or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.vision.computervision.models.DetectResult or + ~msrest.pipeline.ClientRawResponse :raises: - :class:`HttpOperationError` + :class:`ComputerVisionErrorException` """ # Construct URL - url = self.generate_thumbnail_in_stream.metadata['url'] + url = self.detect_objects_in_stream.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -871,14 +1179,10 @@ def generate_thumbnail_in_stream( # Construct parameters query_parameters = {} - query_parameters['width'] = self._serialize.query("width", width, 'int', maximum=1023, minimum=1) - query_parameters['height'] = self._serialize.query("height", height, 'int', maximum=1023, minimum=1) - if smart_cropping is not None: - query_parameters['smartCropping'] = self._serialize.query("smart_cropping", smart_cropping, 'bool') # Construct headers header_parameters = {} - header_parameters['Accept'] = 'application/octet-stream' + header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/octet-stream' if custom_headers: header_parameters.update(custom_headers) @@ -888,47 +1192,48 @@ def generate_thumbnail_in_stream( # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=True, **operation_config) + response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: - raise HttpOperationError(self._deserialize, response) + raise models.ComputerVisionErrorException(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._client.stream_download(response, callback) + deserialized = self._deserialize('DetectResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - generate_thumbnail_in_stream.metadata = {'url': '/generateThumbnail'} - - def recognize_printed_text_in_stream( - self, image, detect_orientation=True, language="unk", custom_headers=None, raw=False, callback=None, **operation_config): - """Optical Character Recognition (OCR) detects printed text in an image - and extracts the recognized characters into a machine-usable character - stream. Upon success, the OCR results will be returned. Upon failure, - the error code together with an error message will be returned. The - error code can be one of InvalidImageUrl, InvalidImageFormat, - InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or - InternalServerError. + detect_objects_in_stream.metadata = {'url': '/detect'} - :param detect_orientation: Whether detect the text orientation in the - image. With detectOrientation=true the OCR service tries to detect the - image orientation and correct it before further processing (e.g. if - it's upside-down). - :type detect_orientation: bool + def generate_thumbnail_in_stream( + self, width, height, image, smart_cropping=False, custom_headers=None, raw=False, callback=None, **operation_config): + """This operation generates a thumbnail image with the user-specified + width and height. By default, the service analyzes the image, + identifies the region of interest (ROI), and generates smart cropping + coordinates based on the ROI. Smart cropping helps when you specify an + aspect ratio that differs from that of the input image. + A successful response contains the thumbnail image binary. If the + request failed, the response contains an error code and a message to + help determine what went wrong. + Upon failure, the error code and an error message are returned. The + error code could be one of InvalidImageUrl, InvalidImageFormat, + InvalidImageSize, InvalidThumbnailSize, NotSupportedImage, + FailedToProcess, Timeout, or InternalServerError. + + :param width: Width of the thumbnail, in pixels. It must be between 1 + and 1024. Recommended minimum of 50. + :type width: int + :param height: Height of the thumbnail, in pixels. It must be between + 1 and 1024. Recommended minimum of 50. + :type height: int :param image: An image stream. :type image: Generator - :param language: The BCP-47 language code of the text to be detected - in the image. The default value is 'unk'. Possible values include: - 'unk', 'zh-Hans', 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', - 'el', 'hu', 'it', 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', - 'tr', 'ar', 'ro', 'sr-Cyrl', 'sr-Latn', 'sk' - :type language: str or - ~azure.cognitiveservices.vision.computervision.models.OcrLanguages + :param smart_cropping: Boolean flag for enabling smart cropping. + :type smart_cropping: bool :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -939,15 +1244,13 @@ def recognize_printed_text_in_stream( :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: OcrResult or ClientRawResponse if raw=true - :rtype: - ~azure.cognitiveservices.vision.computervision.models.OcrResult or - ~msrest.pipeline.ClientRawResponse + :return: object or ClientRawResponse if raw=true + :rtype: Generator or ~msrest.pipeline.ClientRawResponse :raises: - :class:`ComputerVisionErrorException` + :class:`HttpOperationError` """ # Construct URL - url = self.recognize_printed_text_in_stream.metadata['url'] + url = self.generate_thumbnail_in_stream.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -955,13 +1258,14 @@ def recognize_printed_text_in_stream( # Construct parameters query_parameters = {} - if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'OcrLanguages') - query_parameters['detectOrientation'] = self._serialize.query("detect_orientation", detect_orientation, 'bool') + query_parameters['width'] = self._serialize.query("width", width, 'int', maximum=1024, minimum=1) + query_parameters['height'] = self._serialize.query("height", height, 'int', maximum=1024, minimum=1) + if smart_cropping is not None: + query_parameters['smartCropping'] = self._serialize.query("smart_cropping", smart_cropping, 'bool') # Construct headers header_parameters = {} - header_parameters['Accept'] = 'application/json' + header_parameters['Accept'] = 'application/octet-stream' header_parameters['Content-Type'] = 'application/octet-stream' if custom_headers: header_parameters.update(custom_headers) @@ -971,40 +1275,40 @@ def recognize_printed_text_in_stream( # Construct and send request request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + response = self._client.send(request, stream=True, **operation_config) if response.status_code not in [200]: - raise models.ComputerVisionErrorException(self._deserialize, response) + raise HttpOperationError(self._deserialize, response) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('OcrResult', response) + deserialized = self._client.stream_download(response, callback) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - recognize_printed_text_in_stream.metadata = {'url': '/ocr'} + generate_thumbnail_in_stream.metadata = {'url': '/generateThumbnail'} - def describe_image_in_stream( - self, image, max_candidates=1, language="en", custom_headers=None, raw=False, callback=None, **operation_config): - """This operation generates a description of an image in human readable - language with complete sentences. The description is based on a - collection of content tags, which are also returned by the operation. - More than one description can be generated for each image. - Descriptions are ordered by their confidence score. All descriptions - are in English. Two input methods are supported -- (1) Uploading an - image or (2) specifying an image URL.A successful response will be - returned in JSON. If the request failed, the response will contain an - error code and a message to help understand what went wrong. + def analyze_image_by_domain_in_stream( + self, model, image, language="en", custom_headers=None, raw=False, callback=None, **operation_config): + """This operation recognizes content within an image by applying a + domain-specific model. The list of domain-specific models that are + supported by the Computer Vision API can be retrieved using the /models + GET request. Currently, the API provides following domain-specific + models: celebrities, landmarks. + Two input methods are supported -- (1) Uploading an image or (2) + specifying an image URL. + A successful response will be returned in JSON. + If the request failed, the response will contain an error code and a + message to help understand what went wrong. + :param model: The domain-specific content to recognize. + :type model: str :param image: An image stream. :type image: Generator - :param max_candidates: Maximum number of candidate descriptions to be - returned. The default is 1. - :type max_candidates: int :param language: The desired language for output generation. If this parameter is not specified, the default value is "en".Supported languages:en - English, Default. es - @@ -1021,24 +1325,23 @@ def describe_image_in_stream( :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: ImageDescription or ClientRawResponse if raw=true + :return: DomainModelResults or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.vision.computervision.models.ImageDescription + ~azure.cognitiveservices.vision.computervision.models.DomainModelResults or ~msrest.pipeline.ClientRawResponse :raises: :class:`ComputerVisionErrorException` """ # Construct URL - url = self.describe_image_in_stream.metadata['url'] + url = self.analyze_image_by_domain_in_stream.metadata['url'] path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'model': self._serialize.url("model", model, 'str') } url = self._client.format_url(url, **path_format_arguments) # Construct parameters query_parameters = {} - if max_candidates is not None: - query_parameters['maxCandidates'] = self._serialize.query("max_candidates", max_candidates, 'int') if language is not None: query_parameters['language'] = self._serialize.query("language", language, 'str') @@ -1062,34 +1365,40 @@ def describe_image_in_stream( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ImageDescription', response) + deserialized = self._deserialize('DomainModelResults', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - describe_image_in_stream.metadata = {'url': '/describe'} + analyze_image_by_domain_in_stream.metadata = {'url': '/models/{model}/analyze'} - def tag_image_in_stream( - self, image, language="en", custom_headers=None, raw=False, callback=None, **operation_config): - """This operation generates a list of words, or tags, that are relevant to - the content of the supplied image. The Computer Vision API can return - tags based on objects, living beings, scenery or actions found in - images. Unlike categories, tags are not organized according to a - hierarchical classification system, but correspond to image content. - Tags may contain hints to avoid ambiguity or provide context, for - example the tag 'cello' may be accompanied by the hint 'musical - instrument'. All tags are in English. + def recognize_printed_text_in_stream( + self, image, detect_orientation=True, language="unk", custom_headers=None, raw=False, callback=None, **operation_config): + """Optical Character Recognition (OCR) detects text in an image and + extracts the recognized characters into a machine-usable character + stream. + Upon success, the OCR results will be returned. + Upon failure, the error code together with an error message will be + returned. The error code can be one of InvalidImageUrl, + InvalidImageFormat, InvalidImageSize, NotSupportedImage, + NotSupportedLanguage, or InternalServerError. + :param detect_orientation: Whether detect the text orientation in the + image. With detectOrientation=true the OCR service tries to detect the + image orientation and correct it before further processing (e.g. if + it's upside-down). + :type detect_orientation: bool :param image: An image stream. :type image: Generator - :param language: The desired language for output generation. If this - parameter is not specified, the default value is - "en".Supported languages:en - English, Default. es - - Spanish, ja - Japanese, pt - Portuguese, zh - Simplified Chinese. - Possible values include: 'en', 'es', 'ja', 'pt', 'zh' - :type language: str + :param language: The BCP-47 language code of the text to be detected + in the image. The default value is 'unk'. Possible values include: + 'unk', 'zh-Hans', 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', + 'el', 'hu', 'it', 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', + 'tr', 'ar', 'ro', 'sr-Cyrl', 'sr-Latn', 'sk' + :type language: str or + ~azure.cognitiveservices.vision.computervision.models.OcrLanguages :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1100,15 +1409,15 @@ def tag_image_in_stream( :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: TagResult or ClientRawResponse if raw=true + :return: OcrResult or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.vision.computervision.models.TagResult or + ~azure.cognitiveservices.vision.computervision.models.OcrResult or ~msrest.pipeline.ClientRawResponse :raises: :class:`ComputerVisionErrorException` """ # Construct URL - url = self.tag_image_in_stream.metadata['url'] + url = self.recognize_printed_text_in_stream.metadata['url'] path_format_arguments = { 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } @@ -1116,8 +1425,9 @@ def tag_image_in_stream( # Construct parameters query_parameters = {} + query_parameters['detectOrientation'] = self._serialize.query("detect_orientation", detect_orientation, 'bool') if language is not None: - query_parameters['language'] = self._serialize.query("language", language, 'str') + query_parameters['language'] = self._serialize.query("language", language, 'OcrLanguages') # Construct headers header_parameters = {} @@ -1139,28 +1449,31 @@ def tag_image_in_stream( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('TagResult', response) + deserialized = self._deserialize('OcrResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - tag_image_in_stream.metadata = {'url': '/tag'} + recognize_printed_text_in_stream.metadata = {'url': '/ocr'} - def analyze_image_by_domain_in_stream( - self, model, image, language="en", custom_headers=None, raw=False, callback=None, **operation_config): - """This operation recognizes content within an image by applying a - domain-specific model. The list of domain-specific models that are - supported by the Computer Vision API can be retrieved using the /models - GET request. Currently, the API only provides a single domain-specific - model: celebrities. Two input methods are supported -- (1) Uploading an - image or (2) specifying an image URL. A successful response will be - returned in JSON. If the request failed, the response will contain an - error code and a message to help understand what went wrong. + def tag_image_in_stream( + self, image, language="en", custom_headers=None, raw=False, callback=None, **operation_config): + """This operation generates a list of words, or tags, that are relevant to + the content of the supplied image. The Computer Vision API can return + tags based on objects, living beings, scenery or actions found in + images. Unlike categories, tags are not organized according to a + hierarchical classification system, but correspond to image content. + Tags may contain hints to avoid ambiguity or provide context, for + example the tag "cello" may be accompanied by the hint "musical + instrument". All tags are in English. + Two input methods are supported -- (1) Uploading an image or (2) + specifying an image URL. + A successful response will be returned in JSON. If the request failed, + the response will contain an error code and a message to help + understand what went wrong. - :param model: The domain-specific content to recognize. - :type model: str :param image: An image stream. :type image: Generator :param language: The desired language for output generation. If this @@ -1179,18 +1492,17 @@ def analyze_image_by_domain_in_stream( :type callback: Callable[Bytes, response=None] :param operation_config: :ref:`Operation configuration overrides`. - :return: DomainModelResults or ClientRawResponse if raw=true + :return: TagResult or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.vision.computervision.models.DomainModelResults - or ~msrest.pipeline.ClientRawResponse + ~azure.cognitiveservices.vision.computervision.models.TagResult or + ~msrest.pipeline.ClientRawResponse :raises: :class:`ComputerVisionErrorException` """ # Construct URL - url = self.analyze_image_by_domain_in_stream.metadata['url'] + url = self.tag_image_in_stream.metadata['url'] path_format_arguments = { - 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), - 'model': self._serialize.url("model", model, 'str') + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) @@ -1219,14 +1531,14 @@ def analyze_image_by_domain_in_stream( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('DomainModelResults', response) + deserialized = self._deserialize('TagResult', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - analyze_image_by_domain_in_stream.metadata = {'url': '/models/{model}/analyze'} + tag_image_in_stream.metadata = {'url': '/tag'} def recognize_text_in_stream( self, image, mode, custom_headers=None, raw=False, callback=None, **operation_config): diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py index f487c5eecaad..d1e90a15c852 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/__init__.py @@ -22,21 +22,26 @@ from .image_caption_py3 import ImageCaption from .image_description_details_py3 import ImageDescriptionDetails from .face_description_py3 import FaceDescription + from .bounding_rect_py3 import BoundingRect + from .object_hierarchy_py3 import ObjectHierarchy + from .detected_object_py3 import DetectedObject from .image_metadata_py3 import ImageMetadata from .image_analysis_py3 import ImageAnalysis + from .image_description_py3 import ImageDescription + from .detect_result_py3 import DetectResult + from .model_description_py3 import ModelDescription + from .list_models_result_py3 import ListModelsResult + from .domain_model_results_py3 import DomainModelResults from .ocr_word_py3 import OcrWord from .ocr_line_py3 import OcrLine from .ocr_region_py3 import OcrRegion from .ocr_result_py3 import OcrResult - from .model_description_py3 import ModelDescription - from .list_models_result_py3 import ListModelsResult - from .domain_model_results_py3 import DomainModelResults - from .celebrity_results_py3 import CelebrityResults - from .landmark_results_py3 import LandmarkResults - from .image_description_py3 import ImageDescription from .tag_result_py3 import TagResult - from .computer_vision_error_py3 import ComputerVisionError, ComputerVisionErrorException + from .area_of_interest_result_py3 import AreaOfInterestResult from .image_url_py3 import ImageUrl + from .computer_vision_error_py3 import ComputerVisionError, ComputerVisionErrorException + from .landmark_results_py3 import LandmarkResults + from .celebrity_results_py3 import CelebrityResults from .word_py3 import Word from .line_py3 import Line from .recognition_result_py3 import RecognitionResult @@ -54,31 +59,35 @@ from .image_caption import ImageCaption from .image_description_details import ImageDescriptionDetails from .face_description import FaceDescription + from .bounding_rect import BoundingRect + from .object_hierarchy import ObjectHierarchy + from .detected_object import DetectedObject from .image_metadata import ImageMetadata from .image_analysis import ImageAnalysis + from .image_description import ImageDescription + from .detect_result import DetectResult + from .model_description import ModelDescription + from .list_models_result import ListModelsResult + from .domain_model_results import DomainModelResults from .ocr_word import OcrWord from .ocr_line import OcrLine from .ocr_region import OcrRegion from .ocr_result import OcrResult - from .model_description import ModelDescription - from .list_models_result import ListModelsResult - from .domain_model_results import DomainModelResults - from .celebrity_results import CelebrityResults - from .landmark_results import LandmarkResults - from .image_description import ImageDescription from .tag_result import TagResult - from .computer_vision_error import ComputerVisionError, ComputerVisionErrorException + from .area_of_interest_result import AreaOfInterestResult from .image_url import ImageUrl + from .computer_vision_error import ComputerVisionError, ComputerVisionErrorException + from .landmark_results import LandmarkResults + from .celebrity_results import CelebrityResults from .word import Word from .line import Line from .recognition_result import RecognitionResult from .text_operation_result import TextOperationResult from .computer_vision_client_enums import ( Gender, - ComputerVisionErrorCodes, TextOperationStatusCodes, - VisualFeatureTypes, OcrLanguages, + VisualFeatureTypes, TextRecognitionMode, Details, ) @@ -96,30 +105,34 @@ 'ImageCaption', 'ImageDescriptionDetails', 'FaceDescription', + 'BoundingRect', + 'ObjectHierarchy', + 'DetectedObject', 'ImageMetadata', 'ImageAnalysis', + 'ImageDescription', + 'DetectResult', + 'ModelDescription', + 'ListModelsResult', + 'DomainModelResults', 'OcrWord', 'OcrLine', 'OcrRegion', 'OcrResult', - 'ModelDescription', - 'ListModelsResult', - 'DomainModelResults', - 'CelebrityResults', - 'LandmarkResults', - 'ImageDescription', 'TagResult', - 'ComputerVisionError', 'ComputerVisionErrorException', + 'AreaOfInterestResult', 'ImageUrl', + 'ComputerVisionError', 'ComputerVisionErrorException', + 'LandmarkResults', + 'CelebrityResults', 'Word', 'Line', 'RecognitionResult', 'TextOperationResult', 'Gender', - 'ComputerVisionErrorCodes', 'TextOperationStatusCodes', - 'VisualFeatureTypes', 'OcrLanguages', + 'VisualFeatureTypes', 'TextRecognitionMode', 'Details', ] diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/adult_info.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/adult_info.py index aa674936a787..bdef886fd2cd 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/adult_info.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/adult_info.py @@ -19,10 +19,10 @@ class AdultInfo(Model): :param is_adult_content: A value indicating if the image contains adult-oriented content. :type is_adult_content: bool - :param is_racy_content: A value indicating if the image is race. + :param is_racy_content: A value indicating if the image is racy. :type is_racy_content: bool - :param adult_score: Score from 0 to 1 that indicates how much of adult - content is within the image. + :param adult_score: Score from 0 to 1 that indicates how much the content + is considered adult-oriented within the image. :type adult_score: float :param racy_score: Score from 0 to 1 that indicates how suggestive is the image. diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/adult_info_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/adult_info_py3.py index 9c28b8351a4a..0aa79159e970 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/adult_info_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/adult_info_py3.py @@ -19,10 +19,10 @@ class AdultInfo(Model): :param is_adult_content: A value indicating if the image contains adult-oriented content. :type is_adult_content: bool - :param is_racy_content: A value indicating if the image is race. + :param is_racy_content: A value indicating if the image is racy. :type is_racy_content: bool - :param adult_score: Score from 0 to 1 that indicates how much of adult - content is within the image. + :param adult_score: Score from 0 to 1 that indicates how much the content + is considered adult-oriented within the image. :type adult_score: float :param racy_score: Score from 0 to 1 that indicates how suggestive is the image. diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/area_of_interest_result.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/area_of_interest_result.py new file mode 100644 index 000000000000..ea59aa36ef4e --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/area_of_interest_result.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AreaOfInterestResult(Model): + """Result of AreaOfInterest operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar area_of_interest: A bounding box for an area of interest inside an + image. + :vartype area_of_interest: + ~azure.cognitiveservices.vision.computervision.models.BoundingRect + :param request_id: Id of the REST API request. + :type request_id: str + :param metadata: + :type metadata: + ~azure.cognitiveservices.vision.computervision.models.ImageMetadata + """ + + _validation = { + 'area_of_interest': {'readonly': True}, + } + + _attribute_map = { + 'area_of_interest': {'key': 'areaOfInterest', 'type': 'BoundingRect'}, + 'request_id': {'key': 'requestId', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, + } + + def __init__(self, **kwargs): + super(AreaOfInterestResult, self).__init__(**kwargs) + self.area_of_interest = None + self.request_id = kwargs.get('request_id', None) + self.metadata = kwargs.get('metadata', None) diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/area_of_interest_result_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/area_of_interest_result_py3.py new file mode 100644 index 000000000000..41bfb39fac38 --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/area_of_interest_result_py3.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class AreaOfInterestResult(Model): + """Result of AreaOfInterest operation. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar area_of_interest: A bounding box for an area of interest inside an + image. + :vartype area_of_interest: + ~azure.cognitiveservices.vision.computervision.models.BoundingRect + :param request_id: Id of the REST API request. + :type request_id: str + :param metadata: + :type metadata: + ~azure.cognitiveservices.vision.computervision.models.ImageMetadata + """ + + _validation = { + 'area_of_interest': {'readonly': True}, + } + + _attribute_map = { + 'area_of_interest': {'key': 'areaOfInterest', 'type': 'BoundingRect'}, + 'request_id': {'key': 'requestId', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, + } + + def __init__(self, *, request_id: str=None, metadata=None, **kwargs) -> None: + super(AreaOfInterestResult, self).__init__(**kwargs) + self.area_of_interest = None + self.request_id = request_id + self.metadata = metadata diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/bounding_rect.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/bounding_rect.py new file mode 100644 index 000000000000..093d54d18e9d --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/bounding_rect.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class BoundingRect(Model): + """A bounding box for an area inside an image. + + :param x: X-coordinate of the top left point of the area, in pixels. + :type x: int + :param y: Y-coordinate of the top left point of the area, in pixels. + :type y: int + :param w: Width measured from the top-left point of the area, in pixels. + :type w: int + :param h: Height measured from the top-left point of the area, in pixels. + :type h: int + """ + + _attribute_map = { + 'x': {'key': 'x', 'type': 'int'}, + 'y': {'key': 'y', 'type': 'int'}, + 'w': {'key': 'w', 'type': 'int'}, + 'h': {'key': 'h', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(BoundingRect, self).__init__(**kwargs) + self.x = kwargs.get('x', None) + self.y = kwargs.get('y', None) + self.w = kwargs.get('w', None) + self.h = kwargs.get('h', None) diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/bounding_rect_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/bounding_rect_py3.py new file mode 100644 index 000000000000..e8a94cf06373 --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/bounding_rect_py3.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class BoundingRect(Model): + """A bounding box for an area inside an image. + + :param x: X-coordinate of the top left point of the area, in pixels. + :type x: int + :param y: Y-coordinate of the top left point of the area, in pixels. + :type y: int + :param w: Width measured from the top-left point of the area, in pixels. + :type w: int + :param h: Height measured from the top-left point of the area, in pixels. + :type h: int + """ + + _attribute_map = { + 'x': {'key': 'x', 'type': 'int'}, + 'y': {'key': 'y', 'type': 'int'}, + 'w': {'key': 'w', 'type': 'int'}, + 'h': {'key': 'h', 'type': 'int'}, + } + + def __init__(self, *, x: int=None, y: int=None, w: int=None, h: int=None, **kwargs) -> None: + super(BoundingRect, self).__init__(**kwargs) + self.x = x + self.y = y + self.w = w + self.h = h diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/category.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/category.py index 234f283b0d5c..ea80677bbb5f 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/category.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/category.py @@ -19,7 +19,7 @@ class Category(Model): :type name: str :param score: Scoring of the category. :type score: float - :param detail: + :param detail: Details of the identified category. :type detail: ~azure.cognitiveservices.vision.computervision.models.CategoryDetail """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/category_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/category_py3.py index e6c0c0485cc7..f75c495aaa10 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/category_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/category_py3.py @@ -19,7 +19,7 @@ class Category(Model): :type name: str :param score: Scoring of the category. :type score: float - :param detail: + :param detail: Details of the identified category. :type detail: ~azure.cognitiveservices.vision.computervision.models.CategoryDetail """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrities_model.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrities_model.py index bb6db51def40..2248dc3ef771 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrities_model.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrities_model.py @@ -17,9 +17,10 @@ class CelebritiesModel(Model): :param name: Name of the celebrity. :type name: str - :param confidence: Level of confidence ranging from 0 to 1. + :param confidence: Confidence level for the celebrity recognition as a + value ranging from 0 to 1. :type confidence: float - :param face_rectangle: + :param face_rectangle: Location of the identified face in the image. :type face_rectangle: ~azure.cognitiveservices.vision.computervision.models.FaceRectangle """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrities_model_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrities_model_py3.py index d50e338a979a..b16be80a3c67 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrities_model_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrities_model_py3.py @@ -17,9 +17,10 @@ class CelebritiesModel(Model): :param name: Name of the celebrity. :type name: str - :param confidence: Level of confidence ranging from 0 to 1. + :param confidence: Confidence level for the celebrity recognition as a + value ranging from 0 to 1. :type confidence: float - :param face_rectangle: + :param face_rectangle: Location of the identified face in the image. :type face_rectangle: ~azure.cognitiveservices.vision.computervision.models.FaceRectangle """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrity_results.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrity_results.py index 84b07c34ecbc..113a3312ab8c 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrity_results.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrity_results.py @@ -13,9 +13,9 @@ class CelebrityResults(Model): - """List of celebrities recognized in the image. + """Result of domain-specific classifications for the domain of celebrities. - :param celebrities: + :param celebrities: List of celebrities recognized in the image. :type celebrities: list[~azure.cognitiveservices.vision.computervision.models.CelebritiesModel] :param request_id: Id of the REST API request. diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrity_results_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrity_results_py3.py index b6edc077463e..35e594d2bb7a 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrity_results_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/celebrity_results_py3.py @@ -13,9 +13,9 @@ class CelebrityResults(Model): - """List of celebrities recognized in the image. + """Result of domain-specific classifications for the domain of celebrities. - :param celebrities: + :param celebrities: List of celebrities recognized in the image. :type celebrities: list[~azure.cognitiveservices.vision.computervision.models.CelebritiesModel] :param request_id: Id of the REST API request. diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_client_enums.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_client_enums.py index 3354b6007794..adb0ba54ef76 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_client_enums.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_client_enums.py @@ -18,23 +18,6 @@ class Gender(str, Enum): female = "Female" -class ComputerVisionErrorCodes(str, Enum): - - invalid_image_url = "InvalidImageUrl" - invalid_image_format = "InvalidImageFormat" - invalid_image_size = "InvalidImageSize" - not_supported_visual_feature = "NotSupportedVisualFeature" - not_supported_image = "NotSupportedImage" - invalid_details = "InvalidDetails" - not_supported_language = "NotSupportedLanguage" - bad_argument = "BadArgument" - failed_to_process = "FailedToProcess" - timeout = "Timeout" - internal_server_error = "InternalServerError" - unspecified = "Unspecified" - storage_exception = "StorageException" - - class TextOperationStatusCodes(str, Enum): not_started = "Not Started" @@ -43,17 +26,6 @@ class TextOperationStatusCodes(str, Enum): succeeded = "Succeeded" -class VisualFeatureTypes(str, Enum): - - image_type = "ImageType" - faces = "Faces" - adult = "Adult" - categories = "Categories" - color = "Color" - tags = "Tags" - description = "Description" - - class OcrLanguages(str, Enum): unk = "unk" @@ -85,6 +57,18 @@ class OcrLanguages(str, Enum): sk = "sk" +class VisualFeatureTypes(str, Enum): + + image_type = "ImageType" + faces = "Faces" + adult = "Adult" + categories = "Categories" + color = "Color" + tags = "Tags" + description = "Description" + objects = "Objects" + + class TextRecognitionMode(str, Enum): handwritten = "Handwritten" diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_error.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_error.py index 4350fe0694ab..e4e306b6746b 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_error.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_error.py @@ -14,17 +14,12 @@ class ComputerVisionError(Model): - """ComputerVisionError. + """Details about the API request error. All required parameters must be populated in order to send to Azure. - :param code: Required. The error code. Possible values include: - 'InvalidImageUrl', 'InvalidImageFormat', 'InvalidImageSize', - 'NotSupportedVisualFeature', 'NotSupportedImage', 'InvalidDetails', - 'NotSupportedLanguage', 'BadArgument', 'FailedToProcess', 'Timeout', - 'InternalServerError', 'Unspecified', 'StorageException' - :type code: str or - ~azure.cognitiveservices.vision.computervision.models.ComputerVisionErrorCodes + :param code: Required. The error code. + :type code: object :param message: Required. A message explaining the error reported by the service. :type message: str @@ -38,7 +33,7 @@ class ComputerVisionError(Model): } _attribute_map = { - 'code': {'key': 'code', 'type': 'ComputerVisionErrorCodes'}, + 'code': {'key': 'code', 'type': 'object'}, 'message': {'key': 'message', 'type': 'str'}, 'request_id': {'key': 'requestId', 'type': 'str'}, } diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_error_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_error_py3.py index b4112ddba880..dc1595d71756 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_error_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/computer_vision_error_py3.py @@ -14,17 +14,12 @@ class ComputerVisionError(Model): - """ComputerVisionError. + """Details about the API request error. All required parameters must be populated in order to send to Azure. - :param code: Required. The error code. Possible values include: - 'InvalidImageUrl', 'InvalidImageFormat', 'InvalidImageSize', - 'NotSupportedVisualFeature', 'NotSupportedImage', 'InvalidDetails', - 'NotSupportedLanguage', 'BadArgument', 'FailedToProcess', 'Timeout', - 'InternalServerError', 'Unspecified', 'StorageException' - :type code: str or - ~azure.cognitiveservices.vision.computervision.models.ComputerVisionErrorCodes + :param code: Required. The error code. + :type code: object :param message: Required. A message explaining the error reported by the service. :type message: str @@ -38,7 +33,7 @@ class ComputerVisionError(Model): } _attribute_map = { - 'code': {'key': 'code', 'type': 'ComputerVisionErrorCodes'}, + 'code': {'key': 'code', 'type': 'object'}, 'message': {'key': 'message', 'type': 'str'}, 'request_id': {'key': 'requestId', 'type': 'str'}, } diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detect_result.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detect_result.py new file mode 100644 index 000000000000..89bd2af82277 --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detect_result.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DetectResult(Model): + """Result of a DetectImage call. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar objects: An array of detected objects. + :vartype objects: + list[~azure.cognitiveservices.vision.computervision.models.DetectedObject] + :param request_id: Id of the REST API request. + :type request_id: str + :param metadata: + :type metadata: + ~azure.cognitiveservices.vision.computervision.models.ImageMetadata + """ + + _validation = { + 'objects': {'readonly': True}, + } + + _attribute_map = { + 'objects': {'key': 'objects', 'type': '[DetectedObject]'}, + 'request_id': {'key': 'requestId', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, + } + + def __init__(self, **kwargs): + super(DetectResult, self).__init__(**kwargs) + self.objects = None + self.request_id = kwargs.get('request_id', None) + self.metadata = kwargs.get('metadata', None) diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detect_result_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detect_result_py3.py new file mode 100644 index 000000000000..39b5e712bb16 --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detect_result_py3.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DetectResult(Model): + """Result of a DetectImage call. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar objects: An array of detected objects. + :vartype objects: + list[~azure.cognitiveservices.vision.computervision.models.DetectedObject] + :param request_id: Id of the REST API request. + :type request_id: str + :param metadata: + :type metadata: + ~azure.cognitiveservices.vision.computervision.models.ImageMetadata + """ + + _validation = { + 'objects': {'readonly': True}, + } + + _attribute_map = { + 'objects': {'key': 'objects', 'type': '[DetectedObject]'}, + 'request_id': {'key': 'requestId', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, + } + + def __init__(self, *, request_id: str=None, metadata=None, **kwargs) -> None: + super(DetectResult, self).__init__(**kwargs) + self.objects = None + self.request_id = request_id + self.metadata = metadata diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_object.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_object.py new file mode 100644 index 000000000000..605b6d24f67a --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_object.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DetectedObject(Model): + """An object detected in an image. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar rectangle: Approximate location of the detected object. + :vartype rectangle: + ~azure.cognitiveservices.vision.computervision.models.BoundingRect + :param object_property: Label for the object. + :type object_property: str + :param confidence: Confidence score of having observed the object in the + image, as a value ranging from 0 to 1. + :type confidence: float + :param parent: The parent object, from a taxonomy perspective. + The parent object is a more generic form of this object. For example, a + 'bulldog' would have a parent of 'dog'. + :type parent: + ~azure.cognitiveservices.vision.computervision.models.ObjectHierarchy + """ + + _validation = { + 'rectangle': {'readonly': True}, + } + + _attribute_map = { + 'rectangle': {'key': 'rectangle', 'type': 'BoundingRect'}, + 'object_property': {'key': 'object', 'type': 'str'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'parent': {'key': 'parent', 'type': 'ObjectHierarchy'}, + } + + def __init__(self, **kwargs): + super(DetectedObject, self).__init__(**kwargs) + self.rectangle = None + self.object_property = kwargs.get('object_property', None) + self.confidence = kwargs.get('confidence', None) + self.parent = kwargs.get('parent', None) diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_object_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_object_py3.py new file mode 100644 index 000000000000..256e0f3fb7db --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/detected_object_py3.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class DetectedObject(Model): + """An object detected in an image. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar rectangle: Approximate location of the detected object. + :vartype rectangle: + ~azure.cognitiveservices.vision.computervision.models.BoundingRect + :param object_property: Label for the object. + :type object_property: str + :param confidence: Confidence score of having observed the object in the + image, as a value ranging from 0 to 1. + :type confidence: float + :param parent: The parent object, from a taxonomy perspective. + The parent object is a more generic form of this object. For example, a + 'bulldog' would have a parent of 'dog'. + :type parent: + ~azure.cognitiveservices.vision.computervision.models.ObjectHierarchy + """ + + _validation = { + 'rectangle': {'readonly': True}, + } + + _attribute_map = { + 'rectangle': {'key': 'rectangle', 'type': 'BoundingRect'}, + 'object_property': {'key': 'object', 'type': 'str'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'parent': {'key': 'parent', 'type': 'ObjectHierarchy'}, + } + + def __init__(self, *, object_property: str=None, confidence: float=None, parent=None, **kwargs) -> None: + super(DetectedObject, self).__init__(**kwargs) + self.rectangle = None + self.object_property = object_property + self.confidence = confidence + self.parent = parent diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/domain_model_results.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/domain_model_results.py index dba10b4cb224..73f5ce109bb9 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/domain_model_results.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/domain_model_results.py @@ -16,7 +16,7 @@ class DomainModelResults(Model): """Result of image analysis using a specific domain model including additional metadata. - :param result: Model-specific response + :param result: Model-specific response. :type result: object :param request_id: Id of the REST API request. :type request_id: str diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/domain_model_results_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/domain_model_results_py3.py index 4b718b2258a7..56b5b6c75830 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/domain_model_results_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/domain_model_results_py3.py @@ -16,7 +16,7 @@ class DomainModelResults(Model): """Result of image analysis using a specific domain model including additional metadata. - :param result: Model-specific response + :param result: Model-specific response. :type result: object :param request_id: Id of the REST API request. :type request_id: str diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_description.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_description.py index 383a6ecd9576..e6259e315a7a 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_description.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_description.py @@ -21,7 +21,8 @@ class FaceDescription(Model): 'Male', 'Female' :type gender: str or ~azure.cognitiveservices.vision.computervision.models.Gender - :param face_rectangle: + :param face_rectangle: Rectangle in the image containing the identified + face. :type face_rectangle: ~azure.cognitiveservices.vision.computervision.models.FaceRectangle """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_description_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_description_py3.py index 63e9e941714c..beea02fb5fdc 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_description_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_description_py3.py @@ -21,7 +21,8 @@ class FaceDescription(Model): 'Male', 'Female' :type gender: str or ~azure.cognitiveservices.vision.computervision.models.Gender - :param face_rectangle: + :param face_rectangle: Rectangle in the image containing the identified + face. :type face_rectangle: ~azure.cognitiveservices.vision.computervision.models.FaceRectangle """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_rectangle.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_rectangle.py index 566ecc6100d4..6c376886c661 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_rectangle.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_rectangle.py @@ -15,13 +15,15 @@ class FaceRectangle(Model): """An object describing face rectangle. - :param left: X-coordinate of the top left point of the face. + :param left: X-coordinate of the top left point of the face, in pixels. :type left: int - :param top: Y-coordinate of the top left point of the face. + :param top: Y-coordinate of the top left point of the face, in pixels. :type top: int - :param width: Width measured from the top-left point of the face. + :param width: Width measured from the top-left point of the face, in + pixels. :type width: int - :param height: Height measured from the top-left point of the face. + :param height: Height measured from the top-left point of the face, in + pixels. :type height: int """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_rectangle_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_rectangle_py3.py index aa8b0daaff59..963fb5281139 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_rectangle_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/face_rectangle_py3.py @@ -15,13 +15,15 @@ class FaceRectangle(Model): """An object describing face rectangle. - :param left: X-coordinate of the top left point of the face. + :param left: X-coordinate of the top left point of the face, in pixels. :type left: int - :param top: Y-coordinate of the top left point of the face. + :param top: Y-coordinate of the top left point of the face, in pixels. :type top: int - :param width: Width measured from the top-left point of the face. + :param width: Width measured from the top-left point of the face, in + pixels. :type width: int - :param height: Height measured from the top-left point of the face. + :param height: Height measured from the top-left point of the face, in + pixels. :type height: int """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis.py index 5d7e3c308e43..3a721e498848 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis.py @@ -18,25 +18,33 @@ class ImageAnalysis(Model): :param categories: An array indicating identified categories. :type categories: list[~azure.cognitiveservices.vision.computervision.models.Category] - :param adult: + :param adult: An object describing whether the image contains + adult-oriented content and/or is racy. :type adult: ~azure.cognitiveservices.vision.computervision.models.AdultInfo - :param color: + :param color: An object providing additional metadata describing color + attributes. :type color: ~azure.cognitiveservices.vision.computervision.models.ColorInfo - :param image_type: + :param image_type: An object providing possible image types and matching + confidence levels. :type image_type: ~azure.cognitiveservices.vision.computervision.models.ImageType :param tags: A list of tags with confidence level. :type tags: list[~azure.cognitiveservices.vision.computervision.models.ImageTag] - :param description: + :param description: A collection of content tags, along with a list of + captions sorted by confidence level, and image metadata. :type description: ~azure.cognitiveservices.vision.computervision.models.ImageDescriptionDetails :param faces: An array of possible faces within the image. :type faces: list[~azure.cognitiveservices.vision.computervision.models.FaceDescription] - :param request_id: Id of the request for tracking purposes. + :param objects: Array of objects describing what was detected in the + image. + :type objects: + list[~azure.cognitiveservices.vision.computervision.models.DetectedObject] + :param request_id: Id of the REST API request. :type request_id: str :param metadata: :type metadata: @@ -51,6 +59,7 @@ class ImageAnalysis(Model): 'tags': {'key': 'tags', 'type': '[ImageTag]'}, 'description': {'key': 'description', 'type': 'ImageDescriptionDetails'}, 'faces': {'key': 'faces', 'type': '[FaceDescription]'}, + 'objects': {'key': 'objects', 'type': '[DetectedObject]'}, 'request_id': {'key': 'requestId', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, } @@ -64,5 +73,6 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) self.description = kwargs.get('description', None) self.faces = kwargs.get('faces', None) + self.objects = kwargs.get('objects', None) self.request_id = kwargs.get('request_id', None) self.metadata = kwargs.get('metadata', None) diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis_py3.py index 45eaf49c71d8..55d392077613 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_analysis_py3.py @@ -18,25 +18,33 @@ class ImageAnalysis(Model): :param categories: An array indicating identified categories. :type categories: list[~azure.cognitiveservices.vision.computervision.models.Category] - :param adult: + :param adult: An object describing whether the image contains + adult-oriented content and/or is racy. :type adult: ~azure.cognitiveservices.vision.computervision.models.AdultInfo - :param color: + :param color: An object providing additional metadata describing color + attributes. :type color: ~azure.cognitiveservices.vision.computervision.models.ColorInfo - :param image_type: + :param image_type: An object providing possible image types and matching + confidence levels. :type image_type: ~azure.cognitiveservices.vision.computervision.models.ImageType :param tags: A list of tags with confidence level. :type tags: list[~azure.cognitiveservices.vision.computervision.models.ImageTag] - :param description: + :param description: A collection of content tags, along with a list of + captions sorted by confidence level, and image metadata. :type description: ~azure.cognitiveservices.vision.computervision.models.ImageDescriptionDetails :param faces: An array of possible faces within the image. :type faces: list[~azure.cognitiveservices.vision.computervision.models.FaceDescription] - :param request_id: Id of the request for tracking purposes. + :param objects: Array of objects describing what was detected in the + image. + :type objects: + list[~azure.cognitiveservices.vision.computervision.models.DetectedObject] + :param request_id: Id of the REST API request. :type request_id: str :param metadata: :type metadata: @@ -51,11 +59,12 @@ class ImageAnalysis(Model): 'tags': {'key': 'tags', 'type': '[ImageTag]'}, 'description': {'key': 'description', 'type': 'ImageDescriptionDetails'}, 'faces': {'key': 'faces', 'type': '[FaceDescription]'}, + 'objects': {'key': 'objects', 'type': '[DetectedObject]'}, 'request_id': {'key': 'requestId', 'type': 'str'}, 'metadata': {'key': 'metadata', 'type': 'ImageMetadata'}, } - def __init__(self, *, categories=None, adult=None, color=None, image_type=None, tags=None, description=None, faces=None, request_id: str=None, metadata=None, **kwargs) -> None: + def __init__(self, *, categories=None, adult=None, color=None, image_type=None, tags=None, description=None, faces=None, objects=None, request_id: str=None, metadata=None, **kwargs) -> None: super(ImageAnalysis, self).__init__(**kwargs) self.categories = categories self.adult = adult @@ -64,5 +73,6 @@ def __init__(self, *, categories=None, adult=None, color=None, image_type=None, self.tags = tags self.description = description self.faces = faces + self.objects = objects self.request_id = request_id self.metadata = metadata diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_caption.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_caption.py index ec9aa4b93f80..486b2c975fa4 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_caption.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_caption.py @@ -15,9 +15,9 @@ class ImageCaption(Model): """An image caption, i.e. a brief description of what the image depicts. - :param text: The text of the caption + :param text: The text of the caption. :type text: str - :param confidence: The level of confidence the service has in the caption + :param confidence: The level of confidence the service has in the caption. :type confidence: float """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_caption_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_caption_py3.py index 782f89cda23e..8bfbf80c781a 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_caption_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_caption_py3.py @@ -15,9 +15,9 @@ class ImageCaption(Model): """An image caption, i.e. a brief description of what the image depicts. - :param text: The text of the caption + :param text: The text of the caption. :type text: str - :param confidence: The level of confidence the service has in the caption + :param confidence: The level of confidence the service has in the caption. :type confidence: float """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_metadata.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_metadata.py index 797206379282..e543fec9266f 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_metadata.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_metadata.py @@ -15,11 +15,11 @@ class ImageMetadata(Model): """Image metadata. - :param width: Image width + :param width: Image width, in pixels. :type width: int - :param height: Image height + :param height: Image height, in pixels. :type height: int - :param format: Image format + :param format: Image format. :type format: str """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_metadata_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_metadata_py3.py index 2d6bb256c481..46dc21f3447d 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_metadata_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_metadata_py3.py @@ -15,11 +15,11 @@ class ImageMetadata(Model): """Image metadata. - :param width: Image width + :param width: Image width, in pixels. :type width: int - :param height: Image height + :param height: Image height, in pixels. :type height: int - :param format: Image format + :param format: Image format. :type format: str """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_tag.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_tag.py index 8e981d8e6121..34a644edda5d 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_tag.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_tag.py @@ -13,13 +13,13 @@ class ImageTag(Model): - """An image caption, i.e. a brief description of what the image depicts. + """An entity observation in the image, along with the confidence score. - :param name: The tag value + :param name: Name of the entity. :type name: str - :param confidence: The level of confidence the service has in the caption + :param confidence: The level of confidence that the entity was observed. :type confidence: float - :param hint: Optional categorization for the tag + :param hint: Optional hint/details for this tag. :type hint: str """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_tag_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_tag_py3.py index 62ba57b775b2..dc03cf493810 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_tag_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_tag_py3.py @@ -13,13 +13,13 @@ class ImageTag(Model): - """An image caption, i.e. a brief description of what the image depicts. + """An entity observation in the image, along with the confidence score. - :param name: The tag value + :param name: Name of the entity. :type name: str - :param confidence: The level of confidence the service has in the caption + :param confidence: The level of confidence that the entity was observed. :type confidence: float - :param hint: Optional categorization for the tag + :param hint: Optional hint/details for this tag. :type hint: str """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_url.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_url.py index 25106793ad9c..ba0ea688201d 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_url.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_url.py @@ -17,7 +17,7 @@ class ImageUrl(Model): All required parameters must be populated in order to send to Azure. - :param url: Required. Publicly reachable URL of an image + :param url: Required. Publicly reachable URL of an image. :type url: str """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_url_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_url_py3.py index 3e00709f804d..5099ce3db915 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_url_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/image_url_py3.py @@ -17,7 +17,7 @@ class ImageUrl(Model): All required parameters must be populated in order to send to Azure. - :param url: Required. Publicly reachable URL of an image + :param url: Required. Publicly reachable URL of an image. :type url: str """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmark_results.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmark_results.py index 7b0c45eb32c6..05827c3aba04 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmark_results.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmark_results.py @@ -13,9 +13,9 @@ class LandmarkResults(Model): - """List of landmarks recognized in the image. + """Result of domain-specific classifications for the domain of landmarks. - :param landmarks: + :param landmarks: List of landmarks recognized in the image. :type landmarks: list[~azure.cognitiveservices.vision.computervision.models.LandmarksModel] :param request_id: Id of the REST API request. diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmark_results_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmark_results_py3.py index 93228b4cf03f..b6338a3ad6eb 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmark_results_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmark_results_py3.py @@ -13,9 +13,9 @@ class LandmarkResults(Model): - """List of landmarks recognized in the image. + """Result of domain-specific classifications for the domain of landmarks. - :param landmarks: + :param landmarks: List of landmarks recognized in the image. :type landmarks: list[~azure.cognitiveservices.vision.computervision.models.LandmarksModel] :param request_id: Id of the REST API request. diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmarks_model.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmarks_model.py index 74ff012df89a..c588af0fa856 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmarks_model.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmarks_model.py @@ -17,7 +17,8 @@ class LandmarksModel(Model): :param name: Name of the landmark. :type name: str - :param confidence: Confidence level for the landmark recognition. + :param confidence: Confidence level for the landmark recognition as a + value ranging from 0 to 1. :type confidence: float """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmarks_model_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmarks_model_py3.py index 9b7ed4502168..6375b75c202d 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmarks_model_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/landmarks_model_py3.py @@ -17,7 +17,8 @@ class LandmarksModel(Model): :param name: Name of the landmark. :type name: str - :param confidence: Confidence level for the landmark recognition. + :param confidence: Confidence level for the landmark recognition as a + value ranging from 0 to 1. :type confidence: float """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/model_description.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/model_description.py index b12081359419..a61de961108b 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/model_description.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/model_description.py @@ -15,9 +15,9 @@ class ModelDescription(Model): """An object describing supported model by name and categories. - :param name: + :param name: The name of the model. :type name: str - :param categories: + :param categories: Categories of the model. :type categories: list[str] """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/model_description_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/model_description_py3.py index e5fc81d86ff8..e9937408c506 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/model_description_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/model_description_py3.py @@ -15,9 +15,9 @@ class ModelDescription(Model): """An object describing supported model by name and categories. - :param name: + :param name: The name of the model. :type name: str - :param categories: + :param categories: Categories of the model. :type categories: list[str] """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/object_hierarchy.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/object_hierarchy.py new file mode 100644 index 000000000000..73c90da079dc --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/object_hierarchy.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ObjectHierarchy(Model): + """An object detected inside an image. + + :param object_property: Label for the object. + :type object_property: str + :param confidence: Confidence score of having observed the object in the + image, as a value ranging from 0 to 1. + :type confidence: float + :param parent: The parent object, from a taxonomy perspective. + The parent object is a more generic form of this object. For example, a + 'bulldog' would have a parent of 'dog'. + :type parent: + ~azure.cognitiveservices.vision.computervision.models.ObjectHierarchy + """ + + _attribute_map = { + 'object_property': {'key': 'object', 'type': 'str'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'parent': {'key': 'parent', 'type': 'ObjectHierarchy'}, + } + + def __init__(self, **kwargs): + super(ObjectHierarchy, self).__init__(**kwargs) + self.object_property = kwargs.get('object_property', None) + self.confidence = kwargs.get('confidence', None) + self.parent = kwargs.get('parent', None) diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/object_hierarchy_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/object_hierarchy_py3.py new file mode 100644 index 000000000000..03ee6bbb62d7 --- /dev/null +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/object_hierarchy_py3.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class ObjectHierarchy(Model): + """An object detected inside an image. + + :param object_property: Label for the object. + :type object_property: str + :param confidence: Confidence score of having observed the object in the + image, as a value ranging from 0 to 1. + :type confidence: float + :param parent: The parent object, from a taxonomy perspective. + The parent object is a more generic form of this object. For example, a + 'bulldog' would have a parent of 'dog'. + :type parent: + ~azure.cognitiveservices.vision.computervision.models.ObjectHierarchy + """ + + _attribute_map = { + 'object_property': {'key': 'object', 'type': 'str'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'parent': {'key': 'parent', 'type': 'ObjectHierarchy'}, + } + + def __init__(self, *, object_property: str=None, confidence: float=None, parent=None, **kwargs) -> None: + super(ObjectHierarchy, self).__init__(**kwargs) + self.object_property = object_property + self.confidence = confidence + self.parent = parent diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_region.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_region.py index ddbeda6431ed..81565e50057c 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_region.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_region.py @@ -23,7 +23,7 @@ class OcrRegion(Model): according to the detected text angle (see textAngle property), with the origin at the top-left corner, and the y-axis pointing down. :type bounding_box: str - :param lines: + :param lines: An array of recognized lines of text. :type lines: list[~azure.cognitiveservices.vision.computervision.models.OcrLine] """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_region_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_region_py3.py index 6ae209a84e5c..0ec93652b575 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_region_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_region_py3.py @@ -23,7 +23,7 @@ class OcrRegion(Model): according to the detected text angle (see textAngle property), with the origin at the top-left corner, and the y-axis pointing down. :type bounding_box: str - :param lines: + :param lines: An array of recognized lines of text. :type lines: list[~azure.cognitiveservices.vision.computervision.models.OcrLine] """ diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_result.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_result.py index 854514692604..f83c25d0fa9e 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_result.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_result.py @@ -29,8 +29,8 @@ class OcrResult(Model): recognized correctly. :type text_angle: float :param orientation: Orientation of the text recognized in the image. The - value (up,down,left, or right) refers to the direction that the top of the - recognized text is facing, after the image has been rotated around its + value (up, down, left, or right) refers to the direction that the top of + the recognized text is facing, after the image has been rotated around its center according to the detected text angle (see textAngle property). :type orientation: str :param regions: An array of objects, where each object represents a region diff --git a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_result_py3.py b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_result_py3.py index 6d654eac5891..b9e541acd3e1 100644 --- a/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_result_py3.py +++ b/azure-cognitiveservices-vision-computervision/azure/cognitiveservices/vision/computervision/models/ocr_result_py3.py @@ -29,8 +29,8 @@ class OcrResult(Model): recognized correctly. :type text_angle: float :param orientation: Orientation of the text recognized in the image. The - value (up,down,left, or right) refers to the direction that the top of the - recognized text is facing, after the image has been rotated around its + value (up, down, left, or right) refers to the direction that the top of + the recognized text is facing, after the image has been rotated around its center according to the detected text angle (see textAngle property). :type orientation: str :param regions: An array of objects, where each object represents a region