Memory leaks in IplImage
I have the function, which is leaking memory:
void CAsynchronousGrabDlg::ComputeVariables(FramePtr pFrame)
{
IplImage *testImage;
byte *imageData;
pFrame -> GetImage(imageData);
VmbUint32_t nWidth, nHeight;
nWidth = m_pApiController->GetWidth();
nHeight = m_pApiController->GetHeight();
testImage = cvCreateImage(cvSize(nWidth, nHeight), IPL_DEPTH_8U, 1);
cvSetData(testImage, imageData, nWidth);
// delete imageData;
// delete testImage;
}
If I try to use delete function, for example delete imageData or delete testImage, I get memory assertion. Can someone tell me, how to correctly deallocate memory for these functions?
By finding out how Vimba stores its frames and converting it to IplImage or better, Mat. Or you could go the easy way and simply create a copy by iterating over the picture and copying the pixel values.