Skip to content

Basler Vision Connector Messaging: Image Format#

To standardize image transfer between camera streaming applications and image-driven applications, use the following format for transferring images. The ZMQ message consists of a multipart message with each frame/part described below.

This message format is prepared to support the streaming of multiple cameras.

Message Envelope for ZMQ Messages on the Pub/Sub Channel#

Frame Field Description Type
1 topic Device identification Binary string (UTF-8) to identify the device in the following syntax: {DeviceID}/stream
2 metadata Metadata Binary metadata JSON (UTF-8)
3 image Image 1 Binary
4 … n image Image n - For multi-stream camera Binary

Metadata JSON#

Field Optional Type Default Description
version No String 1 Metadata format version
count No Integer (32-bit unsigned) 1 Number of images on message
timestamp No String - Date and time string UTF-8 ISO8601. Application host datetime
detail No Image Detail Object Array - Images details

Image Detail Object#

Field Optional Type Default Description
id No String - Unique image identifier. Suggested mnemonic format: {camid}_{camstream}_{datetime}
seq No Integer (64-bit unsigned) - Sequential number for the camera image. Starting at 1, incremented by 1 on each frame grabbed
height No / Yes (encoded formats) Integer (32-bit unsigned) - Image height
width No / Yes (encoded formats) Integer (32-bit unsigned) - Image width
formatns Yes String Genicam Image format namespace. For GenICam pixel format use Genicam and Compressed for compressed formats.a
format No String - Image format ab
linepadding Yes Integer (32-bit unsigned) 0 Number of bytes added to the end of a byte stream to reach a multiple of 4 bytes. E.g. an image with 61 pixels, Mono 8 format, will have a line padding of 3, filling the stream to reach 64 bytes.
timestamp Yes Stringc - Timestamp sent by the camerad

  1. The Basler Vision Connector only supports GenICam, no compressed formats.

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

  3. A string is used since, in the PTP standard, the tick count is expected to be an 80-bit number. However, the current GenICam protocol returns a 64-bit integer.

  4. Timestamps provided by the cameras are tick counts. Ticks are defined by the camera and therefore vary from camera to camera. This can be either referencing the Unix epoch, or the number of ticks since the camera is on, or count of ticks informed/in sync with the PTP server.

Metadata Example#

{
  "version": "1",
  "count": 1,
  "timestamp": "2014-01-09T13:35:34.000000000+0100",
  "detail":[
    {
      "id":"mycamera_1_2014-01-09T13:35:34.000000000+0100",
      "seq": 3,
      "height": 852,
      "width": 1280,
      "formatns": "Genicam",
      "format": "BGR8",
      "linepadding": 0,
      "timestamp": "123456"
    }
  ]
}