SyntaxTEst

#include<opencv2\core\core.hpp>
#include<opencv2\highgui\highgui.hpp>
#include<iostream>
#include<vector>

using namespace std;
using namespace cv;
//Add an icon to background image.
int main(void)
{
	Mat image,imageROI,icon;
	icon=imread("icon.jpg");		//icon image
	image=imread("img.jpg");		//background
	cout << "背景图像大小:"<<image.size() << endl;
	cout << "icon图像大小:"<<icon.size() << endl;		//output the size.
	imageROI=image(Rect(420,270,icon.cols,icon.rows));		//in-place.
	addWeighted(imageROI,1.0,icon,0.5,0.,imageROI);			//process.
	namedWindow("Processed Image");
	imshow("Processed Image",image);		//show processed image.
	cv::Mat mask= cv::imread("icon.jpg",0);		//read icon file as gray image.
	icon.copyTo(imageROI,mask);		//process.
	cv::namedWindow("With Gray icon");
	cv::imshow("With Gray icon",image);		//show processed image.
	waitKey(0);
	return 0;
}
posted @ 2013-05-15 10:47  GuanHaoOnceMore2014  阅读(105)  评论(0编辑  收藏  举报
分享到QQ空间