具体的算法原理可以参考
// PS_Algorithm.h
#ifndef PS_ALGORITHM_H_INCLUDED
#define PS_ALGORITHM_H_INCLUDED
#include <iostream>#include "cxcore.hpp"
using namespace std;#endif // PS_ALGORITHM_H_INCLUDED
// main function
#include "PS_Algorithm.h"
void Linear_Burn(Mat& src1, Mat& src2, Mat& dst);
void Linear_Dodge(Mat& src1, Mat& src2, Mat& dst);
void Lighten(Mat& src1, Mat& src2, Mat& dst);
void Darken(Mat& src1, Mat& src2, Mat& dst);
int main(void)
{
Mat Origin_Image1;
Mat Origin_Image2;
Origin_Image1=imread("2.jpg");
Origin_Image2=imread("3.jpg");
Mat Image_up(Origin_Image1.size(),CV_32FC3);
Mat Image_down(Origin_Image2.size(), CV_32FC3);
Origin_Image1.convertTo(Image_up,CV_32FC3);
Origin_Image2.convertTo(Image_down,CV_32FC3);
Image_up=Image_up/255;
Image_down=Image_down/255;
Mat Image_mix(Image_up);
//Linear_Burn(Image_up, Image_down, Image_mix);
//Linear_Dodge(Image_up, Image_down, Image_mix);
//Lighten(Image_up, Image_down, Image_mix);
//Darken(Image_up, Image_down, Image_mix);
namedWindow("Img", CV_WINDOW_AUTOSIZE);
imshow("Img",Image_mix);
waitKey();
cvDestroyWindow("Img");
cout<<"All is well."<<endl;
return 0;
}
// linear Burn
void Linear_Burn(Mat& src1, Mat& src2, Mat& dst)Opencv——PS 图层混合算法 (二),布布扣,bubuko.com
原文:http://blog.csdn.net/matrix_space/article/details/37760609