Filters are the key thing in Computer Vision(Processing image data). You would have probably used different kinds of filters like the blur filter, vintage filters, etc in photo editing apps. Ever thought about how those filters work? . How do they give the desired effect?

We all know images are represented as matrix of Red, Green and Blue combination in mathematics and computer vision. And image filters are the same small matrix applied to an entire image. As mentioned above, the popular blur filter is represented as the image below.

This is the 3×3 matrix when applied to an entire image will actually blur the image. So what does this “**applied**” means?.

Filters actually help us to transform this image. For example see the image below. It is a gray-scale image in which 0 represents “Gray”, 1 represents “Black” and -1 represents “White”.

Now, let's apply 3×3 filter as shown below.

Now, to actually apply the filter we put the filter at the top left(as shown below) and slide it along

After that, we multiply the pixel value of the gray scale image by the filter values as shown below. We also represent filter values as filter weights.

We get some result, and then we sum the result as shown below. Having some final output value(Here it is 2).

Now notice how resolution is getting decreased as we are taking 9 input values and giving out 1 output values.

Eventually we are going to repeat the same process across the entire image by striding through the image one pixel by one pixel. We can control the stride distance, by default we have the stride distance =1.

When we take stride =2

If we talk about filters in the context of convolutional neural networks these filters are referred to convolutional kernels and the process of passing them over an image is known as convolution.

One important thing to remember in this process

During the process of convolution it may actually happen that we lose the borders of the image as shown below.

As we see we don't have the value their we pad the image by the most common choice 0 like shown below.

This is called padding which allows us to preserve the image size.

So you see how the concept of filter is important in the field of computer vision. Now in the architecture CNN’s it allows the neural network to come up with the best weights of a filter automatically. You don't have worry about filter weights CNN will do it for you, but it is better to know what is happening under the hood.

Comment down what you think ?

© 2020 Data Science Central ® Powered by

Badges | Report an Issue | Privacy Policy | Terms of Service

**New Books and Resources for DSC Members** - [See Full List]

**Most Popular Content on DSC**

To not miss this type of content in the future, subscribe to our newsletter.

- Book: Statistics -- New Foundations, Toolbox, and Machine Learning Recipes
- Book: Classification and Regression In a Weekend - With Python
- Book: Applied Stochastic Processes
- Long-range Correlations in Time Series: Modeling, Testing, Case Study
- How to Automatically Determine the Number of Clusters in your Data
- New Machine Learning Cheat Sheet | Old one
- Confidence Intervals Without Pain - With Resampling
- Advanced Machine Learning with Basic Excel
- New Perspectives on Statistical Distributions and Deep Learning
- Fascinating New Results in the Theory of Randomness
- Fast Combinatorial Feature Selection

**Other popular resources**

- Comprehensive Repository of Data Science and ML Resources
- Statistical Concepts Explained in Simple English
- Machine Learning Concepts Explained in One Picture
- 100 Data Science Interview Questions and Answers
- Cheat Sheets | Curated Articles | Search | Jobs | Courses
- Post a Blog | Forum Questions | Books | Salaries | News

**Archives:** 2008-2014 |
2015-2016 |
2017-2019 |
Book 1 |
Book 2 |
More

**Most popular articles**

- Free Book and Resources for DSC Members
- New Perspectives on Statistical Distributions and Deep Learning
- Time series, Growth Modeling and Data Science Wizardy
- Statistical Concepts Explained in Simple English
- Machine Learning Concepts Explained in One Picture
- Comprehensive Repository of Data Science and ML Resources
- Advanced Machine Learning with Basic Excel
- Difference between ML, Data Science, AI, Deep Learning, and Statistics
- Selected Business Analytics, Data Science and ML articles
- How to Automatically Determine the Number of Clusters in your Data
- Fascinating New Results in the Theory of Randomness
- Hire a Data Scientist | Search DSC | Find a Job
- Post a Blog | Forum Questions

## You need to be a member of Data Science Central to add comments!

Join Data Science Central