Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Tracker::LabelConnectedComponents(Mat& Frame, Mat& Foreground)
- {
- // Convert to old format, this is the method used in the opencv cheatsheet
- IplImage IplFrame = Frame;
- IplImage IplForeground = Foreground;
- IplImage *LabelImg = cvCreateImage(cvGetSize(&IplFrame), IPL_DEPTH_LABEL, 1);
- // Make blobs (IplForeground is the segmented frame, 1 is foreground, 0 background)
- unsigned int result = cvLabel(&IplForeground, LabelImg, Blobs);
- // Remove small blobs
- cvFilterByArea(Blobs, 500, 1000000);
- // Draw bounding box
- cvRenderBlobs(LabelImg, Blobs, &IplFrame, &IplFrame, CV_BLOB_RENDER_BOUNDING_BOX | CV_BLOB_RENDER_CENTROID);
- // Convert back to c++ format
- Frame = cvarrToMat(&IplFrame);
- // Here are the problems
- cvReleaseImage(&IplFrame); // error
- cvReleaseImage(&IplForeground); // error
- cvReleaseImage(&LabelImg); // ok
- }
- tracker.cpp|35 col 33 error| cannot convert ‘IplImage* {aka _IplImage*}’ to ‘IplImage** {aka _IplImage**}’ for argument ‘1’ to ‘void cvReleaseImage(IplImage**)’
- IplImage IplFrame = Frame;
- IplImage IplForeground = Foreground;
- cvReleaseImage(IplFrame);
- cvReleaseImage(IplForeground);
- Mat frame = ...
- Mat fg = ...
- LabelConnectedComponents(frame, fg); // function releases the frame/fg memory
- // at this point you are left with invalid frame/fg
- IplImage* pimg= cvLoadImage();
- ...
- cvReleaseImage(pimg);
- IplImage img;
- ...
- cvReleaseImage(&&img);
Add Comment
Please, Sign In to add comment