现在的位置: 首页 > 综合 > 正文

opencv-输入两幅图像实现线性融合

2013年10月15日 ⁄ 综合 ⁄ 共 615字 ⁄ 字号 评论关闭
#include <cv.h>
#include <highgui.h>
#include <iostream>
using namespace cv;
using namespace std;

int main()
{
	double alpha = 0.5;double beta;double input;

	Mat src1,src2,dst;

	cout<<"Simple linear blender"<<endl;
	cout<<"---------------------"<<endl;
	cout<<"*Enter alpha [0-1]: "<<endl;
	cin>>input;

	if (alpha>=0&&alpha<=1)
	{
		alpha=input;
	}

	src1 = imread("G:\\LinuxLogo.jpg");
	src2 = imread("G:\\WindowsLogo.jpg");
	
	namedWindow("src1",WINDOW_AUTOSIZE);
	namedWindow("src2",WINDOW_AUTOSIZE);
	namedWindow("Linear Blend",1);

	beta = (1.0 - alpha);
	addWeighted(src1,alpha,src2,beta,0.0,dst);

	imshow("src1",src1);
	imshow("src2",src2);
	imshow("Linear Blend",dst);
	waitKey(0);

	return 0;
	
}

抱歉!评论已关闭.