Home > OpenCV > ROI

ROI

IplImage* cvGetSubImage(IplImage *image, CvRect roi)
{
    IplImage *result;
    // 设置 ROI
    cvSetImageROI(image,roi);//基于给定的矩形设置感兴趣区域

    // 创建子图像
    result = cvCreateImage( cvSize(roi.width, roi.height), image->depth, image->nChannels );
    cvCopy(image,result);//将图像复制给子图像
    cvResetImageROI(image);//释放图像的ROI

    return result;//返回子图像
}

Advertisements
Categories: OpenCV
  1. No comments yet.
  1. 2011-03-20 at 19:16

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: