What's the point of having a const cv::Mat?
It looks like openCV can modify a Mat even if it's const. Many function (e.g. morphologyEx
or GaussianBlur
) will happily take and modify a const cv::Mat
. I suppose that's because they could be making a copy of the header, but then access the raw data and modify it. The OutputArray
type is even defined as typedef const _OutputArray& OutputArray;
.
Is this by design? What's the idea behind it? How can one protect a cv::Mat from changes?
(a related question is http://answers.opencv.org/question/41...)
just curious, where did you find, that GaussianBlur manipulates the input image ?
GaussianBlur manipulates the
OutputArray
, which is typedef-ed as const. Basically it doesn't matter if you have aconst cv::Mat
, opencv will still change it via the raw pointer.