Add logo to Image

Source: Internet
Author: User

#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

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.