cv::Mat fillEdge(cv::Mat floated) {
float currentColor = 255.0;
cv::Size shape = floated.size();
int h = shape.height;
int w = shape.width;
int count = 1;
for(int y = 0; y!= h; y++) {
for(int x = 0; x!= w; x++) {
cv::Point2i p(y, x);
floated.at(p) = currentColor;
}
}
std::cout << floated.channels() << std::endl;
// prints 1
std::cout << floated << std::endl;
return floated;
}
出于某种原因,它会打印条纹图像。
在函数返回之前,cv::mat的输出是什么样子的
[255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255,
0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0,
0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0,
0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, ...