opencv自定义从一幅图片截取特定区域,函数cvExtractRegion
IplImage* tmp;
int cvExtractRegion( IplImage* img, CvRect r, IplImage* tmp)
{
cvSetImageROI( img, r/*cvRect( x, y, w, h ) */);
tmp = cvCreateImage( cvGetSize(img), IPL_DEPTH_32F, 3 );
cvCopy( img, tmp, NULL );
cvResetImageROI( img );
return 0;
}