Accessing camera data via ZeroMQ

Vision Connector User Manual

Portfolio
Industrial AI
Product
Vision Connector
Software version
1.2.2
Language
English

Procedure

Each camera can be streamed via a ZeroMQ connection with multi-part ZeroMQ messages. The rate at which these messages are published by the ZeroMQ server depends on the total throughput of all cameras. Vision Connector attempts to adopt the frame rate of the source.

Each message consists of the following parts:

Message section

Description

device id

UTF-8 encoded JSON string containing the camera ID.

metadata

UTF-8 encoded JSON string containing the metadata.

image

Binary data of the image

image 2 … n

Additional images in the case of a multistream camera

Note:

Calling socket.recv() reads only a part of a multipart message.

Use socket.recv_multipart() instead.

Metadata

Field

Type

Optional

Default setting

Description

version

String

No

1

Version of the metadata format

count

Integer

No

1

Number of images in the message

timestamp

String

No

-

Date and time string (UTF-8, ISO 8601)

Date and time of the application host

customfields

String

Yes

-

User-defined field that is defined by the creator of the application and processed by the consumers. Can be a simple string, JSON string, or something else.

detail

Image Detail Object Array

No

-

Details of the images

Image Detail Object

Field

Type

Optional

Default setting

Description

id

String

No

-

Unique image identifier.

Suggested mnemonic format

e.g. {camid}{camstream}{datetime}

seq

Integer

No

-

Sequential number for the camera image

Starts at 1 and is incremented by 1 with each captured image.

height

Integer

No/Yes

(encoded formats)

-

Image height

width

Integer

No/Yes

(encoded formats)

-

Image width

formatns

String

Yes

Genicam

Namespace of the image format

Use Genicam for the Genicam pixel format and Compressed2 for compressed formats.

format

String

No

-

Image format 1 2 3

linepadding

integer

Yes

0

Number of bytes added at the end of the byte stream to make multiples of 4 bytes. For example, an image with 61 pixels, mono8, has a line padding of 3 to pad the stream to 64 bytes.

timestamp

String4

Yes

-

Clock ticks transmitted by the camera.5

metadata6

String

Yes

-

Additional field for image metadata, which is defined by the creator of the app and processed by the consumers. Can be a simple string, JSON string, or something else.

1 For cameras using a standardized GenICam pixel format, it is recommended to use the GenICam naming convention as described in section 4.35 of the GenICam_PFNC_2_4.pdf document.

2 Additional values may be supported if described in the application documentation.

3 Compressed formats must be mentioned in the application documentation along with the recommendation to specify them in fields corresponding to the file extension (e.g. "png", "jpg", "bmp").

4 A string must be used, as the PTP standard expects the tick count to be an 80-bit number. However, the current GenICam protocol returns a 64-bit integer. A string will be more reliable for future implementations.

5 The time stamps provided by the cameras are clock ticks. This can refer to the Unix epoch, the number of ticks since the camera was switched on, the number of informed ticks, or synchronization with the PTP server.

6 Enabled cameras that support PTP must specify the PTP synchronization status in the metadata, e.g.

"metadata": "{'ptpstatus': 'locked'}"…

Example of metadata of a simulated camera

{        "count": 1,        "detail": [                   {                    "format": "Mono8",                    "height": 1040,                    "width": 1024                    "id": "Emulation (0815-0000)_1_2024-02-02T15:43:13.099Z",                    "seq": 272,                    "timestamp": "2024-02-02T15:43:13.099Z",                   }                  ],        "timestamp": "2024-02-02T15:43:13.099Z",        "version": "1"

}