Femto Bolt Documentation

Get Image Data


This document shows how to get depth and color image data through Femto Bolt. Before obtaining the image data, the device needs to be opened and the data stream needs to be enabled by configuration.

Before configuring and obtaining image data, the device must be searched for and opened.

You can refer to the “streaming sample” which demonstrates how to use the functions described in this article.

The following functions will be introduced in this document:



Configure and Start the Device

The Femto Bolt depth camera and color camera support a variety of modes, resolutions, and output formats. For a complete list, please refer to 《Hardware Specifications》
The data stream configuration is done through the k4a_device_configuration_t data structure.

k4a_device_configuration_t config = K4A_DEVICE_CONFIG_INIT_DISABLE_ALL;
config.camera_fps = K4A_FRAMES_PER_SECOND_30;
config.color_format = K4A_IMAGE_FORMAT_COLOR_MJPG;
config.color_resolution = K4A_COLOR_RESOLUTION_2160P;
config.depth_mode = K4A_DEPTH_MODE_NFOV_UNBINNED;

if (K4A_RESULT_SUCCEEDED != k4a_device_start_cameras(device, &config))
    printf("Failed to start device\n");
    goto Exit;

Once the camera is started, it continuously captures data until k4a_device_stop_cameras() function is called or the device is closed.




When using multi-device synchronization, we strongly recommend using fixed exposure settings. If automatic exposure is used, at most 20 frames may be needed for the image and frame rate to stabilize.



Get Capture from Device

After opening the video stream, the Capture is used to obtain image data, and each Capture contains a depth image, IR image, color image or a combination of these images.

By default, the API returns the capture only after receiving all requested images. By setting the  synchronized_images_only  parameter of k4a_device_configuration_t  to false, the API can be configured to immediately return a partial capture containing only depth or color images once they are available.

// Capture a depth frame
k4a_capture_t capture = NULL;
switch (k4a_device_get_capture(device, &capture, TIMEOUT_IN_MS))
    printf("Timed out waiting for a capture\n");
    printf("Failed to read a capture\n");
    goto Exit;

Once the API returns Capture successfully, when you finish using the Capture object, you must call k4a_capture_release(.



Get Image from Capture

To obtain the image contained in the Capture, call the corresponding function for different types of images.

After obtaining the image data, k4a_capture_release() needs to be called to release the k4a_image_t handle.



Obtain Image Data

k4a_image_tprovides corresponding functions to obtain image attributes. To obtain the memory buffer of the image, use k4a_image_get_buffer.

The method for obtaining IR and color images is similar to that of obtaining depth images, and the image type variable should be replaced with the correct image type, such as ir or color.

// Access the depth16 image
k4a_image_t image = k4a_capture_get_depth_image(capture);
if (image != NULL)
    printf(" | Depth16 res:%4dx%4d stride:%5d\n",

    // Release the image

// Release the capture



Next Steps

Now that you know how to obtain color and depth images using Femto Bolt devices, you can also:

《Get IMU Data》,《Image Transformation》

Stay updated

Be the first to learn about our new
products and updates.