The following code
int main(int argc, char** argv)
{
cv::Mat1b i1(cv::Size(1, 2));
i1.at<uchar>(0, 0) = 1;
i1.at<uchar>(1, 0) = 1;
cv::Mat1b mask(i1.size());
mask.at<uchar>(0, 0) = 1;
mask.at<uchar>(1, 0) = 0;
cv::Mat1b masked;
mask.copyTo(masked, mask);
masked.release(); //or .deallocate()
cout << masked << endl;
i1.copyTo(masked, 1 - mask);
cout << masked << endl;
return 0;
}
behaves very differently when masked.release()
is replaced by masked.deallocate()
. In the latter case it seems that the matrix masked
is not modified at all and the output masked
is the sum of masked and invert masked matrices, thus equal to the original im1
matrix. What does deallocate()
member method actually do? I use openCV 3.1.