// Multiply 正片叠底
void Multiply(Mat& src1, Mat& src2, Mat& dst)
{
for(int index_row=0; index_row<src1.rows; index_row++)
{
for(int index_col=0; index_col<src1.cols; index_col++)
{
for(int index_c=0; index_c<3; index_c++)
dst.at<Vec3f>(index_row, index_col)[index_c]=
src1.at<Vec3f>(index_row, index_col)[index_c]*
src2.at<Vec3f>(index_row, index_col)[index_c];
}
}
}
// Color_Burn 颜色加深
void Color_Burn(Mat& src1, Mat& src2, Mat& dst)
{
for(int index_row=0; index_row<src1.rows; index_row++)
{
for(int index_col=0; index_col<src1.cols; index_col++)
{
for(int index_c=0; index_c<3; index_c++)
dst.at<Vec3f>(index_row, index_col)[index_c]=1-
(1-src1.at<Vec3f>(index_row, index_col)[index_c])/
src2.at<Vec3f>(index_row, index_col)[index_c];
}
}
}
// 线性增强
void Linear_Burn(Mat& src1, Mat& src2, Mat& dst)
{
for(int index_row=0; index_row<src1.rows; index_row++)
{
for(int index_col=0; index_col<src1.cols; index_col++)
{
for(int index_c=0; index_c<3; index_c++)
dst.at<Vec3f>(index_row, index_col)[index_c]=max(
src1.at<Vec3f>(index_row, index_col)[index_c]+
src2.at<Vec3f>(index_row, index_col)[index_c]-1, (float)0.0);
}
}
}
模拟ps中的图像叠加操作,实现同样的效果


