Filter Art---the implementation of the new Hai Cheng filter effect decryption

Source: Internet
Author: User

Recently, the new Haitian filter Special effect is very fire, Camera360 for this also specially developed the corresponding app, every day p chart and so is scrambling, today, I come to everyone to decrypt.

First of all to see the implementation of my program:


Original


Let me explain in detail how the program implements this filter effect:

1, Sky Detection and segmentation

The most important of this filter is the division and replacement of the sky area, about the Sky division, I give a reference:

Sky detection by effective context inference. neurocomputing.2016

This article is based on training learning to achieve the sky segmentation, the approximate process is as follows:

2, Sky MASK

after 1 to get the precise division of the sky, we need to binary the area, black is non-sky area, White is the sky area, and then a proper radius of this binary map Gaussian filter, so that the sky and non-sky boundary between the enough excessive, that is the feathering in PS. Here is an example:

3, Sky Fusion

using Mask in 2, theoriginal image and Sky map are fused, this step is fused with Normal mode in PS, white area shows Sky map, black area shows original The sky image used here is as shown here:

(c) Sky Image

As follows:

4, color grading

Color Grading This step is key, you need what style of comic, you need to focus on what kind of style of colour tones. I am here to refer to the following style (click to open the link):

5, Halo

After the color grading, we need to add a certain halo to the image, this step, we directly use the Halo template, with the original color of the layer to be mixed, you can.

I use the Halo template as follows:

The result diagram for the 4-5 Two step is as follows:

For a calculation of the blending of the filter layers, the code is as follows:

        int modefiltercolor (int basepixel, int mixpixel)        {            int res = 0;            res = 255-(255-mixpixel) * (255-basepixel)/255;            return Math.min (255, Math.max (0, res));        }

6, saturation and brightness adjustment

Finally, the image is a simple adjustment of saturation and brightness, to bring out a bright and fresh feeling, the adjustment steps are as follows:

As follows:

(g) New Hai Cheng filter

If you need to strengthen the sense of the boundary, you can before 1, the image to illuminate the edge of the operation, to illuminate the edge graph a, and then speak a and the original to overlay processing, The effect will be a little better.

The code for the overlay process is as follows:

int modeoverlay (int basepixel,int mixpixel) {    int res = 0;    res = ((basepixel <= 128)? (Mixpixel * basepixel/128):(255-(255-mixpixel) * (255-basepixel)/+));    Return Checkrange (res);}

Finally, the logical code of the call is attached:

private void Specialfiltertoolstripmenuitem_click (object sender, EventArgs e) {if (pictureBox1.Image! = NULL) {//Get Sky image divided by 1 sky Bitmap Sky = new Bitmap (Application.startuppath + "\\s                Ky.png ");                Gets the sky mask image obtained by 2 Bitmap mask = new Bitmap (Application.startuppath + "\\mask_6.jpg");                Sky Fusion Curbitmap = Specialfilter (Srcbitmap, Sky, mask);                Tinting and halo Bitmap map = new Bitmap (Application.startuppath + "\\map.png");                Bitmap light = new Bitmap (Application.startuppath + "\\light.png");               Curbitmap = Mapfilter (Curbitmap, light, map);                Brightness and saturation adjustment Bitmap Anmap = new Bitmap (Application.startuppath + "\\anmap.png");                Curbitmap = Anmapfilter (Curbitmap, Anmap);            pictureBox1.Image = Curbitmap; }        }

The above is the new Hai Cheng Filter Program implementation plan, as for the detailed code, here design company Confidential, inconvenient to reveal, the principle has been written clearly, we can try! If in doubt, can exchange: QQ1358009172



Filter Art---the implementation of the new Hai Cheng filter effect decryption

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.