1 | initial version |
You use delete only on a pointer that you created with new and ONLY then! To release the image, use cvReleaseImage(&testImage). If you had used the Mat-class instad of the old IplImage, you wouldn't have this problem of releasing data. The Mat class has a constructor that accepts a pointer to the data, so you can use that.