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.