# How to Create Image Editing Filters

I am trying to make filters for days but now I just want to know the experience of others rather than go on to wrong way and finally decided to put my query over here with full detail rather then short question of every day . What is the best way of making image filters like Instagram or aviary or many other photo editing application , Can we make it using OpenCV or we need to make them by using operation on bitmaps like simple color operations of giving weights to them . How they made the filters ?

What are logic behind it

How we can perform the same operation ? and

whats the best way of making them ?

I read Quora - How Does Instagram Develop Their Filters? but it didn't give the best way to operate with the tool for android . I don't even know that this question is right for this forum or not , but I just want to consult the algorithms , the best way to do it for android and simple the way from which I need to start ? I saw simple OpenCV - How to Implement Sepia Filter operation but its not easy to find that type of values for other filters like which we want to make like other colored shades in which only little effect can change the whole look of the image and the last thing is it the helpful if we make filters in Photoshop and then follow the steps in our program

Thanks

• I you are looking for library with some filters already implemented then please check out the CxImage. It has lot of filters that can be used very easily. When it comes to implementing new, "unknown" filters, then it becomes a problem of understanding how they work. – jojek Jun 13 '14 at 7:07
• I use to use the filters provided by Instagram only, over the app thus never tried to create filters over there. – David Ricks Oct 12 '18 at 4:47
• Updated link to CxImage. – Royi Oct 27 '19 at 14:09

The word "Filter" in Image Processing word relates to "Neighborhood" based operation on pixels.

Filters in the context of Instagram and other Image Processing applications are combination of point operations (Works on single pixel, adjusting it values independent of its adjacent pixels) and filters which alters the pixel value according to its adjacent pixels.

If I were you I'd start with learning about Point Operations such as Brightness, Contrast, Hue, Saturation, etc... Once you build some functions which alters those move on to filters.

Then you could combine them into "Effect".

For instance, Vignetting is easy to do:

1. Create a rounded mask. White out side a circle and black around it.
2. Smooth the mask using a Gaussian Blur.
3. Adjust the brightness of pixel according to the values of this mask.
• Well i learned about Brightness , Contrast , Hue , Saturation etc , but what do you mean by Point Operation ? its just like image.at<cv::Vec3b>(row,col)[0] = newval[0]; //R image.at<cv::Vec3b>(row,col)[1] = newval[1]; //G image.at<cv::Vec3b>(row,col)[2] = newval[2]; //B  – ARG May 13 '14 at 9:20
• Again, point operations affects each pixel independently of its adjacent pixels. For instance, Brightness just adds a number to a pixel -> Point Operation. – Royi May 13 '14 at 9:22
• but brightness apply to the whole the image , it changes the whole view of the image not the specific part. You can check out my explained query with image here stackoverflow.com/questions/23526268/… – ARG May 13 '14 at 9:34
• Read again what I wrote. Point operations works on all image (Unless a mask was defined). They just do it in Pixel Independent manner. When you adjust brightness, the output value depends on the input value only. Not on the values of adjacent pixels. – Royi May 13 '14 at 9:36

I think that you two ways for this:

1- Read image processing books and implement algorithm by yourself

2- Find a library for this purpose such as EmguCV, AfogeNET or OpenCV. Emgu and Aforge are based on OpenCV and Emgu is availabe for android. You can find a lot of filters from simple ones to complicated ones. also they have a good documentation and support.

It is better to start from way 2. Because they works correctly at highest performance. Also there is no need to learn about complicated algorithms.