edu.51cto.comedu.51cto.comOpenCV3.1.0–图像处理教程edu.51cto.com讲师:贾志刚E-Mail:bfnh1998@hotmail.com微博:流浪的鱼-GloomyFishedu.51cto.com图像混合理论-线性混合操作相关API(addWeighted)代码演示edu.51cto.com理论-线性混合操作)()()1(g(x)10xfxf其中的取值范围为0~1之间edu.51cto.com相关API(addWeighted)参数1:输入图像Mat–src1参数2:输入图像src1的alpha值参数3:输入图像Mat–src2参数4:输入图像src2的alpha值参数5:gamma值参数6:输出混合图像注意点:两张图像的大小和类型必须一致才可以edu.51cto.comMatsrc1,src2,dest;src1=imread("D:/vcprojects/images/LinuxLogo.jpg");src2=imread("D:/vcprojects/images/win7logo.jpg");if(!src1.data){printf("couldnotloadLinuxLogoimage...\n");return-1;}if(!src2.data){printf("couldnotloadwin7logoimage...\n");return-1;}if(src1.rows==src2.rows&&src1.cols==src2.cols){doublealpha=0.5;namedWindow("line-blend",CV_WINDOW_AUTOSIZE);addWeighted(src1,(1-alpha),src2,alpha,0.0,dest);imshow("line-blend",dest);waitKey(0);return0;}else{printf("imagesizeisnotsame...\n");return-1;}edu.51cto.comThankYou!edu.51cto.com