Possible to devise iterator over NxN blocks in an image?
I'd like to do something like:
Mat foo(IMGSIZE, IMGSIZE, CV_MAKETYPE(CV_8U, 1), data);
typedef Matx<uint8_t, 4, 4> block; // N=4
auto iblock = foo.begin<block>();
auto done = foo.end<block>();
while (iblock != done)
{
Mat blk(*iblock);
// process my 4x4 block
++iblock;
}
I think this should be possible, but not sure how.
No clue what a devise iterator is, but it looks like your stuff can be solved with mask http://docs.opencv.org/doc/tutorials/core/mat-mask-operations/mat-mask-operations.html
Explain a bit better what you want to do
"Devise" is a verb.
@Moster, he wants to traverse the Mat not pixel by pixel, but in bigger chunks, like a 4x4 roi at a time. think of a grid.
Looking more closely at Matx, I don't think that structure is necessarily appropriate; an iterator that's based on Mat would work just as well for my purpose.