I'm sorry if this may seem like a silly question... I've a doubt about cvLoadImage in OpenCV:
IplImage *frame;
for (unsigned int i = 0; i < LENGTH; i++)
{
frame = cvLoadImage(filename.c_str());
// do something...
}
For each call of cvLoadImage
is a new IplImage
stored in memory? Is the old variable pointed by frame
released from heap after the override?
Furthermore, when I try to release an image as follow...
IplImage *frame;
for (unsigned int i = 0; i < LENGTH; i++)
{
if (frame != NULL)
cvReleaseImage(&frame);
frame = cvLoadImage(filename.c_str());
// do something...
}
Why doesn't this solution work (bad memory access)? Best regards, Vi.
Yes, memory allocated by cvLoadImage. Error appears because you not initialized frame in the beginning. It must be initialized by zero, or NULL.