Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Possible to device iterator over NxN blocks in an image?

I'd like to do something like:

Mat foo(N, N, CV_MAKETYPE(CV_8U, 1), data);
typedef Matx<uint8_t, 4, 4> block;
auto iblock = foo.begin<block>();
auto done = foo.end<block>();
while (iblock != done)
{
    Mat blk(*iblock);
    // process my 4x4 block
}

I think this should be possible, but not sure how.

Possible to device devise iterator over NxN blocks in an image?

I'd like to do something like:

Mat foo(N, N, CV_MAKETYPE(CV_8U, 1), data);
typedef Matx<uint8_t, 4, 4> block;
auto iblock = foo.begin<block>();
auto done = foo.end<block>();
while (iblock != done)
{
    Mat blk(*iblock);
    // process my 4x4 block
}

I think this should be possible, but not sure how.

Possible to devise iterator over NxN blocks in an image?

I'd like to do something like:

Mat foo(N, N, CV_MAKETYPE(CV_8U, 1), data);
typedef Matx<uint8_t, 4, 4> block;
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.

click to hide/show revision 4
Tweaked code example for constistency with question title.

Possible to devise iterator over NxN blocks in an image?

I'd like to do something like:

Mat foo(N, N, foo(IMGSIZE, IMGSIZE, CV_MAKETYPE(CV_8U, 1), data);
typedef Matx<uint8_t, 4, 4> block;
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.

click to hide/show revision 5
retagged

updated 2013-11-22 13:30:25 -0600

berak gravatar image

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.