0

I'm new in OpenCV. I want to know how is posible to extract a set of Mat from a original Mat like next one:

Mat divided by regions

As you see on the image, I divide the Mat in different regions. Now I want to get the different "subMats" or regions individually.

My question is how can I do that. What is the best way get the list of 36 Mats I must get.

Thanks!

1 Answers1

0

Assuming you already have the coordinates of the top left corner of each submat, I think you can use something like (C++ code):

cv::Mat submat = cv::Mat(original_img, cv::Rect(x, y, width, height));

Where (x,y) are the coordinates of the top left corner, width and height the dimensions of the submat

Put this in a loop to extract your submats and store them in a vector.

nmud
  • 175
  • 14
  • There's even the *operator()(const Rect& roi)* (http://docs.opencv.org/2.4/modules/core/doc/basic_structures.html#Mat Mat::operator()(const Rect& roi) const) to extract sub mats given regions specified by various types. – s1hofmann Feb 19 '16 at 12:59