开发者

How to properly free memory used by matrices?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