Image filter Art--methodology

Source: Internet
Author: User
Tags image filter

recently, I know the filter development method to do a summary, share to everyone, knowledge is mostly from the network, I do a summary here.

The so-called filter, originally refers to the camera lens installed in front of the filter natural light additional lens, used to achieve color and add effect. Our filter algorithm, also called the Software filter, is the simulation of most lens filters, of course, the error will inevitably, our purpose is just infinite approximation. For this reason, we cannot reproduce the actual shooting scene, unable to recover the information not contained in the photo, and thus difficult to achieve some special filter effects, such as polarizer and ultraviolet filter (UV) effects and so on.

The current implementation of a software filter effect, we can boil down to the following parts:

1, basic transformation

This is the first step of the filter effect, we can design a variety of image effects according to preferences, here all the image effects can be uniformly used in the following formula to express:

F (r,g,b,a) =f (r,g,b,a);

This formula consists of four transformations, the transformation of RGB three components in the RGB color space, and the transformation of the transparency alhpa, where we shorthand for a transformation.

To give an example of a grayscale transformation, it corresponds to the F--f transformation as follows:

F (r) = b * 0.114 + G * 0.587 + R * 0.299;

F (g) = b * 0.114 + G * 0.587 + R * 0.299;

F (b) = b * 0.114 + G * 0.587 + R * 0.299;

F (a) = A;

This grayscale is also a basic transformation. With this basic transformation, the image has achieved a certain effect, but some of the complex filters, not simple basic transformations, but some complex effects overlay, so there are several steps.

2, Vignette material template overlay

Open the Instagram app, we will find a lot of effects have some vignette, mainly for the image four corner of the dark, middle normal or partial light, this is actually superimposed a certain material reason, here we introduce the classic Halo material in Instagram template, as shown in:

How do we overlay a material like this? Here will use a number of superimposed algorithms, the most commonly used in Photoshop is the hybrid layer algorithm, these hybrid algorithms I have started in the blog has been introduced, you can study carefully, this step is mainly using these hybrid layer algorithm to the material template and our first basic transformation to get the mix, All kinds of halo effects are obtained. Of course, these hybrid algorithms are not unique, and you can try to design your own favorite blend layer algorithm yourself.

here is a link to the Photoshop Hybrid layer algorithm http://blog.csdn.net/trent1985/article/details/40891661

3, Style template overlay

The style overlay here and 2 of the material overlay algorithm is similar, here is said to be mainly a step problem, for example, in order to achieve the effect of old photos, we first step through the Color basic transformation, can reach the old photos of the yellowing effect, but not realistic, because the old photos often have some image noise, as well as crack cracks, These effects if your algorithm cannot be implemented, then you can make these through PS into a template, in this step superimposed on the image above, thus achieving a more realistic effect.

4, Picture frame template Overlay

With 1-3 steps, a filter effect has been basically completed, but sometimes you will want more beautiful, then you can use PS to make some beautiful picture frame template, superimposed on the filter effect above, is not more beautiful?

The above 4 steps is a filter development steps, of course, these steps are not necessarily a filter must, can be one of the steps, or multiple steps, but, ultimately, any software filter implementation, should not escape these steps. As long as we have mastered these steps, after many attempts, we will always develop the filter effect you like.

5, for the first step, introduce a quick implementation method:

For any filter, if there is a basic transformation of this step, then we can build a mapping table by color mapping, and then through the table to quickly implement the transformation effect, which can greatly improve the speed of the filter, improve the user experience.

The basic principle of color mapping look-up method: In a table for each color record a corresponding mapping target color, when using the table method for a photo to do color mapping, only need to traverse each pixel of the photo, and then found in the table of the pixel color corresponding to the target color, and finally set the pixel to the target color. The premise of the tabular method is that the color map is independent of the surrounding color, that is, a color regardless of the surrounding color, regardless of where it is located in the photo, its target color should be the same.

For example, RGB can represent a number of colors 256*256*256 = 16,777,216 , if you want to record the mapping results for each color, then the color table needs Bastovin records, which obviously can not be applied to the actual project. For the sake of simplicity,Lev Zelensky published a benchmark color table, storing each of the similar 4 colors in one record, so that the color table requires only a 64 * 64 * 64 = 262,144 record. This table is as follows:

Note: The above table divides 262,144 colors into 8 blocks, each with a 64 * 64 different color. For color mapping, first use the Digital image processing software to apply the filter that you want to simulate to the base color table to generate a mapping table (such as), and then for each pixel of the photo to be processed, locate the pixel color from the base color table, and then get the destination color at the corresponding location in the map table.

using this method, your filter speed can be greatly improved.

The above 5 steps is my combination of network resources and personal summary of the part, like filter development friends can try.

Finally, a universal filter hack method is introduced:

For a filter, we build a template, this template size custom, you can see the filter effect, such as Instagram, it specifies the image size is 530*530, then we build a 530*530 size blank template image, if we want to crack Hudson effect, then, After our analysis, this effect includes not only the basic transformation, but also vignette, and even the location-related gradient template, this is the difficulty of cracking, how to crack, we can use the following steps:

1, constructs 256 530*530 size template, fills 0-255 kinds of colors respectively, namely the gray color;

2, each template for Hudson effect processing, get the corresponding mapping template library, this library also recorded all the Hudson effect settings, including basic transformations, vignetting, gradients, etc.

3, for any one 530*530 size of the original image, we just find the corresponding color from the template library in 2, corresponding to the location of the pixel value, then this value is Hudson effect;

People think carefully about this is not the truth, there will be lost, this is a good thing, this method can be cracked any filter, but the sacrifice of the actual filter efficiency, think about it, is not it?

Well, today's introduction to this end, we have any questions can contact me:

my email [email protected] , qq:1358009172

Image filter Art--methodology

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.