Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

LineIterator is overkill, you can just use:

int y = cropped.rows/2;
Mat line = cropped.row(y);

LineIterator is overkill, you can just use:

int y = cropped.rows/2;
Mat line = cropped.row(y);

if you still want to use it, make sure, you use the right type (uchar, not Vec3b for a grayscale image)

  vector<uchar> buf;   

for(int i=0; i<it.count; i++)
{
    buf.push_back( *it );
    it++;
}

LineIterator is overkill, overkill (for a horizontal line), you can just use:

int y = cropped.rows/2;
Mat line = cropped.row(y);

if you still want to use it, make sure, you use the right type (uchar, not Vec3b for a grayscale image)

 vector<uchar> buf;   

for(int i=0; i<it.count; i++)
{
    buf.push_back( *it );
    it++;
}