0% found this document useful (0 votes)
63 views

Difference Between Correlation and Convolution

Correlation is measurement of the similarity between two signals/sequences. Convolution is measurement of effect of one signal on the other signal. The mathematical calculation of Correlation is same as convolution in time domain, except that the signal is not reversed, before the multiplication process

Uploaded by

bsnt.a7md23
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Difference Between Correlation and Convolution

Correlation is measurement of the similarity between two signals/sequences. Convolution is measurement of effect of one signal on the other signal. The mathematical calculation of Correlation is same as convolution in time domain, except that the signal is not reversed, before the multiplication process

Uploaded by

bsnt.a7md23
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Difference Between Correlation and

Convolution
By /

November 2023
Correlation
is a mathematical technique to see how close two things are related. In image processing terms, it is used
to compute the response of a mask on an image. A mask is applied on a matrix from left to right. Mask
slides over the matrix from left to right by one unit every time. Once the mask reaches the rightmost end,
the mask is slid downward by one unit and again starts from left to right side. The computed output is
assigned to the central pixel, while neighbourhood pixels are also get used in the computation. The mask
or the matrix can be 1-D or 2-D. Generally, the mask’s dimension is taken as an odd number, so that the
central pixel can easily be found.

Image, I = [100, 120, 100, 150, 160]

Indexes of the image are 0, 1, 2, 3 and 4.

Mask, H = [1/3, 1/3, 1/3]Indexes of the mask are -1, 0 and 1.

Apply correlation between image and mask at index=2 in the image.

J(2) = I(1) . H(-1) + I(2) . H(0) + I(3) . H(1)Indexes are represented in the parentheses.

J(2) = 120 x 1/3 + 100 x 1/3 + 150 x 1/3 J(2) = 370/3 In general,

J = I . H Correlation is denoted by (.)

The size of the resultant image depends on padding. If padding is allowed, size of resultant image = size
of the original image (input) If padding is not allowed, size of resultant image < size of the input image. A
convolution is also a mathematical tool that is used to combine two things in order to produce the result.
In image processing, convolution is a process by which we transform an input image by applying a kernel
over it in a pixel-wise fashion. When the convolution mask operates on a particular pixel, then it performs
the action by considering that pixel and its neighbouring pixels and the result is returned to that one
particular pixel. Thus, we conclude that convolution in image processing is the mask operato

To find the output result, we start to follow our steps. We put the kernel on the image and after
multiplying each weight in the kernel by the corresponding pixels, we sum the products. Slide the kernel
and repeat the same steps.
Some Linear Filters: Averaging Filter (Blur Filter): There are several methods to blur an image and one of
them is averaging filter. To apply this filter we use correlation.

Convolution
Convolution is a mathematical operation used to combine two functions or signals to produce a third
function or signal. It is a widely used operation in the field of signal processing, signal filtering, image
analysis, computer vision. It is also used to extract information from an image. Convolution of two
signals or functions can be performed by using MATLAB. MATLAB provides a built-in function 'conv'
to perform convolution. The 'conv' function accepts two input vectors as arguments and gives their linear
convolution as the result.

1. Flip the mask and do correlation.


2. The 1D mask is flipped horizontally, as there is a single row
3. The 2D mask is flipped vertically and horizontally.
4. Mask is slid over the image matrix from the left to the right direction.
5. When the mask hovers on the image, corresponding elements of mask and image are
multiplied and the products are added.
6. This process repeats for all the pixels of the image. There are two types of operators in image
processing. Point operator: While operating on a particular pixel, it takes only one pixel as
input that is itself. For example Brightness increasing operation. We increase each pixel’s
intensity by the same value to increase the brightness of the image. Mask operator: While
performing an action on a particular pixel it takes the particular pixel and its neighbouring
pixels as the input. Convolution operation.

Image, I = [100, 120, 100, 150, 160]

Indexes of the image are 0, 1, 2, 3 and 4. Mask used for correlation,

H = [1/3, 1/3, 1/3] Indexes of the mask are -1, 0 and 1.

We are using same mask not the flipped one, hence we shall use the indexes properly. Apply convolution
between image and mask at index=1 in the image.
J(2) = I(0) . H(1) + I(1) . H(0) + I(2) .

H(-1)Indexes are represented in the parentheses.

J = I * H Convolution is denoted by (*).

Size of resultant image follows same as in case of correlation.

Convolution and correlation give the same response if the mask is symmetric. Both correlation and
convolution look similar in nature. But we use convolution extensively in image processing because of its
following properties.

Apply correlation filtering

But the code part is a bit different than the correlation filtering. Because there is nothing in opencv to
make the convolution filtering directly. To make convolution filtering, there are 2 different way: Flip the
kernel in both dimensions in the code and then call filter2D function . Use scipy library instead of opencv
to make convolution filtering.

Parameter Convolution Correlation


Definition Convolution is a mathematical operation used Correlation is a mathematical
to combine two signals or function to produce operation used to measure or
a third signal or function. quantify the similarities and
relationship between two
signals.
Purpose of The primary purpose of convolution is to The primary purpose of
operation perform tasks, such as signal transformation convolution is to perform
and modification. tasks, such as signal
transformation and
modification.
Output The output of convolution of two functions or The output of correlation is a
signals is a new function or signal which is a value that represents the
combination of input functions or signals. degree of similarity between
two functions or signals.
Range of In the case of convolution, the range of value The range of value of output
output value of output depends on the input signals or of correlation is between -1
functions. and 1. If the output of
correlation is -1, it indicates a
perfect negative correlation,
if it 1, the correlation is
perfect positive correlation,
and if it is 0, there is no
correlation between
functions.
Size of The size of convolution output is equal to the The size of the correlation
output sum of sizes of inputs minus 1. output is double of the sizes
of inputs minus 1.
Symmetry Convolution preserves the symmetry. Correlation does not preserve
preservation symmetry.
Suitable for Convolution cannot be used to match template Correlation can be used for
template of the signals due to its symmetry preservation template matching.
matching property.
Mathematical Convolution involves the integration of the Correlation simply involves
operation product of the input functions with one the integration of the product
involved function shifted. of the input
functions.Correlation simply
involves the integration of
the product of the input
functions.
Applications Convolution is widely used in the field of Correlation is mainly used
digital image processing, computer vision, for similarity measurement
data science, signal transformation, and more. between two signals, signal
comparison, template
matching, pattern and
relationship recognition, data
analysis, etc.

You might also like