image是原图,logo和mask是小幅图像,其中182,63,215,235,分别是覆盖位置左上角的点和覆盖的width和height
cv::Mat image = cv::imread("D:/imagewarping/testresult/hansome.jpg");
cv::Mat logo = cv::imread("D:/imagewarping/testresult/trans.jpg");
cv::Mat mask = cv::imread("D:/imagewarping/testresult/trans.jpg", 0);
cv::Mat imageROI;
imageROI = image(cv::Rect(182, 63, 215, 235));
logo.copyTo(imageROI, mask);
cv::namedWindow("result");
cv::imshow("result", image);
imwrite("D:/imagewarping/testresult/plantsrc.jpg", image);cv::waitKey();