title: Crop Image in Emgu.CV
body: <p>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.)</p>
  
  <pre><code>Image&lt;Bgr, byte&gt; img = frame.Copy();
  pieces = new List&lt;System.Drawing.Rectangle&gt;();
  
  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 &lt; Rows; ++row)
  {
      for (int col = 0; col &lt; Cols; ++col)
      {
          // Get template
          img.ROI = gridOuput.GetCellItemRect(row, col, new System.Drawing.Point(0, 0));
          pieces.Add(img.ROI);
      } 
  }
  </code></pre>
  
  <p>Thanks.</p>