Hello,
In part of my code I am doing this!
// LONG_HIST, etc. are pre-defined
// getHistoryLong() etc. return IplImage*
myMasks.push_back(std::make_pair<int, IplImage>(LONG_HIST, *cvCloneImage(repmo.getHistoryLong())));
myMasks.push_back(std::make_pair<int, IplImage>(LONG_HIST_NEW, *cvCloneImage(repmo.getHistoryLong())));
myMasks.push_back(std::make_pair<int, IplImage>(SHORT_HIST, *cvCloneImage(repmo.getHistoryLong())));
The reason I am cloning the image is that if I don't and simply dereference it, after stack call is returned, the information is gone! I mean partially. Because it turns out that when I am trying to fetch the saved values back into the main application It is having access violation errors.
This solves the problem except the fact that now I am getting memory allocation failures from OpenCV. I believe that using cvCloneImage() I am making too many calls to malloc but not freeing the memory correctlyl. However, I might be wrong. Shall I store it as OpenCV and load it as IplImage* pointer to be safe?