【发布时间】:2016-10-14 11:31:20
【问题描述】:
我在遍历 OpenCV Mat 的坐标时遇到问题:
cv::Mat picture = cv::Mat(depth.rows, depth.cols, CV_32F);
for (int y = 0; y < depth.rows; ++y)
{
for (int x = 0; x < depth.cols; ++x)
{
float depthValue = (float) depth.at<float>(y,x);
picture.at<float>(y, x) = depthValue;
}
}
cv::namedWindow("picture", cv::WINDOW_AUTOSIZE);
cv::imshow("picture", picture);
cv::waitKey(0);
结果图片:
之前(深度)
之后(图片)
好像是 1. 缩放和 2.停在宽度的三分之一左右。有什么想法吗?
【问题讨论】:
-
深度也是 cv_32f 吗?请告诉我们它的定义
-
另外
CV_32F在此处无效。你应该使用CV_32FC<number of channels>。详情见here
标签: c++ opencv iterator coordinates mat