Hi; In my project, i can extract Roi's from labelled image but i didn't know how to save them for a later use .i work with cvBlob to extract blobs . here is the procedure witch extract roi but it shows only the last Roi and not all of them.Can you help me please? void extraireROI(IplImage* img,CvBlob blob) { int heigth =(blob->maxy)- (blob->miny); int width=(blob->maxx)- (blob->minx); int x=blob->minx; int y=blob->miny; cvSetImageROI(img,cvRect(x, y, width, heigth)); IplImage img2=cvCreateImage(cvGetSize(img),img->depth, 3); cvCopy(img, img2, NULL);
/* always reset the Region of Interest */
cvResetImageROI(img);
cvShowImage("ROI extraite ",img2);
}
void labelImage(IplImage *binaire,IplImage *img ) {
// Label image and extract informations
IplImage labelImg=cvCreateImage(cvGetSize(binaire), IPL_DEPTH_LABEL, 1);
CvBlobs blobs;
IplImage *roi;
unsigned int result=cvLabel(binaire, labelImg, blobs);
FilterArea(blobs, 500, 250000);
cvRenderBlobs(labelImg, blobs, img, img);
CvBlobs::iterator it=blobs.begin();
while(it!=blobs.end())
{
CvBlob *blob=(it).second;
extraireROI(img,blob);
cout << "Blob #" << it->second->label << ": Area=" << it->second->area << ", Centroid=(" << it->second->centroid.x << ", " << it->second->centroid.y << ")" << endl;
it++;
}
cvShowImage("image labellisée ",img);
}