What is Convolution?!

Anagha zachariah
2 min readJul 6, 2021

--

An image can be seen as a matrix A,where an entry A[i,j] represents brightness of the pixel located in coordinates [i,j].

Image(L) and its corresponding pixel matrix(R)

In image processing, convolution is a linear operation which calculate dot product of given input and a set of weights .The given array of weights is called filter or kernel.The filter is kept over a filter sized input data and element-wise multiplication is done between the input and filter, which is then summed.The filter is slid across the width and height of the input and performs the operation.The number of pixels by which we slide the filter is known as the stride.

The output from multiplying the filter with the input array one time is a single value. As the filter is applied multiple times to the input array, the result is a two-dimensional array of output values . As such, the two-dimensional output array from this operation is called a “feature map“. The feature map demonstrates the original image’s unique features. This capability is commonly referred to as translation invariance. For example,below is a 3*3 filters for detecting vertical lines and horizontal lines.

Vertical line detector(L) Horizontal line detector(R)

The following filter can be used to blur the images

The dimensions of a filter should be same as input and the size of filter should not be greater than size of input.The stride is usually kept as 1, but we can increase it. When increased, we might have to increase the size of the image by a few pixels to fit in the kernel at the edges of the image.This increase is called padding.

--

--