How to crop out the region of interest (a rectangle drawn around the detected boy) and store it in a separate Mat for further processing?

asked 2015-11-02 13:57:54 -0600

srn223 gravatar image
 A rectangle is drawn around the detected body in a frame and the result is stored in the Mat current_frame. I want to crop out this region of interest ie the body bounded by the rectangle and store it in a separate Mat image. How should I do it?

 //Draw the rectangle around the found body
 for (i=0; i<found_filtered.size(); i++)
 {
 Rect region_of_interest = found_filtered[i];
 rectangle (current_frame,region_of_interest,Scalar(0,255,0),2,8,0);
 }
 namedWindow("Rectangle",1);
 imshow("Rectangle",current_frame);
edit retag flag offensive close merge delete