diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/ComputerVisionClient.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/ComputerVisionClient.java index 13c3aa3214a1..5fc596025882 100644 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/ComputerVisionClient.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/ComputerVisionClient.java @@ -10,8 +10,10 @@ import com.microsoft.azure.AzureClient; import com.microsoft.azure.CloudException; +import com.microsoft.azure.cognitiveservices.vision.computervision.models.AreaOfInterestResult; import com.microsoft.azure.cognitiveservices.vision.computervision.models.ComputerVisionErrorException; import com.microsoft.azure.cognitiveservices.vision.computervision.models.Details; +import com.microsoft.azure.cognitiveservices.vision.computervision.models.DetectResult; import com.microsoft.azure.cognitiveservices.vision.computervision.models.DomainModelResults; import com.microsoft.azure.cognitiveservices.vision.computervision.models.ImageAnalysis; import com.microsoft.azure.cognitiveservices.vision.computervision.models.ImageDescription; @@ -59,14 +61,14 @@ public interface ComputerVisionClient { String userAgent(); /** - * Gets Supported Cognitive Services endpoints. + * Gets Supported Cognitive Services endpoints.. * * @return the endpoint value. */ String endpoint(); /** - * Sets Supported Cognitive Services endpoints. + * Sets Supported Cognitive Services endpoints.. * * @param endpoint the endpoint value. * @return the service client itself @@ -119,404 +121,521 @@ public interface ComputerVisionClient { ComputerVisionClient withGenerateClientRequestId(boolean generateClientRequestId); /** - * 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. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ListModelsResult object if successful. + * @return the ImageAnalysis object if successful. */ - ListModelsResult listModels(); + ImageAnalysis analyzeImage(String url); /** - * 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. + * 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. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture listModelsAsync(final ServiceCallback serviceCallback); + ServiceFuture analyzeImageAsync(String url, final ServiceCallback serviceCallback); /** - * 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. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ListModelsResult object + * @return the observable to the ImageAnalysis object */ - Observable listModelsAsync(); + Observable analyzeImageAsync(String url); /** - * 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. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ListModelsResult object + * @return the observable to the ImageAnalysis object */ - Observable> listModelsWithServiceResponseAsync(); - + Observable> analyzeImageWithServiceResponseAsync(String url); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. + * @param visualFeatures 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. + * @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. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImageAnalysis object if successful. */ - ImageAnalysis analyzeImage(String url); + ImageAnalysis analyzeImage(String url, List visualFeatures, List
details, String language); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. + * @param visualFeatures 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. + * @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. + * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture analyzeImageAsync(String url, final ServiceCallback serviceCallback); + ServiceFuture analyzeImageAsync(String url, List visualFeatures, List
details, String language, final ServiceCallback serviceCallback); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. + * @param visualFeatures 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. + * @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. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImageAnalysis object */ - Observable analyzeImageAsync(String url); + Observable analyzeImageAsync(String url, List visualFeatures, List
details, String language); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. + * @param visualFeatures 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. + * @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. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImageAnalysis object */ - Observable> analyzeImageWithServiceResponseAsync(String url); + Observable> analyzeImageWithServiceResponseAsync(String url, List visualFeatures, List
details, String language); + /** - * 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. + * 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 - * @param visualFeatures 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. - * @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. + * @param url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageDescription object if successful. + */ + ImageDescription describeImage(String url); + + /** + * 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. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture describeImageAsync(String url, final ServiceCallback serviceCallback); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageDescription object + */ + Observable describeImageAsync(String url); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageDescription object + */ + Observable> describeImageWithServiceResponseAsync(String url); + /** + * 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. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageAnalysis object if successful. + * @return the ImageDescription object if successful. */ - ImageAnalysis analyzeImage(String url, List visualFeatures, List
details, String language); + ImageDescription describeImage(String url, Integer maxCandidates, String language); /** - * 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. + * 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 - * @param visualFeatures 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. - * @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. + * @param url Publicly reachable URL of an image. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture analyzeImageAsync(String url, List visualFeatures, List
details, String language, final ServiceCallback serviceCallback); + ServiceFuture describeImageAsync(String url, Integer maxCandidates, String language, final ServiceCallback serviceCallback); /** - * 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. + * 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 - * @param visualFeatures 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. - * @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. + * @param url Publicly reachable URL of an image. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageAnalysis object + * @return the observable to the ImageDescription object */ - Observable analyzeImageAsync(String url, List visualFeatures, List
details, String language); + Observable describeImageAsync(String url, Integer maxCandidates, String language); /** - * 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. + * 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 - * @param visualFeatures 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. - * @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. + * @param url Publicly reachable URL of an image. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageAnalysis object + * @return the observable to the ImageDescription object */ - Observable> analyzeImageWithServiceResponseAsync(String url, List visualFeatures, List
details, String language); + Observable> describeImageWithServiceResponseAsync(String url, Integer maxCandidates, String language); /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the InputStream object if successful. + * @return the DetectResult object if successful. */ - InputStream generateThumbnail(int width, int height, String url); + DetectResult detectObjects(String url); /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture generateThumbnailAsync(int width, int height, String url, final ServiceCallback serviceCallback); + ServiceFuture detectObjectsAsync(String url, final ServiceCallback serviceCallback); /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the DetectResult object */ - Observable generateThumbnailAsync(int width, int height, String url); + Observable detectObjectsAsync(String url); /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the DetectResult object */ - Observable> generateThumbnailWithServiceResponseAsync(int width, int height, String url); + Observable> detectObjectsWithServiceResponseAsync(String url); + /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image - * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the InputStream object if successful. + * @return the ListModelsResult object if successful. */ - InputStream generateThumbnail(int width, int height, String url, Boolean smartCropping); + ListModelsResult listModels(); /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image - * @param smartCropping Boolean flag for enabling smart cropping. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture generateThumbnailAsync(int width, int height, String url, Boolean smartCropping, final ServiceCallback serviceCallback); + ServiceFuture listModelsAsync(final ServiceCallback serviceCallback); /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image - * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the ListModelsResult object */ - Observable generateThumbnailAsync(int width, int height, String url, Boolean smartCropping); + Observable listModelsAsync(); /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image - * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the ListModelsResult object */ - Observable> generateThumbnailWithServiceResponseAsync(int width, int height, String url, Boolean smartCropping); + Observable> listModelsWithServiceResponseAsync(); /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the OcrResult object if successful. + * @return the DomainModelResults object if successful. */ - OcrResult recognizePrintedText(boolean detectOrientation, String url); + DomainModelResults analyzeImageByDomain(String model, String url); /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture recognizePrintedTextAsync(boolean detectOrientation, String url, final ServiceCallback serviceCallback); + ServiceFuture analyzeImageByDomainAsync(String model, String url, final ServiceCallback serviceCallback); /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the DomainModelResults object */ - Observable recognizePrintedTextAsync(boolean detectOrientation, String url); + Observable analyzeImageByDomainAsync(String model, String url); /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the DomainModelResults object */ - Observable> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url); + Observable> analyzeImageByDomainWithServiceResponseAsync(String model, String url); /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image - * @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' + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the OcrResult object if successful. + * @return the DomainModelResults object if successful. */ - OcrResult recognizePrintedText(boolean detectOrientation, String url, OcrLanguages language); + DomainModelResults analyzeImageByDomain(String model, String url, String language); /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image - * @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' + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. + * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture recognizePrintedTextAsync(boolean detectOrientation, String url, OcrLanguages language, final ServiceCallback serviceCallback); + ServiceFuture analyzeImageByDomainAsync(String model, String url, String language, final ServiceCallback serviceCallback); /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image - * @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' + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the DomainModelResults object */ - Observable recognizePrintedTextAsync(boolean detectOrientation, String url, OcrLanguages language); + Observable analyzeImageByDomainAsync(String model, String url, String language); /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image - * @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' + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the DomainModelResults object */ - Observable> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url, OcrLanguages language); + Observable> analyzeImageByDomainWithServiceResponseAsync(String model, String url, String language); /** - * 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. + * 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 url Publicly reachable URL of an image + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageDescription object if successful. + * @return the OcrResult object if successful. */ - ImageDescription describeImage(String url); + OcrResult recognizePrintedText(boolean detectOrientation, String url); /** - * 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. + * 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 url Publicly reachable URL of an image + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture describeImageAsync(String url, final ServiceCallback serviceCallback); + ServiceFuture recognizePrintedTextAsync(boolean detectOrientation, String url, final ServiceCallback serviceCallback); /** - * 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. + * 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 url Publicly reachable URL of an image + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the OcrResult object */ - Observable describeImageAsync(String url); + Observable recognizePrintedTextAsync(boolean detectOrientation, String url); /** - * 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. + * 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 url Publicly reachable URL of an image + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the OcrResult object */ - Observable> describeImageWithServiceResponseAsync(String url); + Observable> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url); /** - * 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. + * 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 url Publicly reachable URL of an image - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. - * @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' + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageDescription object if successful. + * @return the OcrResult object if successful. */ - ImageDescription describeImage(String url, Integer maxCandidates, String language); + OcrResult recognizePrintedText(boolean detectOrientation, String url, OcrLanguages language); /** - * 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. + * 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 url Publicly reachable URL of an image - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. - * @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' + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. + * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture describeImageAsync(String url, Integer maxCandidates, String language, final ServiceCallback serviceCallback); + ServiceFuture recognizePrintedTextAsync(boolean detectOrientation, String url, OcrLanguages language, final ServiceCallback serviceCallback); /** - * 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. + * 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 url Publicly reachable URL of an image - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. - * @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' + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the OcrResult object */ - Observable describeImageAsync(String url, Integer maxCandidates, String language); + Observable recognizePrintedTextAsync(boolean detectOrientation, String url, OcrLanguages language); /** - * 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. + * 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 url Publicly reachable URL of an image - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. - * @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' + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the OcrResult object */ - Observable> describeImageWithServiceResponseAsync(String url, Integer maxCandidates, String language); + Observable> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url, OcrLanguages language); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -525,9 +644,11 @@ public interface ComputerVisionClient { TagResult tagImage(String url); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -535,26 +656,32 @@ public interface ComputerVisionClient { ServiceFuture tagImageAsync(String url, final ServiceCallback serviceCallback); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the TagResult object */ Observable tagImageAsync(String url); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the TagResult object */ Observable> tagImageWithServiceResponseAsync(String url); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server @@ -564,9 +691,11 @@ public interface ComputerVisionClient { TagResult tagImage(String url, String language); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -575,9 +704,11 @@ public interface ComputerVisionClient { ServiceFuture tagImageAsync(String url, String language, final ServiceCallback serviceCallback); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the TagResult object @@ -585,9 +716,11 @@ public interface ComputerVisionClient { Observable tagImageAsync(String url, String language); /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the TagResult object @@ -595,99 +728,170 @@ public interface ComputerVisionClient { Observable> tagImageWithServiceResponseAsync(String url, String language); /** - * 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. + * 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 model The domain-specific content to recognize. - * @param url Publicly reachable URL of an image + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the DomainModelResults object if successful. + * @return the InputStream object if successful. */ - DomainModelResults analyzeImageByDomain(String model, String url); + InputStream generateThumbnail(int width, int height, String url); /** - * 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. + * 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 model The domain-specific content to recognize. - * @param url Publicly reachable URL of an image + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture analyzeImageByDomainAsync(String model, String url, final ServiceCallback serviceCallback); + ServiceFuture generateThumbnailAsync(int width, int height, String url, final ServiceCallback serviceCallback); /** - * 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. + * 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 model The domain-specific content to recognize. - * @param url Publicly reachable URL of an image + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the InputStream object */ - Observable analyzeImageByDomainAsync(String model, String url); + Observable generateThumbnailAsync(int width, int height, String url); /** - * 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. + * 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 model The domain-specific content to recognize. - * @param url Publicly reachable URL of an image + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the InputStream object */ - Observable> analyzeImageByDomainWithServiceResponseAsync(String model, String url); + Observable> generateThumbnailWithServiceResponseAsync(int width, int height, String url); /** - * 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. + * 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 model The domain-specific content to recognize. - * @param url Publicly reachable URL of an image - * @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' + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @param smartCropping Boolean flag for enabling smart cropping. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InputStream object if successful. + */ + InputStream generateThumbnail(int width, int height, String url, Boolean smartCropping); + + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @param smartCropping Boolean flag for enabling smart cropping. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture generateThumbnailAsync(int width, int height, String url, Boolean smartCropping, final ServiceCallback serviceCallback); + + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @param smartCropping Boolean flag for enabling smart cropping. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable generateThumbnailAsync(int width, int height, String url, Boolean smartCropping); + + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @param smartCropping Boolean flag for enabling smart cropping. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + Observable> generateThumbnailWithServiceResponseAsync(int width, int height, String url, Boolean smartCropping); + + /** + * 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 url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the DomainModelResults object if successful. + * @return the AreaOfInterestResult object if successful. */ - DomainModelResults analyzeImageByDomain(String model, String url, String language); + AreaOfInterestResult getAreaOfInterest(String url); /** - * 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. + * 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. - * @param url Publicly reachable URL of an image - * @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' + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture analyzeImageByDomainAsync(String model, String url, String language, final ServiceCallback serviceCallback); + ServiceFuture getAreaOfInterestAsync(String url, final ServiceCallback serviceCallback); /** - * 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. + * 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. - * @param url Publicly reachable URL of an image - * @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' + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the AreaOfInterestResult object */ - Observable analyzeImageByDomainAsync(String model, String url, String language); + Observable getAreaOfInterestAsync(String url); /** - * 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. + * 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. - * @param url Publicly reachable URL of an image - * @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' + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the AreaOfInterestResult object */ - Observable> analyzeImageByDomainWithServiceResponseAsync(String model, String url, String language); + Observable> getAreaOfInterestWithServiceResponseAsync(String url); /** * Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. * * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -698,7 +902,7 @@ public interface ComputerVisionClient { * Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. * * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -709,7 +913,7 @@ public interface ComputerVisionClient { * Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. * * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponseWithHeaders} object if successful. */ @@ -719,7 +923,7 @@ public interface ComputerVisionClient { * Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. * * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponseWithHeaders} object if successful. */ @@ -751,548 +955,746 @@ public interface ComputerVisionClient { * * @param operationId Id of the text operation returned in the response of the 'Recognize Text' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TextOperationResult object + * @return the observable to the TextOperationResult object + */ + Observable getTextOperationResultAsync(String operationId); + + /** + * 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 operationId Id of the text operation returned in the response of the 'Recognize Text' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TextOperationResult object + */ + Observable> getTextOperationResultWithServiceResponseAsync(String operationId); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageAnalysis object if successful. + */ + ImageAnalysis analyzeImageInStream(byte[] image); + + /** + * 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. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture analyzeImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageAnalysis object + */ + Observable analyzeImageInStreamAsync(byte[] image); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageAnalysis object + */ + Observable> analyzeImageInStreamWithServiceResponseAsync(byte[] image); + /** + * 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. + * @param visualFeatures 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. + * @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. + * @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' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageAnalysis object if successful. + */ + ImageAnalysis analyzeImageInStream(byte[] image, List visualFeatures, List
details, String language); + + /** + * 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. + * @param visualFeatures 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. + * @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. + * @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' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture analyzeImageInStreamAsync(byte[] image, List visualFeatures, List
details, String language, final ServiceCallback serviceCallback); + + /** + * 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. + * @param visualFeatures 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. + * @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. + * @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' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageAnalysis object */ - Observable getTextOperationResultAsync(String operationId); + Observable analyzeImageInStreamAsync(byte[] image, List visualFeatures, List
details, String language); /** - * 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. + * 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 operationId Id of the text operation returned in the response of the 'Recognize Text' + * @param image An image stream. + * @param visualFeatures 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. + * @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. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TextOperationResult object + * @return the observable to the ImageAnalysis object */ - Observable> getTextOperationResultWithServiceResponseAsync(String operationId); + Observable> analyzeImageInStreamWithServiceResponseAsync(byte[] image, List visualFeatures, List
details, String language); /** - * This operation extracts a rich set of visual features based on the image content. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageAnalysis object if successful. + * @return the AreaOfInterestResult object if successful. */ - ImageAnalysis analyzeImageInStream(byte[] image); + AreaOfInterestResult getAreaOfInterestInStream(byte[] image); /** - * This operation extracts a rich set of visual features based on the image content. + * 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. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture analyzeImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback); + ServiceFuture getAreaOfInterestInStreamAsync(byte[] image, final ServiceCallback serviceCallback); /** - * This operation extracts a rich set of visual features based on the image content. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageAnalysis object + * @return the observable to the AreaOfInterestResult object */ - Observable analyzeImageInStreamAsync(byte[] image); + Observable getAreaOfInterestInStreamAsync(byte[] image); /** - * This operation extracts a rich set of visual features based on the image content. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageAnalysis object + * @return the observable to the AreaOfInterestResult object */ - Observable> analyzeImageInStreamWithServiceResponseAsync(byte[] image); + Observable> getAreaOfInterestInStreamWithServiceResponseAsync(byte[] image); + /** - * This operation extracts a rich set of visual features based on the image content. + * 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. - * @param visualFeatures 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. - * @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. - * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageAnalysis object if successful. + * @return the ImageDescription object if successful. */ - ImageAnalysis analyzeImageInStream(byte[] image, List visualFeatures, List
details, String language); + ImageDescription describeImageInStream(byte[] image); /** - * This operation extracts a rich set of visual features based on the image content. + * 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. - * @param visualFeatures 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. - * @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. - * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture analyzeImageInStreamAsync(byte[] image, List visualFeatures, List
details, String language, final ServiceCallback serviceCallback); + ServiceFuture describeImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback); /** - * This operation extracts a rich set of visual features based on the image content. + * 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. - * @param visualFeatures 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. - * @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. - * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageAnalysis object + * @return the observable to the ImageDescription object */ - Observable analyzeImageInStreamAsync(byte[] image, List visualFeatures, List
details, String language); + Observable describeImageInStreamAsync(byte[] image); /** - * This operation extracts a rich set of visual features based on the image content. + * 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. - * @param visualFeatures 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. - * @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. - * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageAnalysis object + * @return the observable to the ImageDescription object */ - Observable> analyzeImageInStreamWithServiceResponseAsync(byte[] image, List visualFeatures, List
details, String language); - + Observable> describeImageInStreamWithServiceResponseAsync(byte[] image); /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the InputStream object if successful. + * @return the ImageDescription object if successful. */ - InputStream generateThumbnailInStream(int width, int height, byte[] image); + ImageDescription describeImageInStream(byte[] image, Integer maxCandidates, String language); /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture generateThumbnailInStreamAsync(int width, int height, byte[] image, final ServiceCallback serviceCallback); + ServiceFuture describeImageInStreamAsync(byte[] image, Integer maxCandidates, String language, final ServiceCallback serviceCallback); /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the ImageDescription object */ - Observable generateThumbnailInStreamAsync(int width, int height, byte[] image); + Observable describeImageInStreamAsync(byte[] image, Integer maxCandidates, String language); /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the ImageDescription object */ - Observable> generateThumbnailInStreamWithServiceResponseAsync(int width, int height, byte[] image); + Observable> describeImageInStreamWithServiceResponseAsync(byte[] image, Integer maxCandidates, String language); + /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the InputStream object if successful. + * @return the DetectResult object if successful. */ - InputStream generateThumbnailInStream(int width, int height, byte[] image, Boolean smartCropping); + DetectResult detectObjectsInStream(byte[] image); /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @param smartCropping Boolean flag for enabling smart cropping. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture generateThumbnailInStreamAsync(int width, int height, byte[] image, Boolean smartCropping, final ServiceCallback serviceCallback); + ServiceFuture detectObjectsInStreamAsync(byte[] image, final ServiceCallback serviceCallback); /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the DetectResult object */ - Observable generateThumbnailInStreamAsync(int width, int height, byte[] image, Boolean smartCropping); + Observable detectObjectsInStreamAsync(byte[] image); /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the DetectResult object */ - Observable> generateThumbnailInStreamWithServiceResponseAsync(int width, int height, byte[] image, Boolean smartCropping); + Observable> detectObjectsInStreamWithServiceResponseAsync(byte[] image); /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the OcrResult object if successful. + * @return the InputStream object if successful. */ - OcrResult recognizePrintedTextInStream(boolean detectOrientation, byte[] image); + InputStream generateThumbnailInStream(int width, int height, byte[] image); /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, final ServiceCallback serviceCallback); + ServiceFuture generateThumbnailInStreamAsync(int width, int height, byte[] image, final ServiceCallback serviceCallback); /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the InputStream object */ - Observable recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image); + Observable generateThumbnailInStreamAsync(int width, int height, byte[] image); /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the InputStream object */ - Observable> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image); + Observable> generateThumbnailInStreamWithServiceResponseAsync(int width, int height, byte[] image); /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @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' + * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the OcrResult object if successful. + * @return the InputStream object if successful. */ - OcrResult recognizePrintedTextInStream(boolean detectOrientation, byte[] image, OcrLanguages language); + InputStream generateThumbnailInStream(int width, int height, byte[] image, Boolean smartCropping); /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @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' + * @param smartCropping Boolean flag for enabling smart cropping. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, OcrLanguages language, final ServiceCallback serviceCallback); + ServiceFuture generateThumbnailInStreamAsync(int width, int height, byte[] image, Boolean smartCropping, final ServiceCallback serviceCallback); /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @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' + * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the InputStream object */ - Observable recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, OcrLanguages language); + Observable generateThumbnailInStreamAsync(int width, int height, byte[] image, Boolean smartCropping); /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @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' + * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the InputStream object */ - Observable> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image, OcrLanguages language); + Observable> generateThumbnailInStreamWithServiceResponseAsync(int width, int height, byte[] image, Boolean smartCropping); /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageDescription object if successful. + * @return the DomainModelResults object if successful. */ - ImageDescription describeImageInStream(byte[] image); + DomainModelResults analyzeImageByDomainInStream(String model, byte[] image); /** - * 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. + * 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. * @param image An image stream. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture describeImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback); + ServiceFuture analyzeImageByDomainInStreamAsync(String model, byte[] image, final ServiceCallback serviceCallback); /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - Observable describeImageInStreamAsync(byte[] image); + Observable analyzeImageByDomainInStreamAsync(String model, byte[] image); /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - Observable> describeImageInStreamWithServiceResponseAsync(byte[] image); + Observable> analyzeImageByDomainInStreamWithServiceResponseAsync(String model, byte[] image); /** - * 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. + * 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. * @param image An image stream. - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageDescription object if successful. + * @return the DomainModelResults object if successful. */ - ImageDescription describeImageInStream(byte[] image, Integer maxCandidates, String language); + DomainModelResults analyzeImageByDomainInStream(String model, byte[] image, String language); /** - * 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. + * 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. * @param image An image stream. - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture describeImageInStreamAsync(byte[] image, Integer maxCandidates, String language, final ServiceCallback serviceCallback); + ServiceFuture analyzeImageByDomainInStreamAsync(String model, byte[] image, String language, final ServiceCallback serviceCallback); /** - * 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. + * 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. * @param image An image stream. - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - Observable describeImageInStreamAsync(byte[] image, Integer maxCandidates, String language); + Observable analyzeImageByDomainInStreamAsync(String model, byte[] image, String language); /** - * 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. + * 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. * @param image An image stream. - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - Observable> describeImageInStreamWithServiceResponseAsync(byte[] image, Integer maxCandidates, String language); + Observable> analyzeImageByDomainInStreamWithServiceResponseAsync(String model, byte[] image, String language); /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the TagResult object if successful. + * @return the OcrResult object if successful. */ - TagResult tagImageInStream(byte[] image); + OcrResult recognizePrintedTextInStream(boolean detectOrientation, byte[] image); /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture tagImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback); + ServiceFuture recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, final ServiceCallback serviceCallback); /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - Observable tagImageInStreamAsync(byte[] image); + Observable recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image); /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - Observable> tagImageInStreamWithServiceResponseAsync(byte[] image); + Observable> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image); /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. - * @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' + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the TagResult object if successful. + * @return the OcrResult object if successful. */ - TagResult tagImageInStream(byte[] image, String language); + OcrResult recognizePrintedTextInStream(boolean detectOrientation, byte[] image, OcrLanguages language); /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. - * @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' + * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture tagImageInStreamAsync(byte[] image, String language, final ServiceCallback serviceCallback); + ServiceFuture recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, OcrLanguages language, final ServiceCallback serviceCallback); /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. - * @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' + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - Observable tagImageInStreamAsync(byte[] image, String language); + Observable recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, OcrLanguages language); /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. - * @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' + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - Observable> tagImageInStreamWithServiceResponseAsync(byte[] image, String language); + Observable> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image, OcrLanguages language); /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the DomainModelResults object if successful. + * @return the TagResult object if successful. */ - DomainModelResults analyzeImageByDomainInStream(String model, byte[] image); + TagResult tagImageInStream(byte[] image); /** - * 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. + * 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. * @param image An image stream. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture analyzeImageByDomainInStreamAsync(String model, byte[] image, final ServiceCallback serviceCallback); + ServiceFuture tagImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback); /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - Observable analyzeImageByDomainInStreamAsync(String model, byte[] image); + Observable tagImageInStreamAsync(byte[] image); /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - Observable> analyzeImageByDomainInStreamWithServiceResponseAsync(String model, byte[] image); + Observable> tagImageInStreamWithServiceResponseAsync(byte[] image); /** - * 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. + * 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. * @param image An image stream. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the DomainModelResults object if successful. + * @return the TagResult object if successful. */ - DomainModelResults analyzeImageByDomainInStream(String model, byte[] image, String language); + TagResult tagImageInStream(byte[] image, String language); /** - * 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. + * 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. * @param image An image stream. * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - ServiceFuture analyzeImageByDomainInStreamAsync(String model, byte[] image, String language, final ServiceCallback serviceCallback); + ServiceFuture tagImageInStreamAsync(byte[] image, String language, final ServiceCallback serviceCallback); /** - * 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. + * 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. * @param image An image stream. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - Observable analyzeImageByDomainInStreamAsync(String model, byte[] image, String language); + Observable tagImageInStreamAsync(byte[] image, String language); /** - * 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. + * 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. * @param image An image stream. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - Observable> analyzeImageByDomainInStreamWithServiceResponseAsync(String model, byte[] image, String language); + Observable> tagImageInStreamWithServiceResponseAsync(byte[] image, String language); /** * Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionClientImpl.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionClientImpl.java index e920a0b65275..ecf9ef5256fd 100644 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionClientImpl.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionClientImpl.java @@ -14,8 +14,10 @@ import com.microsoft.azure.AzureServiceClient; import com.microsoft.azure.CloudException; import com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient; +import com.microsoft.azure.cognitiveservices.vision.computervision.models.AreaOfInterestResult; import com.microsoft.azure.cognitiveservices.vision.computervision.models.ComputerVisionErrorException; import com.microsoft.azure.cognitiveservices.vision.computervision.models.Details; +import com.microsoft.azure.cognitiveservices.vision.computervision.models.DetectResult; import com.microsoft.azure.cognitiveservices.vision.computervision.models.DomainModelResults; import com.microsoft.azure.cognitiveservices.vision.computervision.models.ImageAnalysis; import com.microsoft.azure.cognitiveservices.vision.computervision.models.ImageDescription; @@ -221,34 +223,42 @@ private void initializeService() { * used by Retrofit to perform actually REST calls. */ interface ComputerVisionClientService { - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient listModels" }) - @GET("models") - Observable> listModels(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient analyzeImage" }) @POST("analyze") Observable> analyzeImage(@Query("visualFeatures") String visualFeatures, @Query("details") String details, @Query("language") String language, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient generateThumbnail" }) - @POST("generateThumbnail") - @Streaming - Observable> generateThumbnail(@Query("width") int width, @Query("height") int height, @Query("smartCropping") Boolean smartCropping, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient describeImage" }) + @POST("describe") + Observable> describeImage(@Query("maxCandidates") Integer maxCandidates, @Query("language") String language, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient detectObjects" }) + @POST("detect") + Observable> detectObjects(@Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient listModels" }) + @GET("models") + Observable> listModels(@Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient analyzeImageByDomain" }) + @POST("models/{model}/analyze") + Observable> analyzeImageByDomain(@Path("model") String model, @Query("language") String language, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient recognizePrintedText" }) @POST("ocr") Observable> recognizePrintedText(@Query("detectOrientation") boolean detectOrientation, @Query("language") OcrLanguages language, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient describeImage" }) - @POST("describe") - Observable> describeImage(@Query("maxCandidates") Integer maxCandidates, @Query("language") String language, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient tagImage" }) @POST("tag") Observable> tagImage(@Query("language") String language, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient analyzeImageByDomain" }) - @POST("models/{model}/analyze") - Observable> analyzeImageByDomain(@Path("model") String model, @Query("language") String language, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient generateThumbnail" }) + @POST("generateThumbnail") + @Streaming + Observable> generateThumbnail(@Query("width") int width, @Query("height") int height, @Query("smartCropping") Boolean smartCropping, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient getAreaOfInterest" }) + @POST("areaOfInterest") + Observable> getAreaOfInterest(@Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient recognizeText" }) @POST("recognizeText") @@ -262,27 +272,35 @@ interface ComputerVisionClientService { @POST("analyze") Observable> analyzeImageInStream(@Query("visualFeatures") String visualFeatures, @Query("details") String details, @Query("language") String language, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient getAreaOfInterestInStream" }) + @POST("areaOfInterest") + Observable> getAreaOfInterestInStream(@Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient describeImageInStream" }) + @POST("describe") + Observable> describeImageInStream(@Query("maxCandidates") Integer maxCandidates, @Query("language") String language, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient detectObjectsInStream" }) + @POST("detect") + Observable> detectObjectsInStream(@Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient generateThumbnailInStream" }) @POST("generateThumbnail") @Streaming - Observable> generateThumbnailInStream(@Query("width") int width, @Query("height") int height, @Body RequestBody image, @Query("smartCropping") Boolean smartCropping, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + Observable> generateThumbnailInStream(@Query("width") int width, @Query("height") int height, @Query("smartCropping") Boolean smartCropping, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient analyzeImageByDomainInStream" }) + @POST("models/{model}/analyze") + Observable> analyzeImageByDomainInStream(@Path("model") String model, @Query("language") String language, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient recognizePrintedTextInStream" }) @POST("ocr") - Observable> recognizePrintedTextInStream(@Query("language") OcrLanguages language, @Query("detectOrientation") boolean detectOrientation, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient describeImageInStream" }) - @POST("describe") - Observable> describeImageInStream(@Query("maxCandidates") Integer maxCandidates, @Query("language") String language, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + Observable> recognizePrintedTextInStream(@Query("detectOrientation") boolean detectOrientation, @Query("language") OcrLanguages language, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient tagImageInStream" }) @POST("tag") Observable> tagImageInStream(@Query("language") String language, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient analyzeImageByDomainInStream" }) - @POST("models/{model}/analyze") - Observable> analyzeImageByDomainInStream(@Path("model") String model, @Query("language") String language, @Body RequestBody image, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/octet-stream", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.computervision.ComputerVisionClient recognizeTextInStream" }) @POST("recognizeText") Observable> recognizeTextInStream(@Body RequestBody image, @Query("mode") TextRecognitionMode mode, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @@ -290,79 +308,11 @@ interface ComputerVisionClientService { } /** - * 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. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ComputerVisionErrorException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ListModelsResult object if successful. - */ - public ListModelsResult listModels() { - return listModelsWithServiceResponseAsync().toBlocking().single().body(); - } - - /** - * 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. - * - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture listModelsAsync(final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listModelsWithServiceResponseAsync(), serviceCallback); - } - - /** - * 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. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ListModelsResult object - */ - public Observable listModelsAsync() { - return listModelsWithServiceResponseAsync().map(new Func1, ListModelsResult>() { - @Override - public ListModelsResult call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * 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. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ListModelsResult object - */ - public Observable> listModelsWithServiceResponseAsync() { - if (this.endpoint() == null) { - throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); - } - String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.listModels(this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = listModelsDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse listModelsDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ComputerVisionErrorException.class) - .build(response); - } - - /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -373,9 +323,11 @@ public ImageAnalysis analyzeImage(String url) { } /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -385,9 +337,11 @@ public ServiceFuture analyzeImageAsync(String url, final ServiceC } /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImageAnalysis object */ @@ -401,9 +355,11 @@ public ImageAnalysis call(ServiceResponse response) { } /** - * 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. + * 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 + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImageAnalysis object */ @@ -436,11 +392,13 @@ public Observable> call(Response re } /** - * 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. + * 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 - * @param visualFeatures 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. - * @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. + * @param url Publicly reachable URL of an image. + * @param visualFeatures 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. + * @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. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server @@ -452,11 +410,13 @@ public ImageAnalysis analyzeImage(String url, List visualFea } /** - * 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. + * 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 - * @param visualFeatures 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. - * @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. + * @param url Publicly reachable URL of an image. + * @param visualFeatures 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. + * @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. * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -467,11 +427,13 @@ public ServiceFuture analyzeImageAsync(String url, List response) { } /** - * 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. + * 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 - * @param visualFeatures 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. - * @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. + * @param url Publicly reachable URL of an image. + * @param visualFeatures 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. + * @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. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImageAnalysis object @@ -530,78 +494,79 @@ private ServiceResponse analyzeImageDelegate(Response generateThumbnailAsync(int width, int height, String url, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(generateThumbnailWithServiceResponseAsync(width, height, url), serviceCallback); + public ServiceFuture describeImageAsync(String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(describeImageWithServiceResponseAsync(url), serviceCallback); } /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the ImageDescription object */ - public Observable generateThumbnailAsync(int width, int height, String url) { - return generateThumbnailWithServiceResponseAsync(width, height, url).map(new Func1, InputStream>() { + public Observable describeImageAsync(String url) { + return describeImageWithServiceResponseAsync(url).map(new Func1, ImageDescription>() { @Override - public InputStream call(ServiceResponse response) { + public ImageDescription call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the ImageDescription object */ - public Observable> generateThumbnailWithServiceResponseAsync(int width, int height, String url) { + public Observable> describeImageWithServiceResponseAsync(String url) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } - final Boolean smartCropping = null; + final Integer maxCandidates = null; + final String language = null; ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.generateThumbnail(width, height, smartCropping, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.describeImage(maxCandidates, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = generateThumbnailDelegate(response); + ServiceResponse clientResponse = describeImageDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -611,66 +576,70 @@ public Observable> call(Response resp } /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image - * @param smartCropping Boolean flag for enabling smart cropping. + * @param url Publicly reachable URL of an image. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the InputStream object if successful. + * @return the ImageDescription object if successful. */ - public InputStream generateThumbnail(int width, int height, String url, Boolean smartCropping) { - return generateThumbnailWithServiceResponseAsync(width, height, url, smartCropping).toBlocking().single().body(); + public ImageDescription describeImage(String url, Integer maxCandidates, String language) { + return describeImageWithServiceResponseAsync(url, maxCandidates, language).toBlocking().single().body(); } /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image - * @param smartCropping Boolean flag for enabling smart cropping. + * @param url Publicly reachable URL of an image. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture generateThumbnailAsync(int width, int height, String url, Boolean smartCropping, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(generateThumbnailWithServiceResponseAsync(width, height, url, smartCropping), serviceCallback); + public ServiceFuture describeImageAsync(String url, Integer maxCandidates, String language, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(describeImageWithServiceResponseAsync(url, maxCandidates, language), serviceCallback); } /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image - * @param smartCropping Boolean flag for enabling smart cropping. + * @param url Publicly reachable URL of an image. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the ImageDescription object */ - public Observable generateThumbnailAsync(int width, int height, String url, Boolean smartCropping) { - return generateThumbnailWithServiceResponseAsync(width, height, url, smartCropping).map(new Func1, InputStream>() { + public Observable describeImageAsync(String url, Integer maxCandidates, String language) { + return describeImageWithServiceResponseAsync(url, maxCandidates, language).map(new Func1, ImageDescription>() { @Override - public InputStream call(ServiceResponse response) { + public ImageDescription call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param url Publicly reachable URL of an image - * @param smartCropping Boolean flag for enabling smart cropping. + * @param url Publicly reachable URL of an image. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the ImageDescription object */ - public Observable> generateThumbnailWithServiceResponseAsync(int width, int height, String url, Boolean smartCropping) { + public Observable> describeImageWithServiceResponseAsync(String url, Integer maxCandidates, String language) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } @@ -680,12 +649,12 @@ public Observable> generateThumbnailWithServiceResp ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.generateThumbnail(width, height, smartCropping, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.describeImage(maxCandidates, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = generateThumbnailDelegate(response); + ServiceResponse clientResponse = describeImageDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -694,82 +663,85 @@ public Observable> call(Response resp }); } - private ServiceResponse generateThumbnailDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse describeImageDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ComputerVisionErrorException.class) .build(response); } /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the OcrResult object if successful. + * @return the DetectResult object if successful. */ - public OcrResult recognizePrintedText(boolean detectOrientation, String url) { - return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url).toBlocking().single().body(); + public DetectResult detectObjects(String url) { + return detectObjectsWithServiceResponseAsync(url).toBlocking().single().body(); } /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture recognizePrintedTextAsync(boolean detectOrientation, String url, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(recognizePrintedTextWithServiceResponseAsync(detectOrientation, url), serviceCallback); + public ServiceFuture detectObjectsAsync(String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detectObjectsWithServiceResponseAsync(url), serviceCallback); } /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the DetectResult object */ - public Observable recognizePrintedTextAsync(boolean detectOrientation, String url) { - return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url).map(new Func1, OcrResult>() { + public Observable detectObjectsAsync(String url) { + return detectObjectsWithServiceResponseAsync(url).map(new Func1, DetectResult>() { @Override - public OcrResult call(ServiceResponse response) { + public DetectResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the DetectResult object */ - public Observable> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url) { + public Observable> detectObjectsWithServiceResponseAsync(String url) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } - final OcrLanguages language = null; ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.recognizePrintedText(detectOrientation, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.detectObjects(this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = recognizePrintedTextDelegate(response); + ServiceResponse clientResponse = detectObjectsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -778,78 +750,72 @@ public Observable> call(Response respon }); } + private ServiceResponse detectObjectsDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ComputerVisionErrorException.class) + .build(response); + } + /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image - * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the OcrResult object if successful. + * @return the ListModelsResult object if successful. */ - public OcrResult recognizePrintedText(boolean detectOrientation, String url, OcrLanguages language) { - return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, language).toBlocking().single().body(); + public ListModelsResult listModels() { + return listModelsWithServiceResponseAsync().toBlocking().single().body(); } /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image - * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture recognizePrintedTextAsync(boolean detectOrientation, String url, OcrLanguages language, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, language), serviceCallback); + public ServiceFuture listModelsAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listModelsWithServiceResponseAsync(), serviceCallback); } /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image - * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the ListModelsResult object */ - public Observable recognizePrintedTextAsync(boolean detectOrientation, String url, OcrLanguages language) { - return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, language).map(new Func1, OcrResult>() { - @Override - public OcrResult call(ServiceResponse response) { + public Observable listModelsAsync() { + return listModelsWithServiceResponseAsync().map(new Func1, ListModelsResult>() { + @Override + public ListModelsResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 detectOrientation 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). - * @param url Publicly reachable URL of an image - * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the ListModelsResult object */ - public Observable> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url, OcrLanguages language) { + public Observable> listModelsWithServiceResponseAsync() { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } - if (url == null) { - throw new IllegalArgumentException("Parameter url is required and cannot be null."); - } - ImageUrl imageUrl = new ImageUrl(); - imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.recognizePrintedText(detectOrientation, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listModels(this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = recognizePrintedTextDelegate(response); + ServiceResponse clientResponse = listModelsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -858,79 +824,97 @@ public Observable> call(Response respon }); } - private ServiceResponse recognizePrintedTextDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse listModelsDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(ComputerVisionErrorException.class) .build(response); } /** - * 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. + * 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 url Publicly reachable URL of an image + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageDescription object if successful. + * @return the DomainModelResults object if successful. */ - public ImageDescription describeImage(String url) { - return describeImageWithServiceResponseAsync(url).toBlocking().single().body(); + public DomainModelResults analyzeImageByDomain(String model, String url) { + return analyzeImageByDomainWithServiceResponseAsync(model, url).toBlocking().single().body(); } /** - * 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. + * 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 url Publicly reachable URL of an image + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture describeImageAsync(String url, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(describeImageWithServiceResponseAsync(url), serviceCallback); + public ServiceFuture analyzeImageByDomainAsync(String model, String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(analyzeImageByDomainWithServiceResponseAsync(model, url), serviceCallback); } /** - * 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. + * 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 url Publicly reachable URL of an image + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - public Observable describeImageAsync(String url) { - return describeImageWithServiceResponseAsync(url).map(new Func1, ImageDescription>() { + public Observable analyzeImageByDomainAsync(String model, String url) { + return analyzeImageByDomainWithServiceResponseAsync(model, url).map(new Func1, DomainModelResults>() { @Override - public ImageDescription call(ServiceResponse response) { + public DomainModelResults call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 url Publicly reachable URL of an image + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - public Observable> describeImageWithServiceResponseAsync(String url) { + public Observable> analyzeImageByDomainWithServiceResponseAsync(String model, String url) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } + if (model == null) { + throw new IllegalArgumentException("Parameter model is required and cannot be null."); + } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } - final Integer maxCandidates = null; final String language = null; ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.describeImage(maxCandidates, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.analyzeImageByDomain(model, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = describeImageDelegate(response); + ServiceResponse clientResponse = analyzeImageByDomainDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -940,77 +924,92 @@ public Observable> call(Response } /** - * 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. + * 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 url Publicly reachable URL of an image - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageDescription object if successful. + * @return the DomainModelResults object if successful. */ - public ImageDescription describeImage(String url, Integer maxCandidates, String language) { - return describeImageWithServiceResponseAsync(url, maxCandidates, language).toBlocking().single().body(); + public DomainModelResults analyzeImageByDomain(String model, String url, String language) { + return analyzeImageByDomainWithServiceResponseAsync(model, url, language).toBlocking().single().body(); } /** - * 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. + * 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 url Publicly reachable URL of an image - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture describeImageAsync(String url, Integer maxCandidates, String language, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(describeImageWithServiceResponseAsync(url, maxCandidates, language), serviceCallback); + public ServiceFuture analyzeImageByDomainAsync(String model, String url, String language, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(analyzeImageByDomainWithServiceResponseAsync(model, url, language), serviceCallback); } /** - * 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. + * 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 url Publicly reachable URL of an image - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - public Observable describeImageAsync(String url, Integer maxCandidates, String language) { - return describeImageWithServiceResponseAsync(url, maxCandidates, language).map(new Func1, ImageDescription>() { + public Observable analyzeImageByDomainAsync(String model, String url, String language) { + return analyzeImageByDomainWithServiceResponseAsync(model, url, language).map(new Func1, DomainModelResults>() { @Override - public ImageDescription call(ServiceResponse response) { + public DomainModelResults call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 url Publicly reachable URL of an image - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @param model The domain-specific content to recognize. + * @param url Publicly reachable URL of an image. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - public Observable> describeImageWithServiceResponseAsync(String url, Integer maxCandidates, String language) { + public Observable> analyzeImageByDomainWithServiceResponseAsync(String model, String url, String language) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } + if (model == null) { + throw new IllegalArgumentException("Parameter model is required and cannot be null."); + } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.describeImage(maxCandidates, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.analyzeImageByDomain(model, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = describeImageDelegate(response); + ServiceResponse clientResponse = analyzeImageByDomainDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1019,78 +1018,90 @@ public Observable> call(Response }); } - private ServiceResponse describeImageDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse analyzeImageByDomainDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(ComputerVisionErrorException.class) .build(response); } /** - * 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. + * 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 url Publicly reachable URL of an image + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the TagResult object if successful. + * @return the OcrResult object if successful. */ - public TagResult tagImage(String url) { - return tagImageWithServiceResponseAsync(url).toBlocking().single().body(); + public OcrResult recognizePrintedText(boolean detectOrientation, String url) { + return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url).toBlocking().single().body(); } /** - * 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. + * 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 url Publicly reachable URL of an image + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture tagImageAsync(String url, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(tagImageWithServiceResponseAsync(url), serviceCallback); + public ServiceFuture recognizePrintedTextAsync(boolean detectOrientation, String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(recognizePrintedTextWithServiceResponseAsync(detectOrientation, url), serviceCallback); } /** - * 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. + * 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 url Publicly reachable URL of an image + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - public Observable tagImageAsync(String url) { - return tagImageWithServiceResponseAsync(url).map(new Func1, TagResult>() { + public Observable recognizePrintedTextAsync(boolean detectOrientation, String url) { + return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url).map(new Func1, OcrResult>() { @Override - public TagResult call(ServiceResponse response) { + public OcrResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 url Publicly reachable URL of an image + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - public Observable> tagImageWithServiceResponseAsync(String url) { + public Observable> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } - final String language = null; + final OcrLanguages language = null; ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.tagImage(language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.recognizePrintedText(detectOrientation, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = tagImageDelegate(response); + ServiceResponse clientResponse = recognizePrintedTextDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1100,58 +1111,70 @@ public Observable> call(Response respon } /** - * 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. + * 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 url Publicly reachable URL of an image - * @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' + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the TagResult object if successful. + * @return the OcrResult object if successful. */ - public TagResult tagImage(String url, String language) { - return tagImageWithServiceResponseAsync(url, language).toBlocking().single().body(); + public OcrResult recognizePrintedText(boolean detectOrientation, String url, OcrLanguages language) { + return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, language).toBlocking().single().body(); } /** - * 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. + * 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 url Publicly reachable URL of an image - * @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' + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. + * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture tagImageAsync(String url, String language, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(tagImageWithServiceResponseAsync(url, language), serviceCallback); + public ServiceFuture recognizePrintedTextAsync(boolean detectOrientation, String url, OcrLanguages language, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, language), serviceCallback); } /** - * 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. + * 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 url Publicly reachable URL of an image - * @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' + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - public Observable tagImageAsync(String url, String language) { - return tagImageWithServiceResponseAsync(url, language).map(new Func1, TagResult>() { + public Observable recognizePrintedTextAsync(boolean detectOrientation, String url, OcrLanguages language) { + return recognizePrintedTextWithServiceResponseAsync(detectOrientation, url, language).map(new Func1, OcrResult>() { @Override - public TagResult call(ServiceResponse response) { + public OcrResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 url Publicly reachable URL of an image - * @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' + * @param detectOrientation 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). + * @param url Publicly reachable URL of an image. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - public Observable> tagImageWithServiceResponseAsync(String url, String language) { + public Observable> recognizePrintedTextWithServiceResponseAsync(boolean detectOrientation, String url, OcrLanguages language) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } @@ -1161,12 +1184,12 @@ public Observable> tagImageWithServiceResponseAsync(S ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.tagImage(language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.recognizePrintedText(detectOrientation, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = tagImageDelegate(response); + ServiceResponse clientResponse = recognizePrintedTextDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1175,72 +1198,73 @@ public Observable> call(Response respon }); } - private ServiceResponse tagImageDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse recognizePrintedTextDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(ComputerVisionErrorException.class) .build(response); } /** - * 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. + * 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. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the DomainModelResults object if successful. + * @return the TagResult object if successful. */ - public DomainModelResults analyzeImageByDomain(String model, String url) { - return analyzeImageByDomainWithServiceResponseAsync(model, url).toBlocking().single().body(); + public TagResult tagImage(String url) { + return tagImageWithServiceResponseAsync(url).toBlocking().single().body(); } /** - * 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. + * 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. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture analyzeImageByDomainAsync(String model, String url, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(analyzeImageByDomainWithServiceResponseAsync(model, url), serviceCallback); + public ServiceFuture tagImageAsync(String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(tagImageWithServiceResponseAsync(url), serviceCallback); } /** - * 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. + * 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. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - public Observable analyzeImageByDomainAsync(String model, String url) { - return analyzeImageByDomainWithServiceResponseAsync(model, url).map(new Func1, DomainModelResults>() { + public Observable tagImageAsync(String url) { + return tagImageWithServiceResponseAsync(url).map(new Func1, TagResult>() { @Override - public DomainModelResults call(ServiceResponse response) { + public TagResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - public Observable> analyzeImageByDomainWithServiceResponseAsync(String model, String url) { + public Observable> tagImageWithServiceResponseAsync(String url) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } - if (model == null) { - throw new IllegalArgumentException("Parameter model is required and cannot be null."); - } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } @@ -1248,12 +1272,12 @@ public Observable> analyzeImageByDomainWithS ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.analyzeImageByDomain(model, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.tagImage(language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = analyzeImageByDomainDelegate(response); + ServiceResponse clientResponse = tagImageDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1263,80 +1287,177 @@ public Observable> call(Response analyzeImageByDomainAsync(String model, String url, String language, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(analyzeImageByDomainWithServiceResponseAsync(model, url, language), serviceCallback); + public ServiceFuture tagImageAsync(String url, String language, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(tagImageWithServiceResponseAsync(url, language), serviceCallback); } /** - * 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. + * 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. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - public Observable analyzeImageByDomainAsync(String model, String url, String language) { - return analyzeImageByDomainWithServiceResponseAsync(model, url, language).map(new Func1, DomainModelResults>() { + public Observable tagImageAsync(String url, String language) { + return tagImageWithServiceResponseAsync(url, language).map(new Func1, TagResult>() { @Override - public DomainModelResults call(ServiceResponse response) { + public TagResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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. - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - public Observable> analyzeImageByDomainWithServiceResponseAsync(String model, String url, String language) { + public Observable> tagImageWithServiceResponseAsync(String url, String language) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } - if (model == null) { - throw new IllegalArgumentException("Parameter model is required and cannot be null."); + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + ImageUrl imageUrl = new ImageUrl(); + imageUrl.withUrl(url); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.tagImage(language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = tagImageDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse tagImageDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ComputerVisionErrorException.class) + .build(response); + } + + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InputStream object if successful. + */ + public InputStream generateThumbnail(int width, int height, String url) { + return generateThumbnailWithServiceResponseAsync(width, height, url).toBlocking().single().body(); + } + + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture generateThumbnailAsync(int width, int height, String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateThumbnailWithServiceResponseAsync(width, height, url), serviceCallback); + } + + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable generateThumbnailAsync(int width, int height, String url) { + return generateThumbnailWithServiceResponseAsync(width, height, url).map(new Func1, InputStream>() { + @Override + public InputStream call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable> generateThumbnailWithServiceResponseAsync(int width, int height, String url) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } + final Boolean smartCropping = null; ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.analyzeImageByDomain(model, language, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.generateThumbnail(width, height, smartCropping, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = analyzeImageByDomainDelegate(response); + ServiceResponse clientResponse = generateThumbnailDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1345,9 +1466,188 @@ public Observable> call(Response analyzeImageByDomainDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @param smartCropping Boolean flag for enabling smart cropping. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InputStream object if successful. + */ + public InputStream generateThumbnail(int width, int height, String url, Boolean smartCropping) { + return generateThumbnailWithServiceResponseAsync(width, height, url, smartCropping).toBlocking().single().body(); + } + + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @param smartCropping Boolean flag for enabling smart cropping. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture generateThumbnailAsync(int width, int height, String url, Boolean smartCropping, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateThumbnailWithServiceResponseAsync(width, height, url, smartCropping), serviceCallback); + } + + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @param smartCropping Boolean flag for enabling smart cropping. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable generateThumbnailAsync(int width, int height, String url, Boolean smartCropping) { + return generateThumbnailWithServiceResponseAsync(width, height, url, smartCropping).map(new Func1, InputStream>() { + @Override + public InputStream call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param url Publicly reachable URL of an image. + * @param smartCropping Boolean flag for enabling smart cropping. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InputStream object + */ + public Observable> generateThumbnailWithServiceResponseAsync(int width, int height, String url, Boolean smartCropping) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + ImageUrl imageUrl = new ImageUrl(); + imageUrl.withUrl(url); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.generateThumbnail(width, height, smartCropping, this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = generateThumbnailDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse generateThumbnailDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AreaOfInterestResult object if successful. + */ + public AreaOfInterestResult getAreaOfInterest(String url) { + return getAreaOfInterestWithServiceResponseAsync(url).toBlocking().single().body(); + } + + /** + * 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 url Publicly reachable URL of an image. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAreaOfInterestAsync(String url, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAreaOfInterestWithServiceResponseAsync(url), serviceCallback); + } + + /** + * 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 url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AreaOfInterestResult object + */ + public Observable getAreaOfInterestAsync(String url) { + return getAreaOfInterestWithServiceResponseAsync(url).map(new Func1, AreaOfInterestResult>() { + @Override + public AreaOfInterestResult call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 url Publicly reachable URL of an image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AreaOfInterestResult object + */ + public Observable> getAreaOfInterestWithServiceResponseAsync(String url) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + ImageUrl imageUrl = new ImageUrl(); + imageUrl.withUrl(url); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.getAreaOfInterest(this.acceptLanguage(), imageUrl, parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAreaOfInterestDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAreaOfInterestDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(ComputerVisionErrorException.class) .build(response); } @@ -1356,7 +1656,7 @@ private ServiceResponse analyzeImageByDomainDelegate(Respons * Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. * * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -1369,7 +1669,7 @@ public void recognizeText(String url, TextRecognitionMode mode) { * Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. * * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -1382,7 +1682,7 @@ public ServiceFuture recognizeTextAsync(String url, TextRecognitionMode mo * Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. * * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponseWithHeaders} object if successful. */ @@ -1399,7 +1699,7 @@ public Void call(ServiceResponseWithHeaders response * Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. * * @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' - * @param url Publicly reachable URL of an image + * @param url Publicly reachable URL of an image. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponseWithHeaders} object if successful. */ @@ -1481,24 +1781,206 @@ public TextOperationResult call(ServiceResponse response) { /** * 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 operationId Id of the text operation returned in the response of the 'Recognize Text' + * @param operationId Id of the text operation returned in the response of the 'Recognize Text' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TextOperationResult object + */ + public Observable> getTextOperationResultWithServiceResponseAsync(String operationId) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + return service.getTextOperationResult(operationId, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getTextOperationResultDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getTextOperationResultDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ComputerVisionErrorException.class) + .build(response); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageAnalysis object if successful. + */ + public ImageAnalysis analyzeImageInStream(byte[] image) { + return analyzeImageInStreamWithServiceResponseAsync(image).toBlocking().single().body(); + } + + /** + * 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. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture analyzeImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(analyzeImageInStreamWithServiceResponseAsync(image), serviceCallback); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageAnalysis object + */ + public Observable analyzeImageInStreamAsync(byte[] image) { + return analyzeImageInStreamWithServiceResponseAsync(image).map(new Func1, ImageAnalysis>() { + @Override + public ImageAnalysis call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageAnalysis object + */ + public Observable> analyzeImageInStreamWithServiceResponseAsync(byte[] image) { + if (this.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); + } + if (image == null) { + throw new IllegalArgumentException("Parameter image is required and cannot be null."); + } + final List visualFeatures = null; + final List
details = null; + final String language = null; + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); + String visualFeaturesConverted = this.serializerAdapter().serializeList(visualFeatures, CollectionFormat.CSV);String detailsConverted = this.serializerAdapter().serializeList(details, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); + return service.analyzeImageInStream(visualFeaturesConverted, detailsConverted, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = analyzeImageInStreamDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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. + * @param visualFeatures 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. + * @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. + * @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' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageAnalysis object if successful. + */ + public ImageAnalysis analyzeImageInStream(byte[] image, List visualFeatures, List
details, String language) { + return analyzeImageInStreamWithServiceResponseAsync(image, visualFeatures, details, language).toBlocking().single().body(); + } + + /** + * 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. + * @param visualFeatures 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. + * @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. + * @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' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture analyzeImageInStreamAsync(byte[] image, List visualFeatures, List
details, String language, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(analyzeImageInStreamWithServiceResponseAsync(image, visualFeatures, details, language), serviceCallback); + } + + /** + * 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. + * @param visualFeatures 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. + * @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. + * @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' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageAnalysis object + */ + public Observable analyzeImageInStreamAsync(byte[] image, List visualFeatures, List
details, String language) { + return analyzeImageInStreamWithServiceResponseAsync(image, visualFeatures, details, language).map(new Func1, ImageAnalysis>() { + @Override + public ImageAnalysis call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @param visualFeatures 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. + * @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. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TextOperationResult object + * @return the observable to the ImageAnalysis object */ - public Observable> getTextOperationResultWithServiceResponseAsync(String operationId) { + public Observable> analyzeImageInStreamWithServiceResponseAsync(byte[] image, List visualFeatures, List
details, String language) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } - if (operationId == null) { - throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + if (image == null) { + throw new IllegalArgumentException("Parameter image is required and cannot be null."); } + Validator.validate(visualFeatures); + Validator.validate(details); String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - return service.getTextOperationResult(operationId, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + String visualFeaturesConverted = this.serializerAdapter().serializeList(visualFeatures, CollectionFormat.CSV);String detailsConverted = this.serializerAdapter().serializeList(details, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); + return service.analyzeImageInStream(visualFeaturesConverted, detailsConverted, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getTextOperationResultDelegate(response); + ServiceResponse clientResponse = analyzeImageInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1507,79 +1989,84 @@ public Observable> call(Response getTextOperationResultDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse analyzeImageInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(ComputerVisionErrorException.class) .build(response); } /** - * This operation extracts a rich set of visual features based on the image content. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageAnalysis object if successful. + * @return the AreaOfInterestResult object if successful. */ - public ImageAnalysis analyzeImageInStream(byte[] image) { - return analyzeImageInStreamWithServiceResponseAsync(image).toBlocking().single().body(); + public AreaOfInterestResult getAreaOfInterestInStream(byte[] image) { + return getAreaOfInterestInStreamWithServiceResponseAsync(image).toBlocking().single().body(); } /** - * This operation extracts a rich set of visual features based on the image content. + * 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. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture analyzeImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(analyzeImageInStreamWithServiceResponseAsync(image), serviceCallback); + public ServiceFuture getAreaOfInterestInStreamAsync(byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAreaOfInterestInStreamWithServiceResponseAsync(image), serviceCallback); } /** - * This operation extracts a rich set of visual features based on the image content. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageAnalysis object + * @return the observable to the AreaOfInterestResult object */ - public Observable analyzeImageInStreamAsync(byte[] image) { - return analyzeImageInStreamWithServiceResponseAsync(image).map(new Func1, ImageAnalysis>() { + public Observable getAreaOfInterestInStreamAsync(byte[] image) { + return getAreaOfInterestInStreamWithServiceResponseAsync(image).map(new Func1, AreaOfInterestResult>() { @Override - public ImageAnalysis call(ServiceResponse response) { + public AreaOfInterestResult call(ServiceResponse response) { return response.body(); } }); } /** - * This operation extracts a rich set of visual features based on the image content. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageAnalysis object + * @return the observable to the AreaOfInterestResult object */ - public Observable> analyzeImageInStreamWithServiceResponseAsync(byte[] image) { + public Observable> getAreaOfInterestInStreamWithServiceResponseAsync(byte[] image) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } - final List visualFeatures = null; - final List
details = null; - final String language = null; String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - String visualFeaturesConverted = this.serializerAdapter().serializeList(visualFeatures, CollectionFormat.CSV);String detailsConverted = this.serializerAdapter().serializeList(details, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.analyzeImageInStream(visualFeaturesConverted, detailsConverted, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); + return service.getAreaOfInterestInStream(imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = analyzeImageInStreamDelegate(response); + ServiceResponse clientResponse = getAreaOfInterestInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1588,83 +2075,86 @@ public Observable> call(Response re }); } + private ServiceResponse getAreaOfInterestInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ComputerVisionErrorException.class) + .build(response); + } + /** - * This operation extracts a rich set of visual features based on the image content. + * 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. - * @param visualFeatures 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. - * @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. - * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageAnalysis object if successful. + * @return the ImageDescription object if successful. */ - public ImageAnalysis analyzeImageInStream(byte[] image, List visualFeatures, List
details, String language) { - return analyzeImageInStreamWithServiceResponseAsync(image, visualFeatures, details, language).toBlocking().single().body(); + public ImageDescription describeImageInStream(byte[] image) { + return describeImageInStreamWithServiceResponseAsync(image).toBlocking().single().body(); } /** - * This operation extracts a rich set of visual features based on the image content. + * 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. - * @param visualFeatures 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. - * @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. - * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture analyzeImageInStreamAsync(byte[] image, List visualFeatures, List
details, String language, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(analyzeImageInStreamWithServiceResponseAsync(image, visualFeatures, details, language), serviceCallback); + public ServiceFuture describeImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(describeImageInStreamWithServiceResponseAsync(image), serviceCallback); } /** - * This operation extracts a rich set of visual features based on the image content. + * 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. - * @param visualFeatures 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. - * @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. - * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageAnalysis object + * @return the observable to the ImageDescription object */ - public Observable analyzeImageInStreamAsync(byte[] image, List visualFeatures, List
details, String language) { - return analyzeImageInStreamWithServiceResponseAsync(image, visualFeatures, details, language).map(new Func1, ImageAnalysis>() { + public Observable describeImageInStreamAsync(byte[] image) { + return describeImageInStreamWithServiceResponseAsync(image).map(new Func1, ImageDescription>() { @Override - public ImageAnalysis call(ServiceResponse response) { + public ImageDescription call(ServiceResponse response) { return response.body(); } }); } /** - * This operation extracts a rich set of visual features based on the image content. + * 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. - * @param visualFeatures 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. - * @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. - * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageAnalysis object + * @return the observable to the ImageDescription object */ - public Observable> analyzeImageInStreamWithServiceResponseAsync(byte[] image, List visualFeatures, List
details, String language) { + public Observable> describeImageInStreamWithServiceResponseAsync(byte[] image) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } - Validator.validate(visualFeatures); - Validator.validate(details); + final Integer maxCandidates = null; + final String language = null; String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); - String visualFeaturesConverted = this.serializerAdapter().serializeList(visualFeatures, CollectionFormat.CSV);String detailsConverted = this.serializerAdapter().serializeList(details, CollectionFormat.CSV);RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.analyzeImageInStream(visualFeaturesConverted, detailsConverted, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); + return service.describeImageInStream(maxCandidates, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = analyzeImageInStreamDelegate(response); + ServiceResponse clientResponse = describeImageInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1673,85 +2163,85 @@ public Observable> call(Response re }); } - private ServiceResponse analyzeImageInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ComputerVisionErrorException.class) - .build(response); - } - /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the InputStream object if successful. + * @return the ImageDescription object if successful. */ - public InputStream generateThumbnailInStream(int width, int height, byte[] image) { - return generateThumbnailInStreamWithServiceResponseAsync(width, height, image).toBlocking().single().body(); + public ImageDescription describeImageInStream(byte[] image, Integer maxCandidates, String language) { + return describeImageInStreamWithServiceResponseAsync(image, maxCandidates, language).toBlocking().single().body(); } /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture generateThumbnailInStreamAsync(int width, int height, byte[] image, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(generateThumbnailInStreamWithServiceResponseAsync(width, height, image), serviceCallback); + public ServiceFuture describeImageInStreamAsync(byte[] image, Integer maxCandidates, String language, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(describeImageInStreamWithServiceResponseAsync(image, maxCandidates, language), serviceCallback); } /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the ImageDescription object */ - public Observable generateThumbnailInStreamAsync(int width, int height, byte[] image) { - return generateThumbnailInStreamWithServiceResponseAsync(width, height, image).map(new Func1, InputStream>() { + public Observable describeImageInStreamAsync(byte[] image, Integer maxCandidates, String language) { + return describeImageInStreamWithServiceResponseAsync(image, maxCandidates, language).map(new Func1, ImageDescription>() { @Override - public InputStream call(ServiceResponse response) { + public ImageDescription call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. + * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the ImageDescription object */ - public Observable> generateThumbnailInStreamWithServiceResponseAsync(int width, int height, byte[] image) { + public Observable> describeImageInStreamWithServiceResponseAsync(byte[] image, Integer maxCandidates, String language) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } - final Boolean smartCropping = null; String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.generateThumbnailInStream(width, height, imageConverted, smartCropping, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.describeImageInStream(maxCandidates, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = generateThumbnailInStreamDelegate(response); + ServiceResponse clientResponse = describeImageInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1760,67 +2250,70 @@ public Observable> call(Response resp }); } + private ServiceResponse describeImageInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ComputerVisionErrorException.class) + .build(response); + } + /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the InputStream object if successful. + * @return the DetectResult object if successful. */ - public InputStream generateThumbnailInStream(int width, int height, byte[] image, Boolean smartCropping) { - return generateThumbnailInStreamWithServiceResponseAsync(width, height, image, smartCropping).toBlocking().single().body(); + public DetectResult detectObjectsInStream(byte[] image) { + return detectObjectsInStreamWithServiceResponseAsync(image).toBlocking().single().body(); } /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @param smartCropping Boolean flag for enabling smart cropping. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture generateThumbnailInStreamAsync(int width, int height, byte[] image, Boolean smartCropping, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(generateThumbnailInStreamWithServiceResponseAsync(width, height, image, smartCropping), serviceCallback); + public ServiceFuture detectObjectsInStreamAsync(byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detectObjectsInStreamWithServiceResponseAsync(image), serviceCallback); } /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the DetectResult object */ - public Observable generateThumbnailInStreamAsync(int width, int height, byte[] image, Boolean smartCropping) { - return generateThumbnailInStreamWithServiceResponseAsync(width, height, image, smartCropping).map(new Func1, InputStream>() { + public Observable detectObjectsInStreamAsync(byte[] image) { + return detectObjectsInStreamWithServiceResponseAsync(image).map(new Func1, DetectResult>() { @Override - public InputStream call(ServiceResponse response) { + public DetectResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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. - * @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InputStream object + * @return the observable to the DetectResult object */ - public Observable> generateThumbnailInStreamWithServiceResponseAsync(int width, int height, byte[] image, Boolean smartCropping) { + public Observable> detectObjectsInStreamWithServiceResponseAsync(byte[] image) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } @@ -1829,12 +2322,12 @@ public Observable> generateThumbnailInStreamWithSer } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.generateThumbnailInStream(width, height, imageConverted, smartCropping, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.detectObjectsInStream(imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = generateThumbnailInStreamDelegate(response); + ServiceResponse clientResponse = detectObjectsInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1843,81 +2336,93 @@ public Observable> call(Response resp }); } - private ServiceResponse generateThumbnailInStreamDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse detectObjectsInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ComputerVisionErrorException.class) .build(response); } /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the OcrResult object if successful. + * @return the InputStream object if successful. */ - public OcrResult recognizePrintedTextInStream(boolean detectOrientation, byte[] image) { - return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image).toBlocking().single().body(); + public InputStream generateThumbnailInStream(int width, int height, byte[] image) { + return generateThumbnailInStreamWithServiceResponseAsync(width, height, image).toBlocking().single().body(); } /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image), serviceCallback); + public ServiceFuture generateThumbnailInStreamAsync(int width, int height, byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateThumbnailInStreamWithServiceResponseAsync(width, height, image), serviceCallback); } /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the InputStream object */ - public Observable recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image) { - return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image).map(new Func1, OcrResult>() { + public Observable generateThumbnailInStreamAsync(int width, int height, byte[] image) { + return generateThumbnailInStreamWithServiceResponseAsync(width, height, image).map(new Func1, InputStream>() { @Override - public OcrResult call(ServiceResponse response) { + public InputStream call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the InputStream object */ - public Observable> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image) { + public Observable> generateThumbnailInStreamWithServiceResponseAsync(int width, int height, byte[] image) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } - final OcrLanguages language = null; + final Boolean smartCropping = null; String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.recognizePrintedTextInStream(language, detectOrientation, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.generateThumbnailInStream(width, height, smartCropping, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = recognizePrintedTextInStreamDelegate(response); + ServiceResponse clientResponse = generateThumbnailInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1927,62 +2432,74 @@ public Observable> call(Response respon } /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @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' + * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ComputerVisionErrorException thrown if the request is rejected by server + * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the OcrResult object if successful. + * @return the InputStream object if successful. */ - public OcrResult recognizePrintedTextInStream(boolean detectOrientation, byte[] image, OcrLanguages language) { - return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, language).toBlocking().single().body(); + public InputStream generateThumbnailInStream(int width, int height, byte[] image, Boolean smartCropping) { + return generateThumbnailInStreamWithServiceResponseAsync(width, height, image, smartCropping).toBlocking().single().body(); } /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @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' + * @param smartCropping Boolean flag for enabling smart cropping. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, OcrLanguages language, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, language), serviceCallback); + public ServiceFuture generateThumbnailInStreamAsync(int width, int height, byte[] image, Boolean smartCropping, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateThumbnailInStreamWithServiceResponseAsync(width, height, image, smartCropping), serviceCallback); } /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @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' + * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the InputStream object */ - public Observable recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, OcrLanguages language) { - return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, language).map(new Func1, OcrResult>() { + public Observable generateThumbnailInStreamAsync(int width, int height, byte[] image, Boolean smartCropping) { + return generateThumbnailInStreamWithServiceResponseAsync(width, height, image, smartCropping).map(new Func1, InputStream>() { @Override - public OcrResult call(ServiceResponse response) { + public InputStream call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 detectOrientation 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). + * @param width Width of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. + * @param height Height of the thumbnail, in pixels. It must be between 1 and 1024. Recommended minimum of 50. * @param image An image stream. - * @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' + * @param smartCropping Boolean flag for enabling smart cropping. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OcrResult object + * @return the observable to the InputStream object */ - public Observable> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image, OcrLanguages language) { + public Observable> generateThumbnailInStreamWithServiceResponseAsync(int width, int height, byte[] image, Boolean smartCropping) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } @@ -1991,12 +2508,12 @@ public Observable> recognizePrintedTextInStreamWithSe } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.recognizePrintedTextInStream(language, detectOrientation, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.generateThumbnailInStream(width, height, smartCropping, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = recognizePrintedTextInStreamDelegate(response); + ServiceResponse clientResponse = generateThumbnailInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2005,78 +2522,96 @@ public Observable> call(Response respon }); } - private ServiceResponse recognizePrintedTextInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ComputerVisionErrorException.class) + private ServiceResponse generateThumbnailInStreamDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) .build(response); } /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageDescription object if successful. + * @return the DomainModelResults object if successful. */ - public ImageDescription describeImageInStream(byte[] image) { - return describeImageInStreamWithServiceResponseAsync(image).toBlocking().single().body(); + public DomainModelResults analyzeImageByDomainInStream(String model, byte[] image) { + return analyzeImageByDomainInStreamWithServiceResponseAsync(model, image).toBlocking().single().body(); } /** - * 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. + * 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. * @param image An image stream. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture describeImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(describeImageInStreamWithServiceResponseAsync(image), serviceCallback); + public ServiceFuture analyzeImageByDomainInStreamAsync(String model, byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(analyzeImageByDomainInStreamWithServiceResponseAsync(model, image), serviceCallback); } /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - public Observable describeImageInStreamAsync(byte[] image) { - return describeImageInStreamWithServiceResponseAsync(image).map(new Func1, ImageDescription>() { + public Observable analyzeImageByDomainInStreamAsync(String model, byte[] image) { + return analyzeImageByDomainInStreamWithServiceResponseAsync(model, image).map(new Func1, DomainModelResults>() { @Override - public ImageDescription call(ServiceResponse response) { + public DomainModelResults call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - public Observable> describeImageInStreamWithServiceResponseAsync(byte[] image) { + public Observable> analyzeImageByDomainInStreamWithServiceResponseAsync(String model, byte[] image) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } + if (model == null) { + throw new IllegalArgumentException("Parameter model is required and cannot be null."); + } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } - final Integer maxCandidates = null; final String language = null; String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.describeImageInStream(maxCandidates, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.analyzeImageByDomainInStream(model, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = describeImageInStreamDelegate(response); + ServiceResponse clientResponse = analyzeImageByDomainInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2086,76 +2621,91 @@ public Observable> call(Response } /** - * 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. + * 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. * @param image An image stream. - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageDescription object if successful. + * @return the DomainModelResults object if successful. */ - public ImageDescription describeImageInStream(byte[] image, Integer maxCandidates, String language) { - return describeImageInStreamWithServiceResponseAsync(image, maxCandidates, language).toBlocking().single().body(); + public DomainModelResults analyzeImageByDomainInStream(String model, byte[] image, String language) { + return analyzeImageByDomainInStreamWithServiceResponseAsync(model, image, language).toBlocking().single().body(); } /** - * 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. + * 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. * @param image An image stream. - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture describeImageInStreamAsync(byte[] image, Integer maxCandidates, String language, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(describeImageInStreamWithServiceResponseAsync(image, maxCandidates, language), serviceCallback); + public ServiceFuture analyzeImageByDomainInStreamAsync(String model, byte[] image, String language, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(analyzeImageByDomainInStreamWithServiceResponseAsync(model, image, language), serviceCallback); } /** - * 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. + * 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. * @param image An image stream. - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - public Observable describeImageInStreamAsync(byte[] image, Integer maxCandidates, String language) { - return describeImageInStreamWithServiceResponseAsync(image, maxCandidates, language).map(new Func1, ImageDescription>() { + public Observable analyzeImageByDomainInStreamAsync(String model, byte[] image, String language) { + return analyzeImageByDomainInStreamWithServiceResponseAsync(model, image, language).map(new Func1, DomainModelResults>() { @Override - public ImageDescription call(ServiceResponse response) { + public DomainModelResults call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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. * @param image An image stream. - * @param maxCandidates Maximum number of candidate descriptions to be returned. The default is 1. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageDescription object + * @return the observable to the DomainModelResults object */ - public Observable> describeImageInStreamWithServiceResponseAsync(byte[] image, Integer maxCandidates, String language) { + public Observable> analyzeImageByDomainInStreamWithServiceResponseAsync(String model, byte[] image, String language) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } + if (model == null) { + throw new IllegalArgumentException("Parameter model is required and cannot be null."); + } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.describeImageInStream(maxCandidates, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.analyzeImageByDomainInStream(model, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = describeImageInStreamDelegate(response); + ServiceResponse clientResponse = analyzeImageByDomainInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2164,77 +2714,89 @@ public Observable> call(Response }); } - private ServiceResponse describeImageInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse analyzeImageByDomainInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(ComputerVisionErrorException.class) .build(response); } /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the TagResult object if successful. + * @return the OcrResult object if successful. */ - public TagResult tagImageInStream(byte[] image) { - return tagImageInStreamWithServiceResponseAsync(image).toBlocking().single().body(); + public OcrResult recognizePrintedTextInStream(boolean detectOrientation, byte[] image) { + return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image).toBlocking().single().body(); } /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture tagImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(tagImageInStreamWithServiceResponseAsync(image), serviceCallback); + public ServiceFuture recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image), serviceCallback); } /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - public Observable tagImageInStreamAsync(byte[] image) { - return tagImageInStreamWithServiceResponseAsync(image).map(new Func1, TagResult>() { + public Observable recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image) { + return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image).map(new Func1, OcrResult>() { @Override - public TagResult call(ServiceResponse response) { + public OcrResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - public Observable> tagImageInStreamWithServiceResponseAsync(byte[] image) { + public Observable> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } - final String language = null; + final OcrLanguages language = null; String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.tagImageInStream(language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.recognizePrintedTextInStream(detectOrientation, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = tagImageInStreamDelegate(response); + ServiceResponse clientResponse = recognizePrintedTextInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2244,58 +2806,70 @@ public Observable> call(Response respon } /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. - * @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' + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the TagResult object if successful. + * @return the OcrResult object if successful. */ - public TagResult tagImageInStream(byte[] image, String language) { - return tagImageInStreamWithServiceResponseAsync(image, language).toBlocking().single().body(); + public OcrResult recognizePrintedTextInStream(boolean detectOrientation, byte[] image, OcrLanguages language) { + return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, language).toBlocking().single().body(); } /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. - * @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' + * @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' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture tagImageInStreamAsync(byte[] image, String language, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(tagImageInStreamWithServiceResponseAsync(image, language), serviceCallback); + public ServiceFuture recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, OcrLanguages language, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, language), serviceCallback); } /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. - * @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' + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - public Observable tagImageInStreamAsync(byte[] image, String language) { - return tagImageInStreamWithServiceResponseAsync(image, language).map(new Func1, TagResult>() { + public Observable recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, OcrLanguages language) { + return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, language).map(new Func1, OcrResult>() { @Override - public TagResult call(ServiceResponse response) { + public OcrResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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 detectOrientation 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). * @param image An image stream. - * @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' + * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TagResult object + * @return the observable to the OcrResult object */ - public Observable> tagImageInStreamWithServiceResponseAsync(byte[] image, String language) { + public Observable> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image, OcrLanguages language) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } @@ -2304,12 +2878,12 @@ public Observable> tagImageInStreamWithServiceRespons } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.tagImageInStream(language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.recognizePrintedTextInStream(detectOrientation, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = tagImageInStreamDelegate(response); + ServiceResponse clientResponse = recognizePrintedTextInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2318,84 +2892,85 @@ public Observable> call(Response respon }); } - private ServiceResponse tagImageInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse recognizePrintedTextInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(ComputerVisionErrorException.class) .build(response); } /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ComputerVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the DomainModelResults object if successful. + * @return the TagResult object if successful. */ - public DomainModelResults analyzeImageByDomainInStream(String model, byte[] image) { - return analyzeImageByDomainInStreamWithServiceResponseAsync(model, image).toBlocking().single().body(); + public TagResult tagImageInStream(byte[] image) { + return tagImageInStreamWithServiceResponseAsync(image).toBlocking().single().body(); } /** - * 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. + * 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. * @param image An image stream. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture analyzeImageByDomainInStreamAsync(String model, byte[] image, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(analyzeImageByDomainInStreamWithServiceResponseAsync(model, image), serviceCallback); + public ServiceFuture tagImageInStreamAsync(byte[] image, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(tagImageInStreamWithServiceResponseAsync(image), serviceCallback); } /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - public Observable analyzeImageByDomainInStreamAsync(String model, byte[] image) { - return analyzeImageByDomainInStreamWithServiceResponseAsync(model, image).map(new Func1, DomainModelResults>() { + public Observable tagImageInStreamAsync(byte[] image) { + return tagImageInStreamWithServiceResponseAsync(image).map(new Func1, TagResult>() { @Override - public DomainModelResults call(ServiceResponse response) { + public TagResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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. * @param image An image stream. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - public Observable> analyzeImageByDomainInStreamWithServiceResponseAsync(String model, byte[] image) { + public Observable> tagImageInStreamWithServiceResponseAsync(byte[] image) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } - if (model == null) { - throw new IllegalArgumentException("Parameter model is required and cannot be null."); - } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } final String language = null; String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.analyzeImageByDomainInStream(model, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.tagImageInStream(language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = analyzeImageByDomainInStreamDelegate(response); + ServiceResponse clientResponse = tagImageInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2405,79 +2980,80 @@ public Observable> call(Response analyzeImageByDomainInStreamAsync(String model, byte[] image, String language, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(analyzeImageByDomainInStreamWithServiceResponseAsync(model, image, language), serviceCallback); + public ServiceFuture tagImageInStreamAsync(byte[] image, String language, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(tagImageInStreamWithServiceResponseAsync(image, language), serviceCallback); } /** - * 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. + * 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. * @param image An image stream. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - public Observable analyzeImageByDomainInStreamAsync(String model, byte[] image, String language) { - return analyzeImageByDomainInStreamWithServiceResponseAsync(model, image, language).map(new Func1, DomainModelResults>() { + public Observable tagImageInStreamAsync(byte[] image, String language) { + return tagImageInStreamWithServiceResponseAsync(image, language).map(new Func1, TagResult>() { @Override - public DomainModelResults call(ServiceResponse response) { + public TagResult call(ServiceResponse response) { return response.body(); } }); } /** - * 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. + * 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. * @param image An image stream. * @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' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DomainModelResults object + * @return the observable to the TagResult object */ - public Observable> analyzeImageByDomainInStreamWithServiceResponseAsync(String model, byte[] image, String language) { + public Observable> tagImageInStreamWithServiceResponseAsync(byte[] image, String language) { if (this.endpoint() == null) { throw new IllegalArgumentException("Parameter this.endpoint() is required and cannot be null."); } - if (model == null) { - throw new IllegalArgumentException("Parameter model is required and cannot be null."); - } if (image == null) { throw new IllegalArgumentException("Parameter image is required and cannot be null."); } String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.endpoint()); RequestBody imageConverted = RequestBody.create(MediaType.parse("application/octet-stream"), image); - return service.analyzeImageByDomainInStream(model, language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.tagImageInStream(language, imageConverted, this.acceptLanguage(), parameterizedHost, this.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = analyzeImageByDomainInStreamDelegate(response); + ServiceResponse clientResponse = tagImageInStreamDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2486,9 +3062,9 @@ public Observable> call(Response analyzeImageByDomainInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse tagImageInStreamDelegate(Response response) throws ComputerVisionErrorException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) .registerError(ComputerVisionErrorException.class) .build(response); } diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/AdultInfo.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/AdultInfo.java index 8b43895d9501..e125fdfcfa18 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/AdultInfo.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/AdultInfo.java @@ -22,14 +22,14 @@ public class AdultInfo { private boolean isAdultContent; /** - * A value indicating if the image is race. + * A value indicating if the image is racy. */ @JsonProperty(value = "isRacyContent") private boolean isRacyContent; /** - * Score from 0 to 1 that indicates how much of adult content is within the - * image. + * Score from 0 to 1 that indicates how much the content is considered + * adult-oriented within the image. */ @JsonProperty(value = "adultScore") private double adultScore; @@ -61,7 +61,7 @@ public AdultInfo withIsAdultContent(boolean isAdultContent) { } /** - * Get a value indicating if the image is race. + * Get a value indicating if the image is racy. * * @return the isRacyContent value */ @@ -70,7 +70,7 @@ public boolean isRacyContent() { } /** - * Set a value indicating if the image is race. + * Set a value indicating if the image is racy. * * @param isRacyContent the isRacyContent value to set * @return the AdultInfo object itself. @@ -81,7 +81,7 @@ public AdultInfo withIsRacyContent(boolean isRacyContent) { } /** - * Get score from 0 to 1 that indicates how much of adult content is within the image. + * Get score from 0 to 1 that indicates how much the content is considered adult-oriented within the image. * * @return the adultScore value */ @@ -90,7 +90,7 @@ public double adultScore() { } /** - * Set score from 0 to 1 that indicates how much of adult content is within the image. + * Set score from 0 to 1 that indicates how much the content is considered adult-oriented within the image. * * @param adultScore the adultScore value to set * @return the AdultInfo object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/AreaOfInterestResult.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/AreaOfInterestResult.java new file mode 100644 index 000000000000..3305da6ad152 --- /dev/null +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/AreaOfInterestResult.java @@ -0,0 +1,84 @@ +/** + * 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. + */ + +package com.microsoft.azure.cognitiveservices.vision.computervision.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of AreaOfInterest operation. + */ +public class AreaOfInterestResult { + /** + * A bounding box for an area of interest inside an image. + */ + @JsonProperty(value = "areaOfInterest", access = JsonProperty.Access.WRITE_ONLY) + private BoundingRect areaOfInterest; + + /** + * Id of the REST API request. + */ + @JsonProperty(value = "requestId") + private String requestId; + + /** + * The metadata property. + */ + @JsonProperty(value = "metadata") + private ImageMetadata metadata; + + /** + * Get a bounding box for an area of interest inside an image. + * + * @return the areaOfInterest value + */ + public BoundingRect areaOfInterest() { + return this.areaOfInterest; + } + + /** + * Get id of the REST API request. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set id of the REST API request. + * + * @param requestId the requestId value to set + * @return the AreaOfInterestResult object itself. + */ + public AreaOfInterestResult withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the metadata value. + * + * @return the metadata value + */ + public ImageMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata value. + * + * @param metadata the metadata value to set + * @return the AreaOfInterestResult object itself. + */ + public AreaOfInterestResult withMetadata(ImageMetadata metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/BoundingRect.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/BoundingRect.java new file mode 100644 index 000000000000..714f5a86b32c --- /dev/null +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/BoundingRect.java @@ -0,0 +1,121 @@ +/** + * 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. + */ + +package com.microsoft.azure.cognitiveservices.vision.computervision.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A bounding box for an area inside an image. + */ +public class BoundingRect { + /** + * X-coordinate of the top left point of the area, in pixels. + */ + @JsonProperty(value = "x") + private int x; + + /** + * Y-coordinate of the top left point of the area, in pixels. + */ + @JsonProperty(value = "y") + private int y; + + /** + * Width measured from the top-left point of the area, in pixels. + */ + @JsonProperty(value = "w") + private int w; + + /** + * Height measured from the top-left point of the area, in pixels. + */ + @JsonProperty(value = "h") + private int h; + + /** + * Get x-coordinate of the top left point of the area, in pixels. + * + * @return the x value + */ + public int x() { + return this.x; + } + + /** + * Set x-coordinate of the top left point of the area, in pixels. + * + * @param x the x value to set + * @return the BoundingRect object itself. + */ + public BoundingRect withX(int x) { + this.x = x; + return this; + } + + /** + * Get y-coordinate of the top left point of the area, in pixels. + * + * @return the y value + */ + public int y() { + return this.y; + } + + /** + * Set y-coordinate of the top left point of the area, in pixels. + * + * @param y the y value to set + * @return the BoundingRect object itself. + */ + public BoundingRect withY(int y) { + this.y = y; + return this; + } + + /** + * Get width measured from the top-left point of the area, in pixels. + * + * @return the w value + */ + public int w() { + return this.w; + } + + /** + * Set width measured from the top-left point of the area, in pixels. + * + * @param w the w value to set + * @return the BoundingRect object itself. + */ + public BoundingRect withW(int w) { + this.w = w; + return this; + } + + /** + * Get height measured from the top-left point of the area, in pixels. + * + * @return the h value + */ + public int h() { + return this.h; + } + + /** + * Set height measured from the top-left point of the area, in pixels. + * + * @param h the h value to set + * @return the BoundingRect object itself. + */ + public BoundingRect withH(int h) { + this.h = h; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/Category.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/Category.java index ed04d7d2e2a0..1de1adafbc31 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/Category.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/Category.java @@ -27,7 +27,7 @@ public class Category { private double score; /** - * The detail property. + * Details of the identified category. */ @JsonProperty(value = "detail") private CategoryDetail detail; @@ -73,7 +73,7 @@ public Category withScore(double score) { } /** - * Get the detail value. + * Get details of the identified category. * * @return the detail value */ @@ -82,7 +82,7 @@ public CategoryDetail detail() { } /** - * Set the detail value. + * Set details of the identified category. * * @param detail the detail value to set * @return the Category object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/CelebritiesModel.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/CelebritiesModel.java index 34c8a7aef1d9..8db147e10905 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/CelebritiesModel.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/CelebritiesModel.java @@ -21,13 +21,14 @@ public class CelebritiesModel { private String name; /** - * Level of confidence ranging from 0 to 1. + * Confidence level for the celebrity recognition as a value ranging from 0 + * to 1. */ @JsonProperty(value = "confidence") private double confidence; /** - * The faceRectangle property. + * Location of the identified face in the image. */ @JsonProperty(value = "faceRectangle") private FaceRectangle faceRectangle; @@ -53,7 +54,7 @@ public CelebritiesModel withName(String name) { } /** - * Get level of confidence ranging from 0 to 1. + * Get confidence level for the celebrity recognition as a value ranging from 0 to 1. * * @return the confidence value */ @@ -62,7 +63,7 @@ public double confidence() { } /** - * Set level of confidence ranging from 0 to 1. + * Set confidence level for the celebrity recognition as a value ranging from 0 to 1. * * @param confidence the confidence value to set * @return the CelebritiesModel object itself. @@ -73,7 +74,7 @@ public CelebritiesModel withConfidence(double confidence) { } /** - * Get the faceRectangle value. + * Get location of the identified face in the image. * * @return the faceRectangle value */ @@ -82,7 +83,7 @@ public FaceRectangle faceRectangle() { } /** - * Set the faceRectangle value. + * Set location of the identified face in the image. * * @param faceRectangle the faceRectangle value to set * @return the CelebritiesModel object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/CelebrityResults.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/CelebrityResults.java index 340c1a828245..f679575fd80d 100644 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/CelebrityResults.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/CelebrityResults.java @@ -12,11 +12,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * List of celebrities recognized in the image. + * Result of domain-specific classifications for the domain of celebrities. */ public class CelebrityResults { /** - * The celebrities property. + * List of celebrities recognized in the image. */ @JsonProperty(value = "celebrities") private List celebrities; @@ -34,7 +34,7 @@ public class CelebrityResults { private ImageMetadata metadata; /** - * Get the celebrities value. + * Get list of celebrities recognized in the image. * * @return the celebrities value */ @@ -43,7 +43,7 @@ public List celebrities() { } /** - * Set the celebrities value. + * Set list of celebrities recognized in the image. * * @param celebrities the celebrities value to set * @return the CelebrityResults object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ComputerVisionError.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ComputerVisionError.java index c30fc49f18ca..def412764d75 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ComputerVisionError.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ComputerVisionError.java @@ -11,18 +11,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The ComputerVisionError model. + * Details about the API request error. */ public class ComputerVisionError { /** - * The error code. Possible values include: 'InvalidImageUrl', - * 'InvalidImageFormat', 'InvalidImageSize', 'NotSupportedVisualFeature', - * 'NotSupportedImage', 'InvalidDetails', 'NotSupportedLanguage', - * 'BadArgument', 'FailedToProcess', 'Timeout', 'InternalServerError', - * 'Unspecified', 'StorageException'. + * The error code. */ @JsonProperty(value = "code", required = true) - private ComputerVisionErrorCodes code; + private Object code; /** * A message explaining the error reported by the service. @@ -37,21 +33,21 @@ public class ComputerVisionError { private String requestId; /** - * Get the error code. Possible values include: 'InvalidImageUrl', 'InvalidImageFormat', 'InvalidImageSize', 'NotSupportedVisualFeature', 'NotSupportedImage', 'InvalidDetails', 'NotSupportedLanguage', 'BadArgument', 'FailedToProcess', 'Timeout', 'InternalServerError', 'Unspecified', 'StorageException'. + * Get the error code. * * @return the code value */ - public ComputerVisionErrorCodes code() { + public Object code() { return this.code; } /** - * Set the error code. Possible values include: 'InvalidImageUrl', 'InvalidImageFormat', 'InvalidImageSize', 'NotSupportedVisualFeature', 'NotSupportedImage', 'InvalidDetails', 'NotSupportedLanguage', 'BadArgument', 'FailedToProcess', 'Timeout', 'InternalServerError', 'Unspecified', 'StorageException'. + * Set the error code. * * @param code the code value to set * @return the ComputerVisionError object itself. */ - public ComputerVisionError withCode(ComputerVisionErrorCodes code) { + public ComputerVisionError withCode(Object code) { this.code = code; return this; } diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/DetectResult.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/DetectResult.java new file mode 100644 index 000000000000..ec34863397fe --- /dev/null +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/DetectResult.java @@ -0,0 +1,85 @@ +/** + * 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. + */ + +package com.microsoft.azure.cognitiveservices.vision.computervision.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of a DetectImage call. + */ +public class DetectResult { + /** + * An array of detected objects. + */ + @JsonProperty(value = "objects", access = JsonProperty.Access.WRITE_ONLY) + private List objects; + + /** + * Id of the REST API request. + */ + @JsonProperty(value = "requestId") + private String requestId; + + /** + * The metadata property. + */ + @JsonProperty(value = "metadata") + private ImageMetadata metadata; + + /** + * Get an array of detected objects. + * + * @return the objects value + */ + public List objects() { + return this.objects; + } + + /** + * Get id of the REST API request. + * + * @return the requestId value + */ + public String requestId() { + return this.requestId; + } + + /** + * Set id of the REST API request. + * + * @param requestId the requestId value to set + * @return the DetectResult object itself. + */ + public DetectResult withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the metadata value. + * + * @return the metadata value + */ + public ImageMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata value. + * + * @param metadata the metadata value to set + * @return the DetectResult object itself. + */ + public DetectResult withMetadata(ImageMetadata metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/DetectedObject.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/DetectedObject.java new file mode 100644 index 000000000000..eea22a462eec --- /dev/null +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/DetectedObject.java @@ -0,0 +1,115 @@ +/** + * 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. + */ + +package com.microsoft.azure.cognitiveservices.vision.computervision.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object detected in an image. + */ +public class DetectedObject { + /** + * Approximate location of the detected object. + */ + @JsonProperty(value = "rectangle", access = JsonProperty.Access.WRITE_ONLY) + private BoundingRect rectangle; + + /** + * Label for the object. + */ + @JsonProperty(value = "object") + private String objectProperty; + + /** + * Confidence score of having observed the object in the image, as a value + * ranging from 0 to 1. + */ + @JsonProperty(value = "confidence") + private double confidence; + + /** + * 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'. + */ + @JsonProperty(value = "parent") + private ObjectHierarchy parent; + + /** + * Get approximate location of the detected object. + * + * @return the rectangle value + */ + public BoundingRect rectangle() { + return this.rectangle; + } + + /** + * Get label for the object. + * + * @return the objectProperty value + */ + public String objectProperty() { + return this.objectProperty; + } + + /** + * Set label for the object. + * + * @param objectProperty the objectProperty value to set + * @return the DetectedObject object itself. + */ + public DetectedObject withObjectProperty(String objectProperty) { + this.objectProperty = objectProperty; + return this; + } + + /** + * Get confidence score of having observed the object in the image, as a value ranging from 0 to 1. + * + * @return the confidence value + */ + public double confidence() { + return this.confidence; + } + + /** + * Set confidence score of having observed the object in the image, as a value ranging from 0 to 1. + * + * @param confidence the confidence value to set + * @return the DetectedObject object itself. + */ + public DetectedObject withConfidence(double confidence) { + this.confidence = confidence; + return this; + } + + /** + * Get 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'. + * + * @return the parent value + */ + public ObjectHierarchy parent() { + return this.parent; + } + + /** + * Set 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'. + * + * @param parent the parent value to set + * @return the DetectedObject object itself. + */ + public DetectedObject withParent(ObjectHierarchy parent) { + this.parent = parent; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/FaceDescription.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/FaceDescription.java index f0320ff8c9ef..dc9db0d0033c 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/FaceDescription.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/FaceDescription.java @@ -27,7 +27,7 @@ public class FaceDescription { private Gender gender; /** - * The faceRectangle property. + * Rectangle in the image containing the identified face. */ @JsonProperty(value = "faceRectangle") private FaceRectangle faceRectangle; @@ -73,7 +73,7 @@ public FaceDescription withGender(Gender gender) { } /** - * Get the faceRectangle value. + * Get rectangle in the image containing the identified face. * * @return the faceRectangle value */ @@ -82,7 +82,7 @@ public FaceRectangle faceRectangle() { } /** - * Set the faceRectangle value. + * Set rectangle in the image containing the identified face. * * @param faceRectangle the faceRectangle value to set * @return the FaceDescription object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/FaceRectangle.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/FaceRectangle.java index 5a8e53db4ad2..8c49324d7173 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/FaceRectangle.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/FaceRectangle.java @@ -15,31 +15,31 @@ */ public class FaceRectangle { /** - * X-coordinate of the top left point of the face. + * X-coordinate of the top left point of the face, in pixels. */ @JsonProperty(value = "left") private int left; /** - * Y-coordinate of the top left point of the face. + * Y-coordinate of the top left point of the face, in pixels. */ @JsonProperty(value = "top") private int top; /** - * Width measured from the top-left point of the face. + * Width measured from the top-left point of the face, in pixels. */ @JsonProperty(value = "width") private int width; /** - * Height measured from the top-left point of the face. + * Height measured from the top-left point of the face, in pixels. */ @JsonProperty(value = "height") private int height; /** - * Get x-coordinate of the top left point of the face. + * Get x-coordinate of the top left point of the face, in pixels. * * @return the left value */ @@ -48,7 +48,7 @@ public int left() { } /** - * Set x-coordinate of the top left point of the face. + * Set x-coordinate of the top left point of the face, in pixels. * * @param left the left value to set * @return the FaceRectangle object itself. @@ -59,7 +59,7 @@ public FaceRectangle withLeft(int left) { } /** - * Get y-coordinate of the top left point of the face. + * Get y-coordinate of the top left point of the face, in pixels. * * @return the top value */ @@ -68,7 +68,7 @@ public int top() { } /** - * Set y-coordinate of the top left point of the face. + * Set y-coordinate of the top left point of the face, in pixels. * * @param top the top value to set * @return the FaceRectangle object itself. @@ -79,7 +79,7 @@ public FaceRectangle withTop(int top) { } /** - * Get width measured from the top-left point of the face. + * Get width measured from the top-left point of the face, in pixels. * * @return the width value */ @@ -88,7 +88,7 @@ public int width() { } /** - * Set width measured from the top-left point of the face. + * Set width measured from the top-left point of the face, in pixels. * * @param width the width value to set * @return the FaceRectangle object itself. @@ -99,7 +99,7 @@ public FaceRectangle withWidth(int width) { } /** - * Get height measured from the top-left point of the face. + * Get height measured from the top-left point of the face, in pixels. * * @return the height value */ @@ -108,7 +108,7 @@ public int height() { } /** - * Set height measured from the top-left point of the face. + * Set height measured from the top-left point of the face, in pixels. * * @param height the height value to set * @return the FaceRectangle object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageAnalysis.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageAnalysis.java index 73898d913f49..be8c395ee7d0 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageAnalysis.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageAnalysis.java @@ -22,19 +22,20 @@ public class ImageAnalysis { private List categories; /** - * The adult property. + * An object describing whether the image contains adult-oriented content + * and/or is racy. */ @JsonProperty(value = "adult") private AdultInfo adult; /** - * The color property. + * An object providing additional metadata describing color attributes. */ @JsonProperty(value = "color") private ColorInfo color; /** - * The imageType property. + * An object providing possible image types and matching confidence levels. */ @JsonProperty(value = "imageType") private ImageType imageType; @@ -46,7 +47,8 @@ public class ImageAnalysis { private List tags; /** - * The description property. + * A collection of content tags, along with a list of captions sorted by + * confidence level, and image metadata. */ @JsonProperty(value = "description") private ImageDescriptionDetails description; @@ -58,7 +60,13 @@ public class ImageAnalysis { private List faces; /** - * Id of the request for tracking purposes. + * Array of objects describing what was detected in the image. + */ + @JsonProperty(value = "objects") + private List objects; + + /** + * Id of the REST API request. */ @JsonProperty(value = "requestId") private String requestId; @@ -90,7 +98,7 @@ public ImageAnalysis withCategories(List categories) { } /** - * Get the adult value. + * Get an object describing whether the image contains adult-oriented content and/or is racy. * * @return the adult value */ @@ -99,7 +107,7 @@ public AdultInfo adult() { } /** - * Set the adult value. + * Set an object describing whether the image contains adult-oriented content and/or is racy. * * @param adult the adult value to set * @return the ImageAnalysis object itself. @@ -110,7 +118,7 @@ public ImageAnalysis withAdult(AdultInfo adult) { } /** - * Get the color value. + * Get an object providing additional metadata describing color attributes. * * @return the color value */ @@ -119,7 +127,7 @@ public ColorInfo color() { } /** - * Set the color value. + * Set an object providing additional metadata describing color attributes. * * @param color the color value to set * @return the ImageAnalysis object itself. @@ -130,7 +138,7 @@ public ImageAnalysis withColor(ColorInfo color) { } /** - * Get the imageType value. + * Get an object providing possible image types and matching confidence levels. * * @return the imageType value */ @@ -139,7 +147,7 @@ public ImageType imageType() { } /** - * Set the imageType value. + * Set an object providing possible image types and matching confidence levels. * * @param imageType the imageType value to set * @return the ImageAnalysis object itself. @@ -170,7 +178,7 @@ public ImageAnalysis withTags(List tags) { } /** - * Get the description value. + * Get a collection of content tags, along with a list of captions sorted by confidence level, and image metadata. * * @return the description value */ @@ -179,7 +187,7 @@ public ImageDescriptionDetails description() { } /** - * Set the description value. + * Set a collection of content tags, along with a list of captions sorted by confidence level, and image metadata. * * @param description the description value to set * @return the ImageAnalysis object itself. @@ -210,7 +218,27 @@ public ImageAnalysis withFaces(List faces) { } /** - * Get id of the request for tracking purposes. + * Get array of objects describing what was detected in the image. + * + * @return the objects value + */ + public List objects() { + return this.objects; + } + + /** + * Set array of objects describing what was detected in the image. + * + * @param objects the objects value to set + * @return the ImageAnalysis object itself. + */ + public ImageAnalysis withObjects(List objects) { + this.objects = objects; + return this; + } + + /** + * Get id of the REST API request. * * @return the requestId value */ @@ -219,7 +247,7 @@ public String requestId() { } /** - * Set id of the request for tracking purposes. + * Set id of the REST API request. * * @param requestId the requestId value to set * @return the ImageAnalysis object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageMetadata.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageMetadata.java index 6515c560863d..d1f45213698a 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageMetadata.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageMetadata.java @@ -15,13 +15,13 @@ */ public class ImageMetadata { /** - * Image width. + * Image width, in pixels. */ @JsonProperty(value = "width") private int width; /** - * Image height. + * Image height, in pixels. */ @JsonProperty(value = "height") private int height; @@ -33,7 +33,7 @@ public class ImageMetadata { private String format; /** - * Get image width. + * Get image width, in pixels. * * @return the width value */ @@ -42,7 +42,7 @@ public int width() { } /** - * Set image width. + * Set image width, in pixels. * * @param width the width value to set * @return the ImageMetadata object itself. @@ -53,7 +53,7 @@ public ImageMetadata withWidth(int width) { } /** - * Get image height. + * Get image height, in pixels. * * @return the height value */ @@ -62,7 +62,7 @@ public int height() { } /** - * Set image height. + * Set image height, in pixels. * * @param height the height value to set * @return the ImageMetadata object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageTag.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageTag.java index 305777abbff1..4eb4d9d30945 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageTag.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ImageTag.java @@ -11,29 +11,29 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * An image caption, i.e. a brief description of what the image depicts. + * An entity observation in the image, along with the confidence score. */ public class ImageTag { /** - * The tag value. + * Name of the entity. */ @JsonProperty(value = "name") private String name; /** - * The level of confidence the service has in the caption. + * The level of confidence that the entity was observed. */ @JsonProperty(value = "confidence") private double confidence; /** - * Optional categorization for the tag. + * Optional hint/details for this tag. */ @JsonProperty(value = "hint") private String hint; /** - * Get the tag value. + * Get name of the entity. * * @return the name value */ @@ -42,7 +42,7 @@ public String name() { } /** - * Set the tag value. + * Set name of the entity. * * @param name the name value to set * @return the ImageTag object itself. @@ -53,7 +53,7 @@ public ImageTag withName(String name) { } /** - * Get the level of confidence the service has in the caption. + * Get the level of confidence that the entity was observed. * * @return the confidence value */ @@ -62,7 +62,7 @@ public double confidence() { } /** - * Set the level of confidence the service has in the caption. + * Set the level of confidence that the entity was observed. * * @param confidence the confidence value to set * @return the ImageTag object itself. @@ -73,7 +73,7 @@ public ImageTag withConfidence(double confidence) { } /** - * Get optional categorization for the tag. + * Get optional hint/details for this tag. * * @return the hint value */ @@ -82,7 +82,7 @@ public String hint() { } /** - * Set optional categorization for the tag. + * Set optional hint/details for this tag. * * @param hint the hint value to set * @return the ImageTag object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/LandmarkResults.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/LandmarkResults.java index c09936de5167..7f590a51e4dc 100644 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/LandmarkResults.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/LandmarkResults.java @@ -12,11 +12,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * List of landmarks recognized in the image. + * Result of domain-specific classifications for the domain of landmarks. */ public class LandmarkResults { /** - * The landmarks property. + * List of landmarks recognized in the image. */ @JsonProperty(value = "landmarks") private List landmarks; @@ -34,7 +34,7 @@ public class LandmarkResults { private ImageMetadata metadata; /** - * Get the landmarks value. + * Get list of landmarks recognized in the image. * * @return the landmarks value */ @@ -43,7 +43,7 @@ public List landmarks() { } /** - * Set the landmarks value. + * Set list of landmarks recognized in the image. * * @param landmarks the landmarks value to set * @return the LandmarkResults object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/LandmarksModel.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/LandmarksModel.java index a9b37dfc80d9..a0d921ea17d9 100644 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/LandmarksModel.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/LandmarksModel.java @@ -21,7 +21,8 @@ public class LandmarksModel { private String name; /** - * Confidence level for the landmark recognition. + * Confidence level for the landmark recognition as a value ranging from 0 + * to 1. */ @JsonProperty(value = "confidence") private double confidence; @@ -47,7 +48,7 @@ public LandmarksModel withName(String name) { } /** - * Get confidence level for the landmark recognition. + * Get confidence level for the landmark recognition as a value ranging from 0 to 1. * * @return the confidence value */ @@ -56,7 +57,7 @@ public double confidence() { } /** - * Set confidence level for the landmark recognition. + * Set confidence level for the landmark recognition as a value ranging from 0 to 1. * * @param confidence the confidence value to set * @return the LandmarksModel object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ModelDescription.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ModelDescription.java index d7056d8dcaa8..a2c3b67c5f09 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ModelDescription.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ModelDescription.java @@ -16,19 +16,19 @@ */ public class ModelDescription { /** - * The name property. + * The name of the model. */ @JsonProperty(value = "name") private String name; /** - * The categories property. + * Categories of the model. */ @JsonProperty(value = "categories") private List categories; /** - * Get the name value. + * Get the name of the model. * * @return the name value */ @@ -37,7 +37,7 @@ public String name() { } /** - * Set the name value. + * Set the name of the model. * * @param name the name value to set * @return the ModelDescription object itself. @@ -48,7 +48,7 @@ public ModelDescription withName(String name) { } /** - * Get the categories value. + * Get categories of the model. * * @return the categories value */ @@ -57,7 +57,7 @@ public List categories() { } /** - * Set the categories value. + * Set categories of the model. * * @param categories the categories value to set * @return the ModelDescription object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ObjectHierarchy.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ObjectHierarchy.java new file mode 100644 index 000000000000..a1bd9990d048 --- /dev/null +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/ObjectHierarchy.java @@ -0,0 +1,100 @@ +/** + * 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. + */ + +package com.microsoft.azure.cognitiveservices.vision.computervision.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object detected inside an image. + */ +public class ObjectHierarchy { + /** + * Label for the object. + */ + @JsonProperty(value = "object") + private String objectProperty; + + /** + * Confidence score of having observed the object in the image, as a value + * ranging from 0 to 1. + */ + @JsonProperty(value = "confidence") + private double confidence; + + /** + * 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'. + */ + @JsonProperty(value = "parent") + private ObjectHierarchy parent; + + /** + * Get label for the object. + * + * @return the objectProperty value + */ + public String objectProperty() { + return this.objectProperty; + } + + /** + * Set label for the object. + * + * @param objectProperty the objectProperty value to set + * @return the ObjectHierarchy object itself. + */ + public ObjectHierarchy withObjectProperty(String objectProperty) { + this.objectProperty = objectProperty; + return this; + } + + /** + * Get confidence score of having observed the object in the image, as a value ranging from 0 to 1. + * + * @return the confidence value + */ + public double confidence() { + return this.confidence; + } + + /** + * Set confidence score of having observed the object in the image, as a value ranging from 0 to 1. + * + * @param confidence the confidence value to set + * @return the ObjectHierarchy object itself. + */ + public ObjectHierarchy withConfidence(double confidence) { + this.confidence = confidence; + return this; + } + + /** + * Get 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'. + * + * @return the parent value + */ + public ObjectHierarchy parent() { + return this.parent; + } + + /** + * Set 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'. + * + * @param parent the parent value to set + * @return the ObjectHierarchy object itself. + */ + public ObjectHierarchy withParent(ObjectHierarchy parent) { + this.parent = parent; + return this; + } + +} diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/OcrRegion.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/OcrRegion.java index d38173577da0..baad08265d96 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/OcrRegion.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/OcrRegion.java @@ -28,7 +28,7 @@ public class OcrRegion { private String boundingBox; /** - * The lines property. + * An array of recognized lines of text. */ @JsonProperty(value = "lines") private List lines; @@ -54,7 +54,7 @@ public OcrRegion withBoundingBox(String boundingBox) { } /** - * Get the lines value. + * Get an array of recognized lines of text. * * @return the lines value */ @@ -63,7 +63,7 @@ public List lines() { } /** - * Set the lines value. + * Set an array of recognized lines of text. * * @param lines the lines value to set * @return the OcrRegion object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/OcrResult.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/OcrResult.java index 611c8492c986..f99f90e16078 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/OcrResult.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/OcrResult.java @@ -37,10 +37,10 @@ public class OcrResult { private double textAngle; /** - * 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 - * center according to the detected text angle (see textAngle property). + * 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 center + * according to the detected text angle (see textAngle property). */ @JsonProperty(value = "orientation") private String orientation; @@ -93,7 +93,7 @@ public OcrResult withTextAngle(double textAngle) { } /** - * Get 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 center according to the detected text angle (see textAngle property). + * Get 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 center according to the detected text angle (see textAngle property). * * @return the orientation value */ @@ -102,7 +102,7 @@ public String orientation() { } /** - * Set 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 center according to the detected text angle (see textAngle property). + * Set 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 center according to the detected text angle (see textAngle property). * * @param orientation the orientation value to set * @return the OcrResult object itself. diff --git a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/VisualFeatureTypes.java b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/VisualFeatureTypes.java index d7729de875eb..6b19e024ebb6 100755 --- a/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/VisualFeatureTypes.java +++ b/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/models/VisualFeatureTypes.java @@ -34,7 +34,10 @@ public enum VisualFeatureTypes { TAGS("Tags"), /** Enum value Description. */ - DESCRIPTION("Description"); + DESCRIPTION("Description"), + + /** Enum value Objects. */ + OBJECTS("Objects"); /** The actual serialized value for a VisualFeatureTypes instance. */ private String value;