I am trying to convert cv::Mat(CV_16UC1) to k4a_image_t. I am trying to do the conversion using this function this function: k4a_image_create_from_buffer.
here is the link: https://microsoft.github.io/Azure-Kinect-Sensor-SDK/master/group___functions_gaf84f2a271bcf6afae429bbccd47071b3.html#gaf84f2a271bcf6afae429bbccd47071b3
so far I have created the buffer data needed to create the image.
std::vector<uchar> array;
if (depth_im.isContinuous())
{
array.assign(depth_im.data, depth_im.data + depth_im.total());
}
else
{
for (int i = 0; i < depth_im.rows; ++i)
{
array.insert(array.end(), depth_im.ptr<uint16_t>(i),
depth_im.ptr<uint16_t>(i) + depth_im.cols);
}
}
uint8_t* b_data = reinterpret_cast<uint8_t*>(&array[0]);
k4a_image_t new_depth_im = NULL;
But I do not understand the parameter 'buffer_release_cb_context'.