Image processing (vii)-oriented filter grinding-skin __ Image Processing

Source: Internet
Author: User

Guide Filter Grinding Skin

Original address: http://blog.csdn.net/hjimce/article/details/45421299

Author: hjimce

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:

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 map, the original image of the 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 float of AK *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];}// Calculate 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.

Author: hjimce Contact qq:1393852684 original article, reprint please keep this author, original address information *****************

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.