SlideShare a Scribd company logo
3
Most read
4
Most read
8
Most read
Kernels in Convolution
By
Revanth Kumar
November 22, 2020
November 22, 2020 1 / 10
Overview
Introduction
Types of kernels
Definition
Convolution filters
Gaussian Kernel
Calculating Gaussian Convolution Kernels
November 22, 2020 2 / 10
Introduction
Convolutions are mathematical operations between two functions
that create a third function. In image processing, it happens by
going through each pixel to perform a calculation with the pixel and
its neighbours.
In Convolutional neural network, the kernel is nothing but a filter
that is used to extract the features from the images.
A convolution lets you do many things, like calculate derivatives,
detect edges, apply blurs, etc. A very wide variety of things. And all
of this is done with a ”convolution kernel”.
The kernels will define the size of the convolution, the weights
applied to it, and an anchor point usually positioned at the center.
November 22, 2020 3 / 10
Types of kernels
Gaussian
K(u) =
1
√
2π
e− 1
2
u2
Logistic
K(u) =
1
eu + 2 + e−u
Sigmoid function
K(u) =
2
π
1
eu + e−u
November 22, 2020 4 / 10
Definition
A kernel is a non-negative real-valued integrable function K. For
most applications, it is desirable to define the function to satisfy two
additional requirements:
1. Normalization: ∞
−∞
K(u)du = 1
2. Symmetry: K(−u) = K(u) for all values of u .
November 22, 2020 5 / 10
Convolution filters
An image can be seen as a matrix I, where I(x, y) is the brightness
of the pixel located at coordinates (x, y).
A convolution product is computed between the matrix I and a
kernel matrix K which represents the type of filter.
K can be of size 3 × 3 or 5 × 5. The result of this product will be
the new brightness of the pixel (x, y).
I∗K =




I(1, 1) I(1, 2) ... I(1, n)
. . .
. . .
I(m, 1) I(m, 2) ... I(m, n)



∗


K(1, 1) K(1, 2) K(1.3)
K(2, 1) K(2, 2) K(2, 3)
K(3, 1) K(3, 2) K(3, 3)


Where
I ∗ Kx ,y =
1
i=−1
1
j=−1
I(x + i, y + j) ∗ K(i, j)
November 22, 2020 6 / 10
Gaussian Kernel
In image processing filters are mainly used to suppress either the
high frequencies in the image, i.e. smoothing the image, or the low
frequencies, i.e. enhancing or detecting edges in the image.
An image can be filtered either in the frequency or in the spatial
domain.
The corresponding process in the spatial domain is to convolve the
input image f(i,j) with the filter function h(i,j). This can be written
as:
g(i, j) = h(i, j) f (i, j)
The discrete convolution can be defined as a ‘shift and multiply’
operation, where we shift the kernel over the image and multiply its
value with the corresponding pixel values of the image. For a square
kernel with size M× M, we can calculate the output image with the
following formula:
November 22, 2020 7 / 10
Calculating Gaussian Convolution Kernels
The Gaussian filter uses the Gaussian function in the kernel of the
filter:
G(x, y) =
1
2πσ2
e− x2
+ y2
2σ2
This filter is a weighted filter which gives more importance to the
central pixels. The parameter σ controls the weight given to the
center.
where,
G(x,y) =The variables referenced as x and y relate to pixel
coordinates within an image.
e = represents the value of Euler’s number has been defined as a
mathematical constant equating to 2.718.
σ = represents a threshold or factor value, as specified by the user.
November 22, 2020 8 / 10
Continue...
When calculating the kernel elements, the coordinate values
expressed by x and y should reflect the distance in pixels from the
middle pixel.
In order to gain a better grasp on the Gaussian kernel formula we
can implement the formula in steps.
If we were to create a 3×3 kernel and specified a weighting value of
5.5 our calculations can start off as indicated by the following
illustration:



