Need help replacing roi in image

Have a look at here

OutputArray can be the ROI of the original full image.

void cv::Mat::copyTo(OutputArray m, InputArray mask ) const