Example: Image loading, display, blending and output [OpenCV Note 8]

Source: Internet
Author: User

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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.