#include <opencv2\opencv.hpp>
#include "ProcessPixels.h"
using namespace CV;
using namespace Std;
int main ()
{
Mat image=imread ("e:\\yifu.jpg");
Mat logo=imread ("e:\\wawa.jpg"); Load images as color maps by default
Mat mask=imread ("E:\\wawa.jpg", 0); Load images as grayscale graphs
if (Image.empty () &&logo.empty ())
{
cout<< "Error";
return-1;
}
Mat Imageroi;
Imageroi = Image (Rect (0,0,logo.cols,logo.rows)); Define the ROI of the image and the upper-left corner coordinates (0,0)
Addweighted (Imageroi,1.0,logo,0.3,0.,imageroi); The logo image is added directly to the original image (and may be accompanied by pixel saturation), and the visual effect is not very satisfying.
Logo.copyto (Imageroi,mask);
Namedwindow ("Image Result");
Imshow ("Image Result", image); The resulting image is displayed in the images result window
Waitkey (0); Wait for the user's key input before exiting the program
return 1;
}
Add logo to Image