From what I've read online, when you make a submat in OpenCV, it shares the image buffer of the parent mat:
However, this does not seem to be the behavior I'm getting when using OpenCV from Java on Android.
Here's a snippet which makes a submat, and then fills it with solid blue. However, the original mat remains untouched when rendered to the screen:
//Create submat
submat1 = input.submat(new Rect(sub1pointA, sub1pointB));
//Fill submat with solid color
Imgproc.rectangle(
submat1 ,
new Point(0,0),
new Point(submat1.width(), submat1.height()),
new Scalar(0, 0, 255), -1);
If, however, I change the call to rectangle() to operate on the input mat, then I do indeed get a solid blue rectangle on the screen. What gives? Am I missing something obvious, or does a submat not share the buffer with its parent when using OpenCV for Java?
