[OpenCV] Copy SubImage from IplImage using ROI


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. void getSubImg(IplImage* img, IplImage* subImg, CvRect roiRect) {
  2.  
  3. cvSetImageROI(img, roiRect);
  4. subImg = cvCreateImage(cvGetSize(img), img->depth, img->nChannels);
  5. cvCopy(img, subImg, NULL);
  6. cvResetImageROI(img);
  7.  
  8. }

URL: http://nashruddin.com/OpenCV_Region_of_Interest_(ROI)

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.