Ask Your Question

Revision history [back]

How do I crop out the rectangle drawn around the detected body and store it in a different Mat for further processing?

 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);