c++ - 如何从 opencv 矩阵转换为 k4a_image_t(Azure kinect sdk)
问题描述
我正在尝试将 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'。
解决方案
Think of it as a pointer to an object that you need when the buffer_release_cb function is called. If you can write that function and free the memory simply based on buffer pointer being passed in then great, you don't need to pass in anything for buffer_release_cb_context and can use NULL instead. Bug if you need the original cv::Mat object, then you should pass that in for buffer_release_cb_context and know that you will get it back as *context in your buffer_release_cb() call.
We would love feedback on how to make the documentation clearer, so feel free to comment on this if you have suggestions.
推荐阅读
- android - 在 Android Studio 中检测传输文件和传输照片(USB MASS Storage)的 Intent 过滤器
- reactjs - 在使用 reactjs 构建的任何网站上使用 chrome 扩展自动填充密码
- api - 通过 API V1 更新意图对话框流程
- javascript - 鼠标与触摸:使用 javascript 可靠地检测实际用户输入,而不是设备功能
- reactjs - 如何在休假时清除表单数据 - 反应原生
- post - 在Modelviewset中发布请求成功时如何调用函数
- c# - Digital Persona Finger Print 4500 集成 ASP.NET 和 C#
- java - 非活动输入连接
- python - 检查数据框中的列表列中是否有元素
- powershell - 尝试在电话便笺中添加创建日期并输入当前日期,但只能获得“创建日期”