This blog is about programming and other technological things. Written by someone developing software for fun and professionally for longer than I want to admit and in more programming languages that I can remember
Recently I found an interesting OpenCV behaviour.
OpenCV cv::Mat
is built to be easy to use. It will allocate, free and reallocate it's own internal data. That's fine for most of the uses, but what if you are sensitive to extra memory allocations?
As you might expect, C++ developers very often track the memory ownership of any allocated piece of memory, especially when copying memory is not an option.
To use cv::Mat
without copying the buffer, you can use this class constructor that does not own the memory:
This blog is about programming and other technological things. Written by someone developing software for fun and professionally for longer than I want to admit and in more programming languages that I can remember