在while循环中填充Mat
OpenCV: Fill Mat in while loop?
我正在使用OpenCV,我正在尝试填充大小
cv::Mat Mat = cv::Mat(DEPTH_HEIGHT, DEPTH_WIDTH, CV_16U);
并将其填充为while循环中的depth
值:
while (curr < dataEnd) {
// Get depth in millimeters
USHORT depth = NuiDepthPixelToDepth(*curr++);
cv::Mat Mat++ = depth;
}
是否有一些方法迭代到垫,使每个深度值存储在一个HeightxWidth垫索引?
for (i=0;i<mat.rows;i++)
{
uint16_t* ptr = mat.ptr<uint16_t>(i);
for (j=0;j<mat.cols;j++)
{
*ptr++ = value for pixel (i,j)
}
}
注意,你应该使用ptr(row#),因为每一行像素的开始可能与地址边界对齐。
相关文章:
- Difference in displaying cv2 Mat
- 在c++中用vector填充一个简单的动态数组
- 如何使用用户输入在C++中正确填充2D数组
- 如何找到大小'x'数组是否完全填充,在C++?
- Cuda C++:设备上的Malloc类,并用来自主机的数据填充它
- 通过for循环使用用户输入填充列表
- 为什么Mat类的两个对象可以在不重载运算符+的情况下添加
- 将CHW格式的浮点向量转换为cv::Mat
- C++中的openCV Mat访问冲突
- 根据用户输入用字母填充矢量,并将"开始"和"结束"放在四肢
- 如何正确填充在堆上分配的二维数组?
- 将数字转换为填充字符串
- 有没有办法在一行中填充矢量图
- 用C++中的数字和条件填充向量
- 用真值填充矢量
- 使用结构成员指针在C++中填充结构
- 将带有零的 Mat 内核填充到 Image 的大小
- 使用 'std::generate' 或 'std::fill' 来填充 'arma::mat'
- 逐行填充 cv::mat 调用函数
- 在while循环中填充Mat