Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

given, you have a vector< vector<Point> >& squares, you could try like this:

for (size_t i=0; i<squares.size(); i++) {
    Rect r = boundingRect(squares[i]);
    Mat crop = image(r);
    imwrite(format("rect_%d.png",i), crop);
}