C++: Delete Uchar Variable after Assigned Mat Data
作者:XD / 发表: 2020年8月4日 03:24 / 更新: 2020年8月4日 03:24 / 编程笔记 / 阅读量:1769
The memory needs to be released. But the uchar variable cannot be deleted directly after assigned. Here is the code.
Mat new_img = Mat::ones(2, 2, CV_8UC3);
uchar *img_array = new uchar[new_img.rows*new_img.cols];
img_array = new_img.data;
img_array = NULL;
delete[] img_array;
相关标签