1
2π(5.5)2 e− 12
+12
2(5.5)2
1
2π(5.5)2 e− 02
+12
2(5.5)2
1
2π(5.5)2 e− 12
+12
2(5.5)2
1
2π(5.5)2 e− 12
+02
2(5.5)2
1
2π(5.5)2 e− 02
+02
2(5.5)2
1
2π(5.5)2 e− 12
+02
2(5.5)2
1
2π(5.5)2 e− 12
+12
2(5.5)2
1
2π(5.5)2 e− 02
+12
2(5.5)2
1
2π(5.5)2 e− 12
+12
2(5.5)2



November 22, 2020 9 / 10
Continue...
The calculated values of each kernel element:


0.00509 0.00517 0.0521
0.00517 0.00526 0.00517
0.00509 0.00517 0.00509


An important requirement to take note of at this point being that
the sum total of all the elements contained as part of a
kernel/matrix must equate to one.
At this point the sum total of the kernel equates to .046322.
The kernel values should be updated by multiplying each element by
one divided by the current kernel sum.
k =


0.1098 0.1117 0.1098
0.1117 0.1135 0.1117
0.1098 0.1117 0.1098


Now, successfully calculated a 3×3 Gaussian Blur kernel matrix
which implements a weight value of 5.5.
November 22, 2020 10 / 10

More Related Content

PPTX
Application of edge detection
PPTX
Line Detection using Hough transform .pptx
PDF
Operations in Digital Image Processing + Convolution by Example
PPTX
Chapter 3 image enhancement (spatial domain)
PPTX
Edge detection
PPT
Image trnsformations
PDF
Lecture 15 DCT, Walsh and Hadamard Transform
PPTX
Edge Detection using Hough Transform
Application of edge detection
Line Detection using Hough transform .pptx
Operations in Digital Image Processing + Convolution by Example
Chapter 3 image enhancement (spatial domain)
Edge detection
Image trnsformations
Lecture 15 DCT, Walsh and Hadamard Transform
Edge Detection using Hough Transform

What's hot (20)

PPT
Frequency Domain Image Enhancement Techniques
PPTX
Edge detection
PPT
Hill climbing
PPTX
AI Agents, Agents in Artificial Intelligence
PPTX
Bit plane coding
PPTX
Convolutional Neural Networks
PPTX
PPSX
Image Processing: Spatial filters
PPTX
Diabetic Retinopathy.pptx
PPTX
Fuzzy Clustering(C-means, K-means)
PPTX
Image Representation & Descriptors
PPTX
Convolutional Neural Network and Its Applications
PPTX
Image classification with Deep Neural Networks
PPTX
Chain code in dip
PDF
Feature detection and matching
PPT
Graph algorithm
PPTX
Problem solving agents
PPT
Fields of digital image processing slides
Frequency Domain Image Enhancement Techniques
Edge detection
Hill climbing
AI Agents, Agents in Artificial Intelligence
Bit plane coding
Convolutional Neural Networks
Image Processing: Spatial filters
Diabetic Retinopathy.pptx
Fuzzy Clustering(C-means, K-means)
Image Representation & Descriptors
Convolutional Neural Network and Its Applications
Image classification with Deep Neural Networks
Chain code in dip
Feature detection and matching
Graph algorithm
Problem solving agents
Fields of digital image processing slides
Ad

Similar to Kernels in convolution (20)

