1 | initial version |
copyTo is the correct approach, however be mindful that the function will fail without warning in many cases. A common pitfall is if you try to copy an RGBa image into GBR or vice versa
var selectedArea = RGBaImgToDisplay.submat(resultRect)
sampleImageColor.copyTo(selectedArea)
will not work, unless you first make sure that sampleImageColor is also an RGBa like so:
cvtColor(bgrImage, sampleImageColor, Imgproc.COLOR_BGR2RGBA);
Then it works as expected