Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Change of const cv::Mat

One of the possibilities of changing the cv::Mat would be to take part of the data with ROI and change their values what in the end would mean, that the values of original cv::Mat were changed. Is it somehow possible that such operation (or any other, which I didn't think about, excluding some dirty tricks with casting) would change the values of the const cv::Mat or can I assume that this will not be allowed and every const Mat is safe for changes?

The problem could be that under the hood we are dealing with smart pointers, but maybe this is not an issue, it was somehow taken care of?

Change of const cv::Mat

One of the possibilities of changing the cv::Mat would be to take part of the data with ROI and change their values what in the end would mean, that the values of original cv::Mat were changed. Is it somehow possible that such operation (or any other, which I didn't think about, excluding some dirty tricks with casting) would change the values of the const cv::Mat or can I assume that this will not be allowed and every const Mat is safe for changes?actually constant?

The problem could be that under the hood we are dealing with smart pointers, but maybe this is not an issue, it was somehow taken care of?

Change of const cv::Mat

One of the possibilities of changing the cv::Mat would be to take part of the data with ROI and change their values what in the end would mean, that the values of original cv::Mat were changed. Is it somehow possible that such operation (or any other, which I didn't think about, excluding some dirty tricks with casting) would change the values of the const cv::Mat or can I assume that this will not be allowed and every const Mat is actually constant?

The problem could be that under the hood we are dealing with smart pointers, but maybe this is not an issue, it was somehow taken care of?

Change Constancy of const cv::Mat

One of the possibilities of changing the cv::Mat would be to take part of the data with ROI and change their values what in the end would mean, that the values of original cv::Mat were changed. Is it somehow possible that such operation (or any other, which I didn't think about, excluding some dirty tricks with casting) would change the values of the const cv::Mat or can I assume that this will not be allowed and every const Mat is actually constant?

The problem could be that under the hood we are dealing with smart pointers, but maybe this is not an issue, it was somehow taken care of?

EDIT: Maybe to rephrase my question: should I pass input array as read only with cv::InputArray or rather const cv::Mat& ? What would be more desired from the performance and immutability (constancy) point of view?