ComputerVisionAPIClient class

Class representing a ComputerVisionAPIClient.

Constructors

ComputerVisionAPIClient(credentials, azureRegion, options)

Create a ComputerVisionAPIClient.

new ComputerVisionAPIClient(credentials, azureRegion, options)
Parameters
credentials
undefinedcredentials

Subscription credentials which uniquely identify client subscription.

azureRegion
undefinedazureRegions

Supported Azure regions for Cognitive Services endpoints. Possible values include: 'westus', 'westeurope', 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', 'brazilsouth'

options
object

The parameter options

required: false
NameRequiredTypeDescription
filters Array

Filters to be added to the request pipeline

requestOptions object

Options for the underlying request object Options doc

noRetryPolicy boolean

If set to true, turn off default retry policy

Methods

analyzeImage(url, options, optionalCallback)

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.

function analyzeImage(url, options, optionalCallback)
Parameters
url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
visualFeatures array

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.

details array

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.

language string

A string indicating which language to return. The service will return recognition results in specified language. If this parameter is not specified, the default value is "en".Supported languages:en - English, Default.zh - Simplified Chinese. Possible values include: 'en', 'zh'

customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See ImageAnalysis for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<ImageAnalysis>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

analyzeImageByDomain(model, url, options, optionalCallback)

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.

function analyzeImageByDomain(model, url, options, optionalCallback)
Parameters
model
string

The domain-specific content to recognize. Possible values include: 'Celebrities', 'Landmarks'

url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See DomainModelResults for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<DomainModelResults>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

analyzeImageByDomainInStream(model, image, options, optionalCallback)

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.

function analyzeImageByDomainInStream(model, image, options, optionalCallback)
Parameters
model
string

The domain-specific content to recognize.

image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See DomainModelResults for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<DomainModelResults>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

analyzeImageByDomainInStreamWithHttpOperationResponse(model, image, options)

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.

function analyzeImageByDomainInStreamWithHttpOperationResponse(model, image, options)
Parameters
model
string

The domain-specific content to recognize.

image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

analyzeImageByDomainWithHttpOperationResponse(model, url, options)

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.

function analyzeImageByDomainWithHttpOperationResponse(model, url, options)
Parameters
model
string

The domain-specific content to recognize. Possible values include: 'Celebrities', 'Landmarks'

url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

analyzeImageInStream(image, options, optionalCallback)

This operation extracts a rich set of visual features based on the image content.

function analyzeImageInStream(image, options, optionalCallback)
Parameters
image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
visualFeatures array

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.

details string

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. Possible values include: 'Celebrities', 'Landmarks'

language string

A string indicating which language to return. The service will return recognition results in specified language. If this parameter is not specified, the default value is "en".Supported languages:en - English, Default.zh - Simplified Chinese. Possible values include: 'en', 'zh'

customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See ImageAnalysis for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<ImageAnalysis>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

analyzeImageInStreamWithHttpOperationResponse(image, options)

This operation extracts a rich set of visual features based on the image content.

function analyzeImageInStreamWithHttpOperationResponse(image, options)
Parameters
image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
visualFeatures array

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.

details string

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. Possible values include: 'Celebrities', 'Landmarks'

language string

A string indicating which language to return. The service will return recognition results in specified language. If this parameter is not specified, the default value is "en".Supported languages:en - English, Default.zh - Simplified Chinese. Possible values include: 'en', 'zh'

customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

analyzeImageWithHttpOperationResponse(url, options)

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.

function analyzeImageWithHttpOperationResponse(url, options)
Parameters
url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
visualFeatures array

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.

details array

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.

language string

A string indicating which language to return. The service will return recognition results in specified language. If this parameter is not specified, the default value is "en".Supported languages:en - English, Default.zh - Simplified Chinese. Possible values include: 'en', 'zh'

customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

describeImage(url, options, optionalCallback)

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.

function describeImage(url, options, optionalCallback)
Parameters
url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
maxCandidates string

Maximum number of candidate descriptions to be returned. The default is 1.

customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See ImageDescription for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<ImageDescription>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

describeImageInStream(image, options, optionalCallback)

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.

function describeImageInStream(image, options, optionalCallback)
Parameters
image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
maxCandidates string

Maximum number of candidate descriptions to be returned. The default is 1.

customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See ImageDescription for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<ImageDescription>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

describeImageInStreamWithHttpOperationResponse(image, options)

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.

function describeImageInStreamWithHttpOperationResponse(image, options)
Parameters
image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
maxCandidates string

Maximum number of candidate descriptions to be returned. The default is 1.

customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

describeImageWithHttpOperationResponse(url, options)

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.

function describeImageWithHttpOperationResponse(url, options)
Parameters
url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
maxCandidates string

Maximum number of candidate descriptions to be returned. The default is 1.

customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

generateThumbnail(width, height, url, options, optionalCallback)

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.

function generateThumbnail(width, height, url, options, optionalCallback)
Parameters
width
number

Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50.

height
number

Height of the thumbnail. It must be between 1 and

  1. Recommended minimum of 50.
url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
smartCropping boolean

Boolean flag for enabling smart cropping.

customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<Object>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

generateThumbnailInStream(width, height, image, options, optionalCallback)

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.

function generateThumbnailInStream(width, height, image, options, optionalCallback)
Parameters
width
number

Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50.

height
number

Height of the thumbnail. It must be between 1 and

  1. Recommended minimum of 50.