PDF
Math behind the kernels
PDF
Fuzzy c means_realestate_application
PDF
Neighbour Local Variability for Multi-Focus Images Fusion
PDF
Neighbour Local Variability for Multi-Focus Images Fusion
PDF
Neighbour Local Variability for Multi-Focus Images Fusion
PDF
11.optimal nonlocal means algorithm for denoising ultrasound image
PDF
Optimal nonlocal means algorithm for denoising ultrasound image
PPTX
03 image transformations_i
PDF
Qcce quality constrained co saliency estimation for common object detection
PPTX
chAPTER1CV.pptx is abouter computer vision in artificial intelligence
PPTX
computervision1.pptx its about computer vision
PDF
GRUPO 2 : convolution separable
PDF
Efficient Technique for Image Stenography Based on coordinates of pixels
PPTX
Notes on image processing
PDF
K-means Clustering Algorithm with Matlab Source code
PPT
Image segmentation
PDF
GREY LEVEL CO-OCCURRENCE MATRICES: GENERALISATION AND SOME NEW FEATURES
PDF
Fuzzy Entropy Based Optimal Thresholding Technique for Image Enhancement
PDF
Cj31365368
PPT
Image Texture Analysis
Math behind the kernels
Fuzzy c means_realestate_application
Neighbour Local Variability for Multi-Focus Images Fusion
Neighbour Local Variability for Multi-Focus Images Fusion
Neighbour Local Variability for Multi-Focus Images Fusion
11.optimal nonlocal means algorithm for denoising ultrasound image
Optimal nonlocal means algorithm for denoising ultrasound image
03 image transformations_i
Qcce quality constrained co saliency estimation for common object detection
chAPTER1CV.pptx is abouter computer vision in artificial intelligence
computervision1.pptx its about computer vision
GRUPO 2 : convolution separable
Efficient Technique for Image Stenography Based on coordinates of pixels
Notes on image processing
K-means Clustering Algorithm with Matlab Source code
Image segmentation
GREY LEVEL CO-OCCURRENCE MATRICES: GENERALISATION AND SOME NEW FEATURES
Fuzzy Entropy Based Optimal Thresholding Technique for Image Enhancement
Cj31365368
Image Texture Analysis
Ad

More from Revanth Kumar (7)

PDF
APPLIED MACHINE LEARNING
PPTX
Deep learning algorithms
PDF
Back propagation using sigmoid & ReLU function
PPTX
Linear regression, costs & gradient descent
PPTX
Deep neural networks & computational graphs
PPTX
Self driving car
PPTX
Tomography System
APPLIED MACHINE LEARNING
Deep learning algorithms
Back propagation using sigmoid & ReLU function
Linear regression, costs & gradient descent
Deep neural networks & computational graphs
Self driving car
Tomography System

Recently uploaded (20)

PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
PPT on Performance Review to get promotions
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
DOCX
573137875-Attendance-Management-System-original
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
composite construction of structures.pdf
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Geodesy 1.pptx...............................................
PPTX
web development for engineering and engineering
PPT
introduction to datamining and warehousing
PPTX
Lecture Notes Electrical Wiring System Components
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Safety Seminar civil to be ensured for safe working.
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Internet of Things (IOT) - A guide to understanding
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT on Performance Review to get promotions
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
573137875-Attendance-Management-System-original
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
composite construction of structures.pdf
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
Operating System & Kernel Study Guide-1 - converted.pdf
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Geodesy 1.pptx...............................................
web development for engineering and engineering
introduction to datamining and warehousing
Lecture Notes Electrical Wiring System Components

