我想从相机中获取部分图像。我有这个代码。这段代码在相机上给了我矩形。我需要获取矩形包含图像。
for(int i=0;i<(detectRect_face ? detectRect_face->total:0); i++ )
{
CvRect* r = (CvRect*)cvGetSeqElem(detectRect_face, i);
CvPoint pt1 = { r->x+20, r->y+20 };
CvPoint pt2 = { r->x + r->width-20, r->y + r->height-10 };
cvRectangle(frame, pt1, pt2, CV_RGB(255,0,0), 1,8, 0);
//I need to write here a method to get this rectangle include image.
}