Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Since you already compute the bounding box of the contours, you can do something like this

std::vector<cv::Mat> contour_rois;
for(int i = 0; boundRect.size(); i++)
{
    cv::Mat roi( binaryImg, boundRect[i]);
    contour_rois.push_back(roi);
}