Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You are right. OpenCV handles memory management for Mat objects.

OpenCV manages separately the Mat object and the data, so several Mat objects can share the same data (e.g. submatrices). OpenCV keeps track if data is still used, and when the data is not referenced anymore, it gets freed.