image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
smartCropping boolean

Boolean flag for enabling smart cropping.

customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<Object>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

generateThumbnailInStreamWithHttpOperationResponse(width, height, image, options)

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.

function generateThumbnailInStreamWithHttpOperationResponse(width, height, image, options)
Parameters
width
number

Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50.

height
number

Height of the thumbnail. It must be between 1 and

  1. Recommended minimum of 50.
image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
smartCropping boolean

Boolean flag for enabling smart cropping.

customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

generateThumbnailWithHttpOperationResponse(width, height, url, options)

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.

function generateThumbnailWithHttpOperationResponse(width, height, url, options)
Parameters
width
number

Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50.

height
number

Height of the thumbnail. It must be between 1 and

  1. Recommended minimum of 50.
url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
smartCropping boolean

Boolean flag for enabling smart cropping.

customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

getTextOperationResult(operationId, options, optionalCallback)

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.

function getTextOperationResult(operationId, options, optionalCallback)
Parameters
operationId
string

Id of the text operation returned in the response of the 'Recognize Handwritten Text'

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See TextOperationResult for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<TextOperationResult>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

getTextOperationResultWithHttpOperationResponse(operationId, options)

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.

function getTextOperationResultWithHttpOperationResponse(operationId, options)
Parameters
operationId
string

Id of the text operation returned in the response of the 'Recognize Handwritten Text'

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

listModels(options, optionalCallback)

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.

function listModels(options, optionalCallback)
Parameters
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See ListModelsResult for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<ListModelsResult>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

listModelsWithHttpOperationResponse(options)

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.

function listModelsWithHttpOperationResponse(options)
Parameters
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

recognizePrintedText(detectOrientation, url, options, optionalCallback)

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.

function recognizePrintedText(detectOrientation, url, options, optionalCallback)
Parameters
detectOrientation
boolean

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).

url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
language string

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'

customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See OcrResult for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<OcrResult>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

recognizePrintedTextInStream(detectOrientation, image, options, optionalCallback)

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.

function recognizePrintedTextInStream(detectOrientation, image, options, optionalCallback)
Parameters
detectOrientation
boolean

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).

image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
language string

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'

customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See OcrResult for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<OcrResult>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

recognizePrintedTextInStreamWithHttpOperationResponse(detectOrientation, image, options)

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.

function recognizePrintedTextInStreamWithHttpOperationResponse(detectOrientation, image, options)
Parameters
detectOrientation
boolean

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).

image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
language string

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'

customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

recognizePrintedTextWithHttpOperationResponse(detectOrientation, url, options)

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.

function recognizePrintedTextWithHttpOperationResponse(detectOrientation, url, options)
Parameters
detectOrientation
boolean

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).

url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
language string

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'

customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

recognizeText(url, options, optionalCallback)

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 Handwritten Text Operation Result operation.

function recognizeText(url, options, optionalCallback)
Parameters
url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
detectHandwriting boolean

If “true” is specified, handwriting recognition is performed. If this parameter is set to “false” or is not specified, printed text recognition is performed.

customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result nullThe deserialized result object if an error did not occur.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<null>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

recognizeTextInStream(image, options, optionalCallback)

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 Handwritten Text Operation Result operation.

function recognizeTextInStream(image, options, optionalCallback)
Parameters
image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
detectHandwriting boolean

If “true” is specified, handwriting recognition is performed. If this parameter is set to “false” or is not specified, printed text recognition is performed.

customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result nullThe deserialized result object if an error did not occur.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<null>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

recognizeTextInStreamWithHttpOperationResponse(image, options)

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 Handwritten Text Operation Result operation.

function recognizeTextInStreamWithHttpOperationResponse(image, options)
Parameters
image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
detectHandwriting boolean

If “true” is specified, handwriting recognition is performed. If this parameter is set to “false” or is not specified, printed text recognition is performed.

customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

recognizeTextWithHttpOperationResponse(url, options)

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 Handwritten Text Operation Result operation.

function recognizeTextWithHttpOperationResponse(url, options)
Parameters
url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
detectHandwriting boolean

If “true” is specified, handwriting recognition is performed. If this parameter is set to “false” or is not specified, printed text recognition is performed.

customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

tagImage(url, options, optionalCallback)

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.

function tagImage(url, options, optionalCallback)
Parameters
url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See TagResult for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<TagResult>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

tagImageInStream(image, options, optionalCallback)

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.

function tagImageInStream(image, options, optionalCallback)
Parameters
image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

optionalCallback
function

The optional callback.

required: false
NameRequiredTypeDescription
err true ErrorThe Error object if an error occurred, null otherwise.
result objectThe deserialized result object if an error did not occur. See TagResult for more information.
request objectThe HTTP Request object if an error did not occur.
response streamThe HTTP Response stream if an error did not occur.
Returns
Promise<TagResult>

If a callback was passed as the last parameter then it returns the callback else returns a Promise.

tagImageInStreamWithHttpOperationResponse(image, options)

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.

function tagImageInStreamWithHttpOperationResponse(image, options)
Parameters
image
object

An image stream.

options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned

tagImageWithHttpOperationResponse(url, options)

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.

function tagImageWithHttpOperationResponse(url, options)
Parameters
url
string
options
object

Optional Parameters.

required: false
NameRequiredTypeDescription
customHeaders object

Headers that will be added to the request

Returns
Promise<HttpOperationResponse>

A promise is returned