REST API

Image processing works on the principle of sending the image via HTTP request. Only one image can be sent per request.

ย 

Process

You need to have โ€˜Processโ€™ enabled in the left panel to process the image.

Request

The sending address consists of IP address, port, and type. The method must be of โ€˜POSTโ€™ type, and the content of โ€˜application/octet-streamโ€™ type.

Find a practical API demonstration in Python atย GitHub Image Analyze API.

IP Address

If the project runs on a local computer, the address is 127.0.0.1. If a remote computer is accessed, then you need to use the IP address of the remote computer.

Port

This is selected when starting the project.

API Key

If the project is running with the api key, each request in the parameter query must contain API key.

Data

You can add extra information to the request. This string will be add to the context (key is data). It is available only in the Code module (context variable).

'http://127.0.0.1:8000/analyze_image?width=1920&height=1024&data=SomeInfo'

Types

analyze_raw_Image

Used for sending the image as raw data. For example, the numpy array in Python is converted to binary format. You need to send the image dimensions in a query parameter.

Example of a 1920x1024 image

'http://127.0.0.1:8000/analyze_raw_image?width=1920&height=1024'

If you are sending Bayer RG 8 data, it is necessary to add an argumentย bayer.

'http://127.0.0.1:8000/analyze_raw_image?width=1920&height=1024&bayer'

analyze_image

For sending an image in โ€˜jpgโ€™ or โ€˜pngโ€™ formats.

Example

'http://127.0.0.1:8000/analyze_image'

Example with API key

'http://127.0.0.1:8000/analyze_image?api_key=SUPER_SECRET'

Response

Query parameter โ€˜response_typeโ€™ determines the response type.

โ€˜contextโ€™[default] โ€“ a serialized context in JSON format

โ€˜imageโ€™ โ€“ processed image

โ€˜annotated_imageโ€™ โ€“ processed image with annotations

โ€˜heatmapโ€™ - response is png image of heatmap

For image and annotated_image types, the serialized context is added to the header with the header title: context.