I have ROI of the image and I need to create new image that would be subpart of image. How can I do that? (I want to make pieces an array of images, not rectangles.)
Image<Bgr, byte> img = frame.Copy();
pieces = new List<System.Drawing.Rectangle>();
int input_cell_width = img.Width / Cols;
int input_cell_height = img.Height / Rows;
System.Drawing.Rectangle old_roi = img.ROI;
for (int row = 0; row < Rows; ++row)
{
for (int col = 0; col < Cols; ++col)
{
// Get template
img.ROI = gridOuput.GetCellItemRect(row, col, new System.Drawing.Point(0, 0));
pieces.Add(img.ROI);
}
}
Thanks.