The corresponding document of the guide filter grinding is as follows: Guided Image filtering, this algorithm is extremely fast, faster than other edge-preserving grinding algorithm, or even several times faster. This algorithm is originally from the He Mingkai image to fog algorithm, now has been applied encapsulation and MATLAB image processing function library, the visible algorithm is classic.
Look at the pseudo code for the following algorithm:
Here the algorithm has a lot of use of the mean convolution, so you can use the Fast Integration diagram method for simple acceleration. This algorithm is also an edge-preserving filtering algorithm, but its usefulness is far more than for filtering, there are other very useful functions, such as can be used to ascend the sample, this feeling is very good. In some of the algorithm, if the large image directly to pull the map, very slow, such as the GRUB cut segmentation algorithm Now, this time we can sample the image, and then in the small map to pull, and finally to sample, so the speed is very fast, this is now some large image processing commonly used a thought, So the use of this algorithm is conceivable. Finally, I posted my code to learn, this code has not been sorted and optimized, just using a quick integration diagram to accelerate:
[c++] View Plain copy Float* cguidedfiler::guidedfiler (float*inimg,float*guidedimg,int height,int widht,int radius,float eps) int lenght=height*widht; float*mult=new float[lenght]; float*oned=new float[lenght]; for (int i=0;i<lenght;i++) { mult[i]=inimg[i]* guidedimg[i]; oned[i]=1; } float *covmult=new float[lenght]; float *covone=new float[lenght]; Fastgetavg (Covmult,mult, Widht,height,radius); fastgetavg (Covone,oned,widht,height,radius); for (int i= 0;i<lenght;i++) { covmult[i]/=covone[i]; } delete []mult; delete []oned; //Calculation guide, original image window mean float *mean_inimg=new float[lenght]; Fastgetavg (Mean_inimg,inimg,widht,height,radius); float*mean_guideimg=new float[lenght]; Fastgetavg (MEAN_GUIDEIMG,GUIDEDIMG,WIDHT, Height,radius); for (int i=0;i<lenght;i++) { mean_guideimg[i]/=covone[i]; mean_inimg[i]/=covone[i]; } /Calculate the divisor of AK float *var_guideimg=new float[lenght]; float *sqr_guideimg=new float[lenght]; for (int i=0;i<lenght;i++) { sqr_guideimg[i]=guidedimg[i]*guidedimg[i]; } Fastgetavg (Var_guideimg,sqr_guideimg,widht,height,radius); delete []sqr_guideimg; for (int i=0;i<lenght;i++) { var_guideimg[i]=var_ Guideimg[i]/covone[i]-mean_guideimg[i]*mean_guideimg[i]; } //Calculation ak float*a=new float[lenght]; for (int i=0;i<lenght;i++) { a[i]= (Covmult[i]-mean_guideimg[i]*mean_inimg[i])/(var_guideimg[i]+eps); } //Calculate BK float*b=new float[lenght]; for (int i=0;i<lenght;i++) { b[i]=mean_inimg[i]-a[i]*mean_guideimg[i]; } Delete []covmult; delete []mean_guideimg; delete []mean_inimg; delete []var_guideimg; float*mean_a=new float[lenght]; float*mean_b=new float[lenght]; fastgetavg (Mean_a,a,widht,height,radius); FastGetAVG (MEAN_B,B,WIDHT, Height,radius); for (int i=0;i<lenght;i++) { mean_a[i]/=covone[i]; mean_b[i]/=covone[i]; } Delete []a; delete []b; //output image float *outimg=new float[lenght]; for (int i=0;i<lenght;i++) { outimg[i]= mean_a[i]*guidedimg[i]+mean_b[i]; } delete []mean_a; Delete []mean_ b; return outimg;
The results are then used to grind the skin and to measure the effect:
Original
Beautiful Mito Intelligent Grinding skin
Guide Filter Grinding Skin
In general, the beauty of the surface is not as good as the edge of the details, it can be inferred that the beauty of the skin is not used to detect other skin color detection technology, and I am a combination of skin detection technology in the inside, so in the hair details will be maintained better. The skin of the beauty map is also: natural grinding, rapid grinding, ordinary grinding, in addition to ordinary grinding, intelligent grinding, other algorithms combined with the whitening technology in the inside, and the whitening technology seems to have no skin color combined with skin detection technology, as if the whole map for white color processing, the feeling of the beauty of the whitening effect is very poor, Because I think the whitening should be only skin whitening, not the whole image for whitening, this is my personal point of view, if offended, please contact me. This article address: http://blog.csdn.net/hjimce/article/details/45421299 Author: hjimce Contact qq:1393852684 More resources please pay attention to my blog: http://blog.csdn. NET/HJIMCE original articles, All rights reserved, reprint please keep these two lines of author information