У меня есть простая функция, которая пытается перебрать все пиксели в одном канале cv :: Mat. Это не работает правильно. Я запускаю это в xcode на ios sim.
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<int>(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, ...