Some attempts on the acne and freckle Removal Algorithm for portrait beauty.

Source: Internet
Author: User

The acne freckle algorithm has been paying attention to and is always looking forward to seeing any great gods sharing information on this aspect. On Baidu, all the things found with the keyword acne and freckle are irrelevant to the principle. It seems that you have to struggle on your own.

In general, we still have a certain degree of understanding about acne and freckle removal. My analysis should be based on image repair content, so I consulted some people who specialized in academic research, especially those who specialized in image repair, and they also provided me with some testing code, the most simple and effective code is as follows (provided by Xixi ):

function inpainting()    f=imread(‘12.png‘);    f=rgb2gray(f);    f=double(f);    [m,n]=size(f);    lamda=0.1;    phi=double(1-(f==255));%    u=f;    Iter =400;    for k=1:Iter        C1 = circshift(u,[0 -1]); C1(:,n) = C1(:,n-1);        C2 = circshift(u,[0 1]);  C2(:,1) = C2(:,2);        C3 = circshift(u,[-1 0]); C3(m,:) = C3(m-1,:);        C4 = circshift(u,[1 0]);  C4(1,:) = C4(2,:);        lap_u=C1+C2+C3+C4;        u=(phi.*f+lamda*lap_u)./(phi+4*lamda);endfigure; imagesc(u); colormap(gray); axis off; axis equal;

The principle of this code is for reference: The article. I did not see the specifics. It should be the simplest implementation based on the TV model.

The above code is very simple. the Lamda controls the degree of blurring and is tested with this Code. The grayscale image effect is as follows:

Source image after mask repair

It can be seen that this simple code has some repair functions, but the repair part is vague. Another problem is that the efficiency of this code is very low. Although it is not particularly difficult to implement it by changing to C language, however, even the speed of C is also problematic. However, for the features of manual freckle removal, programming does not require full graph processing. For example, it is also possible to process acne and freckle twice the area.

I also asked this question in a group. Some netizens suggested that the inpaint algorithm of opencv is feasible. So I tried to use the opencv function to test the problem. The experiment results are as follows:

Source image

Mask

Repair result Diagram

If we look at it at the beginning, it seems that the repair results are still acceptable. This code is in the inpaint of opencv. CPP, one of which comes from an image inpainting technique based on the Fast Marching Method. I spent about two days converting it into pure C ++ code, but the result verification is a bit disappointing, because this method is actually similar to that of TV, there will be obvious fuzzy results in the fix (the algorithm in opencv also has a convolution process, so it is inevitable to blur it ). While observing the repair of meitu and other software, the texture of the repaired part is well preserved.

However, this does not mean that these algorithms are also useless. freckle and acne are generally used together with skin whitening. If some of the spots after skin polishing are still not eliminated, the above freckle removal method can be perfectly integrated with the surrounding images, because the surrounding skin will also be smooth, for example:

Effect of manual freckle removal after skin Polishing

In fact, it is rare to find spots automatically. Many manufacturers already have mature algorithms, but our insights are short.

At this point, the main functions of my portrait beauty algorithm have been basically completed (although not perfect ), among them, face slimming and eye scaling have examples in the beautification menu of my imageshop software. Skin shining is just a partial adjustment of some colors, which is not difficult, skin polishing, skin whitening, and freckle removal I concentrated on the following file packages. If you are interested, you can check them. Welcome to discuss them.

Http://files.cnblogs.com/Imageshop/FaceBeautification.rar

 

* *************************** Basically, I do not provide source code, however, I will try to use text to clearly describe the corresponding algorithm or provide the reference documentation ************************

* ************************************ Because it depends on your own the effort and the effect written in practice are exactly what they are, people must rely on their own *******************

* ************************** Laviewpbt time: 2014.7.27 contact QQ: 33184777 reprinted. Please keep the information of this bank **********************

 

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.