Kernels in convolution

  • 1. Kernels in Convolution By Revanth Kumar November 22, 2020 November 22, 2020 1 / 10
  • 2. Overview Introduction Types of kernels Definition Convolution filters Gaussian Kernel Calculating Gaussian Convolution Kernels November 22, 2020 2 / 10
  • 3. Introduction Convolutions are mathematical operations between two functions that create a third function. In image processing, it happens by going through each pixel to perform a calculation with the pixel and its neighbours. In Convolutional neural network, the kernel is nothing but a filter that is used to extract the features from the images. A convolution lets you do many things, like calculate derivatives, detect edges, apply blurs, etc. A very wide variety of things. And all of this is done with a ”convolution kernel”. The kernels will define the size of the convolution, the weights applied to it, and an anchor point usually positioned at the center. November 22, 2020 3 / 10
  • 4. Types of kernels Gaussian K(u) = 1 √ 2π e− 1 2 u2 Logistic K(u) = 1 eu + 2 + e−u Sigmoid function K(u) = 2 π 1 eu + e−u November 22, 2020 4 / 10
  • 5. Definition A kernel is a non-negative real-valued integrable function K. For most applications, it is desirable to define the function to satisfy two additional requirements: 1. Normalization: ∞ −∞ K(u)du = 1 2. Symmetry: K(−u) = K(u) for all values of u . November 22, 2020 5 / 10
  • 6. Convolution filters An image can be seen as a matrix I, where I(x, y) is the brightness of the pixel located at coordinates (x, y). A convolution product is computed between the matrix I and a kernel matrix K which represents the type of filter. K can be of size 3 × 3 or 5 × 5. The result of this product will be the new brightness of the pixel (x, y). I∗K =     I(1, 1) I(1, 2) ... I(1, n) . . . . . . I(m, 1) I(m, 2) ... I(m, n)    ∗   K(1, 1) K(1, 2) K(1.3) K(2, 1) K(2, 2) K(2, 3) K(3, 1) K(3, 2) K(3, 3)   Where I ∗ Kx ,y = 1 i=−1 1 j=−1 I(x + i, y + j) ∗ K(i, j) November 22, 2020 6 / 10
  • 7. Gaussian Kernel In image processing filters are mainly used to suppress either the high frequencies in the image, i.e. smoothing the image, or the low frequencies, i.e. enhancing or detecting edges in the image. An image can be filtered either in the frequency or in the spatial domain. The corresponding process in the spatial domain is to convolve the input image f(i,j) with the filter function h(i,j). This can be written as: g(i, j) = h(i, j) f (i, j) The discrete convolution can be defined as a ‘shift and multiply’ operation, where we shift the kernel over the image and multiply its value with the corresponding pixel values of the image. For a square kernel with size M× M, we can calculate the output image with the following formula: November 22, 2020 7 / 10
  • 8. Calculating Gaussian Convolution Kernels The Gaussian filter uses the Gaussian function in the kernel of the filter: G(x, y) = 1 2πσ2 e− x2 + y2 2σ2 This filter is a weighted filter which gives more importance to the central pixels. The parameter σ controls the weight given to the center. where, G(x,y) =The variables referenced as x and y relate to pixel coordinates within an image. e = represents the value of Euler’s number has been defined as a mathematical constant equating to 2.718. σ = represents a threshold or factor value, as specified by the user. November 22, 2020 8 / 10
  • 9. Continue... When calculating the kernel elements, the coordinate values expressed by x and y should reflect the distance in pixels from the middle pixel. In order to gain a better grasp on the Gaussian kernel formula we can implement the formula in steps. If we were to create a 3×3 kernel and specified a weighting value of 5.5 our calculations can start off as indicated by the following illustration:    1 2π(5.5)2 e− 12 +12 2(5.5)2 1 2π(5.5)2 e− 02 +12 2(5.5)2 1 2π(5.5)2 e− 12 +12 2(5.5)2 1 2π(5.5)2 e− 12 +02 2(5.5)2 1 2π(5.5)2 e− 02 +02 2(5.5)2 1 2π(5.5)2 e− 12 +02 2(5.5)2 1 2π(5.5)2 e− 12 +12 2(5.5)2 1 2π(5.5)2 e− 02 +12 2(5.5)2 1 2π(5.5)2 e− 12 +12 2(5.5)2    November 22, 2020 9 / 10
  • 10. Continue... The calculated values of each kernel element:   0.00509 0.00517 0.0521 0.00517 0.00526 0.00517 0.00509 0.00517 0.00509   An important requirement to take note of at this point being that the sum total of all the elements contained as part of a kernel/matrix must equate to one. At this point the sum total of the kernel equates to .046322. The kernel values should be updated by multiplying each element by one divided by the current kernel sum. k =   0.1098 0.1117 0.1098 0.1117 0.1135 0.1117 0.1098 0.1117 0.1098   Now, successfully calculated a 3×3 Gaussian Blur kernel matrix which implements a weight value of 5.5. November 22, 2020 10 / 10