Ask Your Question

Revision history [back]

You can use ROI to overly the source on destination.

Assume you got the co-ordinates like

int x= //overlay x
int y= //overlay y
int width = //overlay width
int height = //overlay height

Mat green; // source image.
Mat blue; //destination image.
Mat ROI1=green(Rect(x,y,width,height));//Apply RIO on source image from which overlay portion taken.
Mat ROI2 = blue(0,0,width,height);// assume you have to apply overlay from (0,0).
ROI1.copyTo(ROI2)// copy overlay to destination