IplImage 与mat之间的转换及释放内存

   IplImage *x = cvLoadImage(savefilename, 1);
   Mat img(x,true);
   cvReleaseImage(&x);

cv::Mat数据类型的释放,以及release和clear之间的区别;

The cv::release() function releases the memory , which the destructor will take care of at the end of the scope of the Mat instance anyways. So you need not explicitly call it in the code snippet that you have posted. An example of when it would be needed is if the size of the Matrix can vary in different iterations within the same loop, i.e.,

 

参考

1. opencv_cv::Mat_release;

2. example_cpp_release;

3. stackoverflow;

posted on 2018-05-02 15:30  鹅要长大  阅读(376)  评论(0编辑  收藏  举报

导航