Yes yes, endure the urine to try to update, is to more to the Wuli, of course, the male God in front of the town building, welcome to download map, the specific operation see Code
Wulieddie.jpg
Logo.png
Results.jpg
Loadshowwriteimage.cxx
#include <opencv2/opencv.hpp>#include<opencv2/highgui/highgui.hpp>//#include <opencv2/imgcodecs/imgcodecs.hpp>//#include <opencv2/imgproc/imgproc.hpp>intMain () {//load image and showCv::mat image = Cv::imread ("wulieddie.jpg"); Cv::namedwindow ("Image"); Cv::imshow ("Image", image); //overlap ImagesCv::mat logo = Cv::imread ("logo.png"); Cv::namedwindow ("Logo"); Cv::imshow ("Logo", logo); //define a Mat instance to save ROICv::mat Imageroi; Imageroi= Image (Cv::rect ( -, -, logo.cols,logo.rows)); //Rect (x,y,width,height)//another//Imageroi = Image (Cv::range (350,350+logo.rows), Cv::range (800,800+logo.cols)); //put the logo onto the imageAddweighted (Imageroi,1.0, logo,1.0,0., Imageroi); //void cv::addweighted (Inputarray src1, double alpha, Inputarray src2, double beta,//Double Gamma, outputarray dst, int dtype =-1)//Show ResultsCv::namedwindow ("Image with Logo"); Cv::imshow ("Image with Logo", image); Cv::waitkey (); //Save ImageCv::imwrite ("results.jpg", image); return 0;}
Example: Image loading, display, blending and output [OpenCV Note 8]