UPDATE:
My original question here is not valid, sorry. I left a line out from it, where m.create gets called. If there was no answer on this I would delete the question right away.
I’ve just noticed that Mat::adjustROI seems to change the wholeSize of cv::Mat.
Mat m(11,11,CV_32FC1);
Size wholeSize, old_size;
Point ofs;
m.locateROI(old_size, ofs);
m.adjustROI(0,old_size.height/2,0,old_size.width/2);
m.locateROI(wholeSize, ofs);
assert(wholeSize==old_size); // fails, wholeSize is now smaller
Is this normal?
If so, I suspect reallocation otherwise this could be a source of a memory leak.
If Im right, when does the reallocation occur?
I ran your code, and the assert doesn’t fail for me (MSVC 2010). I stepped through it with the debugger and I can also see in the watch window that both sizes are equal (x and y equal to 11). I’m a beginner in OpenCV, but from the documentation of the function it seems to me adjustROI should not modify “wholeSize”.