我正在尝试将 cv::Mat(CV_16UC1) 转换为 k4a_image_t。我正在尝试使用此函数进行转换:k4a_image_create_from_buffer。
到目前为止,我已经创建了创建图像所需的缓冲区数据。
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;
但我不明白参数'buffer_release_cb_context'。