Finding out the values of a Gaussian Kernel in Image Processing

Nishat Anjum Lea
2 min readNov 27, 2020

--

Suppose , we are given a size of a kernel like 5x5 and and the value of σ = 1 . We have to find out all the values for this kernel .

We know the equation of Gaussian function is :

For a filter (kernel is also known as filter) size x by y, the number of rows are x and the number of columns are y. Generally, The filter size consists of odd numbers . In this case ,the values for rows are -{(x-1)/2} to +{(x-1)/2} and the values of columns are -{(y-1)/2} to +{(y-1)/2} . So, for filter size 5x5 , the row values are -2 to +2 and column values are -2 to +2. So, if we want to calculate the 1st value of the kernel , we have to put the row value and column value of the kernel for that position in the Gaussian Function. Here , it is (-2,-2) . So, x=-2 , y=-2 . By putting the value of x, y in the equation we can find the value h(x,y) = 0.0029 which is approximately 0.003 . Following the same procedure , we can find the values of other positions . The entire table is shown below:

5x5 Gaussian kernel

Now , we can see that all the values are very small . If we normalize all the values by dividing all the values by 0.003 , we will get the following table :

5x5 Gaussian Kernel after Normalization

Note: σ is the parameter of the function . The Filter values will be changed if we change the value of σ

--

--

Nishat Anjum Lea

Software Engineer | Tech Enthusiast | Blockchain developer