开发者

How to properly free memory used by matrices?

开发者 https://www.devze.com 2023-03-26 03:43 出处:网络
I\'m having a conceptual problem in OpenCV I have the following function: void project_on_subspace(CvMat * projectionResult_img)

I'm having a conceptual problem in OpenCV

I have the following function:

void project_on_subspace(CvMat * projectionResult_img)
{
[...]
projectionResult_img = cvReshape( projectionResult_line_normalised_centered, projectionResult_img, 0, 100 );
}

Basically I'm returning a square matrix as a result of my function. The problem is that the actual data of my matrix is stored in "projectionResult_line_normalised_centered" (if I understood how open CV works), which means that trying to use CvReleaseMat(projectionResult_img) later in my code to free the memory will not work, as the real matrix data is elsewhere. Is there any proper way to release the actual matrix data WITHOUT also dealing with a pointer to "projectionResult_line_normalised_centere开发者_运维百科d" ?

Thanks


No, there is no other way than to keep a pointer to the result matrix (projectionResult_line_normalised_centered) around in a variable or struct member.

0

精彩评论

暂无评论...
验证码 换一张
取 消