Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Widget Connector
overlayyoutube
_templatecom/atlassian/confluence/extra/widgetconnector/templates/youtube.vm
width680px
urlhttps://www.youtube.com/watch?v=WkEYKFe9wMo&feature=youtu.be
height400px

Enable Process

Info

User must enable ‘Process’ enabled in on the left of the panel in Camera tab to be able to process the image sent through API.

...

Request

The sending address consists of IP address, port, and type. The method must be of ‘POST’ type, and the content type of ‘application/octet-stream’ type.

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

Example of a Python code sending requests with raw images from camera:

Code Block
breakoutModewide
languagepy
import cv2
import requests

cap = cv2.VideoCapture(0)

# you can set frame size
# cap.set(cv2.CAP_PROP_FRAME_WIDTH, 960)
# cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 540)

# keep alive
request_session = requests.Session()

while True:
    # get frame from camera
    ret, frame = cap.read()

    # get image shape
    shape = frame.shape

    # send frame to PEKAT VISION
    response = requests.post(
        url='http://127.0.0.1:8000/analyze_raw_image?width='+str(shape[1])+'&height='+str(shape[0]),
        data=frame.tobytes(),
        headers={'Content-Type': 'application/octet-stream'}
    )

    print(response.json())

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.

...

If the project is running with the API key“Secure image analyze” option enabled, each request in the parameter query must contain the API key that is generated after you enable this option.

...

Code Block
'http://127.0.0.1:8000/analyze_image?api_key=553d7790-827c-11ec-978b-6da1176c0b00'

Data

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

Code Block
'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 parameterparameters width and height.

Example of a 1920x1024 image:

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

...

Code Block
'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. - PASS THROUGH THE FLOW,TRAINED MODELS…

...