I need to extract the color and depth data from the Azure Kinect and save that to file. I went through the SDK examples but I can't figure it out.
After setting everything up I can get the color data with:
k4a_device_configuration_t config = K4A_DEVICE_CONFIG_INIT_DISABLE_ALL;
config.color_format = K4A_IMAGE_FORMAT_COLOR_BGRA32;
config.color_resolution = K4A_COLOR_RESOLUTION_720P;
config.depth_mode = K4A_DEPTH_MODE_NFOV_UNBINNED;
config.camera_fps = K4A_FRAMES_PER_SECOND_30;
k4a_device_start_cameras(device, &config);
k4a_device_get_capture(device, &capture, TIMEOUT_IN_MS)
k4a_image_t image;
image = k4a_capture_get_color_image(capture);
uint8_t* color_data = (uint8_t*)(void*)k4a_image_get_buffer(image);
and then what? How do I parse the color values for each pixel?
It's all new for me so any help would be appreciated. Thanks in advance, Guido
This is how I did using OpenCV:
uint8_t* image_data = (uint8_t*)(void*)k4a_image_get_buffer(color_image);
cv::Mat color_frame = cv::Mat(k4a_image_get_height_pixels(color_image), k4a_image_get_width_pixels(color_image), CV_8UC4, image_data, cv::Mat::AUTO_STEP);