I am writing a class in and I'm unsure of memory management. I have several methods that receive a Mat() as input and return a Mat() as well. For example:
private Mat doSomething(Mat inMat){
Mat nonZeros= Mat.zeros(inMat.size(), inMat.channels());
Core.findNonZero(drawnRect, nonZeros);
return nonZeroes;
}
I'm not sure how to relate to inMat and outMat in terms of memory, do I need to call release()
on them at some point? If so how should I handle that in such a case, where the new Mat()
declaration is in a different scope then the usage?