Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
130 lines (103 sloc) 3.21 KB

ai.image.ocr

Optical Character Recognition (OCR) detects and extracts text within an image with support for a broad range of languages.

Basic usage

To detect or extract text within an image, send a POST request to Intento API at https://api.inten.to/ai/image/ocr. Specify the source image and the desired provider in JSON body of the request as in the following example:

curl -XPOST -H 'apikey: YOUR_API_KEY' 'https://api.inten.to/ai/image/ocr' -d '{
    "context": {
        "image": "..."
    },
    "service": {
        "provider": "ai.image.ocr.abbyy.cloud_ocr"
    }
}'

The response contains the results:

{
    "results": "...",
    "meta": {},
    "service": {
        "provider": {
            "id": "ai.image.ocr.abbyy.cloud_ocr"
        }
    }
}

If the provider doesn't have capabilities (e.g. language) to process request, 413 error will be returned:

{
  "error": {
    "code": 413,
    "message": "Provider ai.image.ocr.abbyy.cloud_ocr constraint(s) violated."
  },
  "request_id": "..."
}

Getting available providers

To get a list of available providers, send a GET request to https://api.inten.to/ai/image/ocr.

curl -H 'apikey: YOUR_INTENTO_KEY' 'https://api.inten.to/ai/image/ocr'

The response contains a list of the providers available for given constraints:

[
    {
        "id": "ai.image.ocr.microsoft.vision_api.1-0",
        "name": "Microsoft",
        "description": "Computer Vision API",
        "own_auth": true
    }
]

Filtering providers by capabilities

The list of providers may be further constrained by adding desired parameter values to the GET request:

curl -H 'apikey: YOUR_INTENTO_KEY' 'https://api.inten.to/ai/image/ocr?own_auth=true'

Response:

[
    {
        "id": "ai.image.ocr.google.cloud_vision_api.1-1",
        "description": "API Detect Labels",
        "name": "Amazon Rekognition",
        "integrated": false,
        "own_auth": true,
        "stock_model": false,
        "custom_model": false
    },
    ...
]

More on provider flags and capabilities.

Getting information about a provider

To get information about a provider with a given ID, send a GET request to https://api.inten.to/ai/image/ocr/PROVIDER_ID.

curl -H 'apikey: YOUR_INTENTO_KEY' 'https://api.inten.to/ai/image/ocr/ai.image.ocr.google.cloud_vision_api.1-1'

The response contains a list of the metadata fields and values available for the provider:

{
    "id": "ai.image.ocr.google.cloud_vision_api.1-1",
    "vendor": "Google Cloud",
    "logo": "https://inten.to/static/img/api/ggl_vision.png",
    "billing": true,
    "description": "Vision API",
    "production": true,
    "integrated": false,
    "billable": true,
    "own_auth": true,
    "stock_model": true,
    "custom_model": false,
    "auth": {
        "key": "YOUR_KEY"
    }
}