# 使用OPENCV简单实现具有肤质保留功能的磨皮增白算法

Dest =(Src * (100 - Opacity) + (Src + 2 * GuassBlur(EPFFilter(Src) - Src + 128) - 256) * Opacity) /100 ;

	public static Mat face2(Mat image) {
Mat dst = new Mat();

// int value1 = 3, value2 = 1; 磨皮程度与细节程度的确定
int value1 = 3, value2 = 1;
int dx = value1 * 5; // 双边滤波参数之一
double fc = value1 * 12.5; // 双边滤波参数之一
double p = 0.1f; // 透明度
Mat temp1 = new Mat(), temp2 = new Mat(), temp3 = new Mat(), temp4 = new Mat();

// 双边滤波
Imgproc.bilateralFilter(image, temp1, dx, fc, fc);

// temp2 = (temp1 - image + 128);
Mat temp22 = new Mat();
Core.subtract(temp1, image, temp22);
// Core.subtract(temp22, new Scalar(128), temp2);
Core.add(temp22, new Scalar(128, 128, 128, 128), temp2);
// 高斯模糊
Imgproc.GaussianBlur(temp2, temp3, new Size(2 * value2 - 1, 2 * value2 - 1), 0, 0);

// temp4 = image + 2 * temp3 - 255;
Mat temp44 = new Mat();
temp3.convertTo(temp44, temp3.type(), 2, -255);
// dst = (image*(100 - p) + temp4*p) / 100;
Core.addWeighted(image, p, temp4, 1 - p, 0.0, dst);

Core.add(dst, new Scalar(10, 10, 10), dst);
return dst;

}


 Mat src2 = Imgcodecs.imread("E:/work/qqq/e.jpg");
Mat src3 = face2(src2);

Mat dest = new Mat(new Size(src2.cols()+src3.cols(), src2.rows()), src2.type());
Mat temp1 = dest.colRange(0, src2.cols());
Mat temp2 = dest.colRange(src2.cols(), dest.cols());
src2.copyTo(temp1);
src3.copyTo(temp2);
Imgcodecs.imwrite("E:/work/qqq/z3.jpg",dest);	

http://www.cnblogs.com/Imageshop/p/4709710.html

http://www.cnblogs.com/Imageshop/p/3871237.html