Image Moderation - OCR Url Input

Returns any text found in the image for the specified language. If no language is specified in the input, the detection defaults to English.

POST {Endpoint}/contentmoderator/moderate/v1.0/ProcessImage/OCR?overload=url&language={language}
POST {Endpoint}/contentmoderator/moderate/v1.0/ProcessImage/OCR?overload=url&language={language}&CacheImage={CacheImage}&enhanced={enhanced}

URI Parameters

Name In Required Type Description
Endpoint
path True

string

Supported Azure Cognitive Services endpoints (protocol and host name, such as https://westus.api.cognitive.microsoft.com).

language
query True

string

Language of the terms.

CacheImage
query

boolean

Whether to retain the submitted image for future use. If it's omitted, the default is false.

enhanced
query

boolean

When it's set to true, the image goes through additional processing to come with additional candidates.

The image or TIFF file is not supported when enhanced is set to true.

Note: This affects the response time.

Request Header

Name Required Type Description
Ocp-Apim-Subscription-Key True

string

Content-Type True

string

Content type.

Request Body

Name Type Description
DataRepresentation

string

Value

string

Responses

Name Type Description
200 OK

OCR

Found text and list of candidate text.

Other Status Codes

APIError

Error response.

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

Examples

Image OCR request

Sample request

POST {Endpoint}/contentmoderator/moderate/v1.0/ProcessImage/OCR?overload=url&language=eng&CacheImage=False&enhanced=False



{
  "DataRepresentation": "URL",
  "Value": "https://moderatorsampleimages.blob.core.windows.net/samples/img_300.jpg"
}

Sample response

{
  "Metadata": [
    {
      "Key": "ImageDownloadTimeInMs",
      "Value": "2239"
    },
    {
      "Key": "ImageSizeInBytes",
      "Value": "273405"
    }
  ],
  "Language": "eng",
  "Text": "IF WE DID \r\nALL \r\nTHE THINGS \r\nWE ARE \r\nCAPABLE \r\nOF DOING, \r\nWE WOULD \r\nLITERALLY \r\nASTOUND \r\nOURSELVE \r\n",
  "Candidates": [],
  "Status": {
    "Code": 3000,
    "Description": "OK",
    "Exception": ""
  },
  "TrackingId": "SEA_ad975eeae1f24f81bebb40be0c3ba4fd_ContentModerator.Preview_e68fa0d1-6c83-499d-958c-9abd96263e10"
}

Definitions

Name Description
APIError

Error information that the API returns.

Candidate

Optical character recognition (OCR) candidate text.

Error

Error body.

KeyValuePair

Key/value pair object properties.

OCR

Contains the text found in an image for the specified language.

Status

Status properties.

APIError

Error information that the API returns.

Name Type Description
Error

Error

Error body.

Candidate

Optical character recognition (OCR) candidate text.

Name Type Description
Confidence

number

Confidence level.

Text

string

Text found.

Error

Error body.

Name Type Description
Code

string

Message

string

KeyValuePair

Key/value pair object properties.

Name Type Description
Key

string

Key parameter.

Value

string

Value parameter.

OCR

Contains the text found in an image for the specified language.

Name Type Description
CacheId

string

Cache ID.

Candidates

Candidate[]

List of candidate text.

Language

string

ISO 639-3 code.

Metadata

KeyValuePair[]

Array of key/value pairs.

Status

Status

Evaluation status.

Text

string

Found text.

TrackingId

string

Tracking ID.

Status

Status properties.

Name Type Description
Code

integer

Status code.

Description

string

Status description.

Exception

string

Exception status.