I am working with opencv image processing library. I just want to replace rectangular region(smaller than the original image) of my original Mat image with another small image. I couldn't find a direction to do this
Can anybody help me please. Thanks in advance
Here's a way, not claiming its the best way.
Mat m = ... // your smaller mat
Mat submat= matOrig.submat(new Rect(x,y, m.cols(), m.rows()) );
m.copyTo(submat);
That should work assuming m doesn't go out of bounds inside matOrig. When you get a submat, it is still linked to its source Mat.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With