You are on page 1of 13

SIGNAL PROCESSING

CORRELATION

Franck Dufrenois MISC


Correlation

Definition

+∞
Γ𝑥𝑦 𝜏 = 𝑥 ∘ 𝑦 𝜏 = න 𝑥 𝑢 𝑦 ∗ 𝑢 + 𝜏 𝑑𝑢
−∞
+∞
=න 𝑥 𝑢 𝑦 ∗ 𝑢 − 𝜏 𝑑𝑢 = 𝑥(𝜏) ∘ 𝑦(𝜏)
−∞

+∞

t=u- +∞

+∞



Γ𝑥𝑦 𝜏 = න 𝑥 𝑢 𝑦 𝑢 − 𝜏 𝑑𝑢 = න 𝑥 𝑡 + 𝜏 𝑦 𝑡 𝑑𝑡 = න 𝑦 𝑡 𝑥 𝑡 + 𝜏 𝑑𝑡 = Γ𝑦𝑥 −𝜏
−∞ −∞ −∞
Correlation

1 x(u) 1 x(u)
Graphical meaning
𝑦 𝑢 + 0.75 𝑦 𝑢 + 0.5
+∞
𝑥∘𝑦 𝜏 =න 𝑥 𝑢 𝑦 ∗ 𝑢 + 𝜏 𝑑𝑢 -0.75 -0.5 +0.5 -0.5 0 +0.5
−∞ +∞ +∞
න 𝑥 𝑢 𝑦 𝑢 + 0.75 𝑑𝑢 න 𝑥 𝑢 𝑦 𝑢 + 0.5 𝑑𝑢
x(u) −∞ −∞
1

-0.5 +0.5 1 x(u) 1 x(u)


𝑦 𝑢+0 𝑦 𝑢 − 0.25
y(u)
+0.5 -0.5 0 +0.5 -0.5 0 +0.5
-u+0.5) +∞ +∞
න 𝑥 𝑢 𝑦 𝑢 + 0 𝑑𝑢 න 𝑥 𝑢 𝑦 𝑢 − 0.25 𝑑𝑢
−∞ −∞
-0.5 +0.5
Correlation

Link with the convolution

Correlation
? Convolution
+∞
𝑥 𝜏 ∗𝑦 𝜏 =න 𝑥 𝑢 𝑦 ∗ 𝜏 − 𝑢 𝑑𝑢
−∞

𝑥 𝜏 ∘𝑦 𝜏 = 𝑥 𝜏 ∗ 𝑦 ∗ −𝜏

correlation = convolution when the filter is even


Correlation
Properties
• Bounded : one show that the correlation verifie:

• Parity : Consider that x(t) is a complex


signal, then:

It has then an upper bound at =0 which equals the


From the hermitian symmetry, we have: signal energy

Proof:
From the Schwartz inequality, we have:

Thus, it comes: Then we can write

is even
When x(t)=y(t)
Is odd
Correlation

Discret version
Let use define two real sampled signals x and y of size N and M ( M<<N), respectively. Thus the
discret correlation is defined by:
𝑀
𝐸[ 2 ]
1
𝑥∘ℎ 𝑛 = ෍ 𝑥 𝑘+𝑛 𝑦 𝑘 , 𝑛 = [0, … , 𝑁]
𝑀
𝑀
𝑘=−𝐸[ ]
2

𝒏=𝟐
Example:

𝒙 x(-2+n) x(-1+n) x(n) x(1+n) x(2+n) 𝑁=5

𝒚 𝒚(−1) 𝑦(0) 𝒚(𝟏) 𝑀=3


𝑥 𝑛 − 1 𝑦 −1 +𝑥 𝑛 𝑦 0 +𝑥 𝑛 + 1 𝑦 +1

𝒌
Correlation

2D analogue version
Consider two real signals x and y . The analogue correlation is defined by:

+∞ +∞
Γ𝑥𝑦 𝜏, 𝜂 = 𝑥 ∘ 𝑦 𝜏, 𝜂 = න න 𝑥 𝑢, 𝑣 𝑦 ∗ 𝑢 + 𝜏, 𝑣 + 𝜂 𝑑𝑢 𝑑𝑣
−∞ −∞

Discret version
Let us define two 2D signal x and y composed of N*N and M*M coefficients, respectively (M<<N). Then
the discret 2D correlation is defined by:

𝑀 𝑀
𝐸[ 2 ] 𝐸[ 2 ]
1
𝑥 ∘ 𝑦 𝒏, 𝒎 = 2 ෍ ෍ 𝑥 𝒏 + 𝑘, 𝒎 + 𝑙 𝑦 𝑘, 𝑙 , (𝑛, 𝑚) = [0, … , 𝑁]
𝑀
𝑀 𝑀
𝑘=−𝐸[ 2 ] 𝑙=−𝐸[ 2 ] Matlab : z=xcorr2(x,y)
Correlation

Illustration on images

convolution correlation

h y

x x (𝒙 ∘ 𝒚)(𝒏, 𝒎)
Correlation

Echo removing

• principle :

• Correlation is a similarity measure between two signals.

• Correlation is a mathematical way to detect echo in a signal.


At what time its appears and its magnitude.

• Filter it

• Example: « we are the champions »


Correlation

Small audio sample: « we are the champions »

Sample without echo Sample with echo


Correlation

By zooming in, we can observe that echo appears at the 8820-th sample and its amplitude is
0.4 times the initial signal.

Let us define x(t) the signal without echo and


xe(t) the signal withecho, ∆𝑡 the time delay
correspind to the localization of the echo and K
the magnitude of the l’echo. The signal without
echo is determined by :

𝑥 𝑡 = 𝑥𝑒 𝑡 − 𝐾𝑥𝑒 𝑡 − ∆𝑡

with K=0.4 and ∆𝑡=8820


Correlation

By using this equation on the signal, we can remove the echo on the signal

before after
Correlation

Image object detection

o =

Identification of the tree’s peaks

You might also like