Frame buffer structure

Last modified by Lev Andronov on 2024/11/03 16:47

The frame and a pointer

In the KAYA API 'the frame' refers to a memory location and a 'pointer' serves as an indicator, storing the address and directing to the exact location of the data.

A 'pointer' is a memory address that contains the location of the data itself, whis is used to access the raw pixel buffer, and its structure varies based on the camera's pixel format setting.


Saving or displaying an acquired data

Our SDK purporse is to give access to the image stream buffer.

To create your own application you should start with the 'KYFGLib_Example_QueuedBuffers' example included in the installation. This example demonstrates how to use 'KY_STREAM_BUFFER_INFO_BASE' and 'KY_STREAM_BUFFER_INFO_SIZE' to access the raw data of each acquired frame. The 'Stream_callback_func' function shows how to obtain a pointer to the memory where the raw data is located and its size. This allows access to the raw data, which can then be processed or displayed using tools like FFmpeg or OpenCV.


Memory block interpretaion

That memory block does not contain any meta information. It is just a plain array of pixels, one after another. How exactly each pixel is represented and how many bytes are used for each pixel - depends on camera and grabber configurations as descried below:

  • Camera parameters 'Width' and 'Height' define resolution of the image
  • The parameter 'PixelFormat' defines representation of each pixel in the memory, for example: 
    • in case Mono 8 format (the simplest one), each pixel has only one color channel - grayscale - and is represented by a single byte in the memory. 
    • In case of Mono 10, 12, 14, and 16, each pixel (single grayscale channel) is represented by two bytes in little-endian order
    • In case of RGB there are 3 color channels for each pixel. So, for RGB8 format 3 bytes are used for each pixel, and in case of RGB 10, 12, 14, and 16 - 6 bytes are used
    • There are other formats possible, which we'll describe in a more detail if you will need them
  • Next, it is possible, but not necessarily, to configure frame grabber to transform received buffer data from one format to another, etc.

Demosaic Bayer frame

By default, the displayed image in the Vision Point application is monochrome, regardless of the sensor type. To display a color image, Debayer mode should be activated for a Bayer camera.

More information can be found in Demosaic Bayer modes article.


Pixel formats

Pixel formats with 8 bits per pixel, the buffer allocates 8 bits (1 byte) for each pixel. Higher bit depths like 10, 12, 14, or 16 bits, the buffer allocates 2 bytes per pixel, utilizing a little-endian format for storage.

In mono format, each 1 byte or 2 bytes signifies a single pixel.

More information can be found at Pixel formats article.

KAYA Instruments © 2024. All Rights Reserved.