transform ácie obrazu
DESCRIPTION
Transform ácie obrazu. Gonzales, Woods: Digital Image Processing k apitola : Image transforms. Fourierova transformácia. Jean Baptiste Joseph Fourier (1768-1830) Akákoľvek funkcia f(x) môže byť vyjadrená ako vážený súčet sínusov a kosínusov. Suma s í nusov a kos ínusov. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/1.jpg)
Transformácie obrazu
Gonzales, Woods: Digital Image Processingkapitola: Image transforms
![Page 2: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/2.jpg)
Fourierova transformácia
Jean Baptiste Joseph Fourier (1768-1830)
Akákoľvek funkcia f(x) môže byť vyjadrená ako vážený súčet sínusov a kosínusov
![Page 3: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/3.jpg)
Suma sínusov a kosínusov
A sin(ωx+φ)
![Page 4: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/4.jpg)
Time and Frequency
example : g(t) = sin(2πf t) + (1/3)sin(2π(3f) t)
![Page 5: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/5.jpg)
Time and Frequency
example : g(t) = sin(2πf t) + (1/3)sin(2π(3f) t)
= +
![Page 6: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/6.jpg)
Frequency Spectra
example : g(t) = sin(2πf t) + (1/3)sin(2π(3f) t)
= +
![Page 7: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/7.jpg)
Frequency Spectra
![Page 8: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/8.jpg)
= +
=
Frequency Spectra
![Page 9: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/9.jpg)
= +
=
Frequency Spectra
![Page 10: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/10.jpg)
= +
=
Frequency Spectra
![Page 11: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/11.jpg)
= +
=
Frequency Spectra
![Page 12: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/12.jpg)
= +
=
Frequency Spectra
![Page 13: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/13.jpg)
= 1
1sin(2 )
k
A ktk
Frequency Spectra
![Page 14: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/14.jpg)
Frequency Spectra
![Page 15: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/15.jpg)
FT: Just a change of basis
.
.
.
* =
M * f(x) = F(w)
![Page 16: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/16.jpg)
IFT: Just a change of basis
.
.
.
* =
M-1 * F(w) = f(x)
![Page 17: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/17.jpg)
![Page 18: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/18.jpg)
Fourierova transformáciaAk f(x) je spojitá funkcia s reálnou premenou x,potom Fourierovou transformáciou F(x) je
Inverznou Fourierovou transformáciou nazývame
pár Fourierovej transformácie
![Page 19: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/19.jpg)
Fourier Transform
uxAsin(
f(x) F(u)Fourier Transform
F(u) f(x)Inverse Fourier Transform
Pre každé u od 0 po inf, F(u) obsahuje amplitudu A and fázu f odpovedajúceho sinusu
22 )()( uIuRA )(
)(tan 1
uR
uI
![Page 20: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/20.jpg)
Definitions F(u) sú komplexne čísla:
Magnitúda FT (spektrum):
Fázový uhol FT:
Reprezentácia pomocou magnitúdy a fázy:
Power of f(x): P(u)=|F(u)|2=
![Page 21: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/21.jpg)
FT – je periodická s periódou N, to znamená, že na jej určenie stačí jedna perióda vo frekvenčnej oblasti.
![Page 22: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/22.jpg)
2D Fourierova transformácia
Fourierova transformáci je ľahko rozšíriteľná do 2D
![Page 23: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/23.jpg)
![Page 24: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/24.jpg)
Príklad 2D funkcie
![Page 25: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/25.jpg)
![Page 26: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/26.jpg)
![Page 27: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/27.jpg)
![Page 28: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/28.jpg)
![Page 29: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/29.jpg)
![Page 30: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/30.jpg)
![Page 31: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/31.jpg)
![Page 32: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/32.jpg)
![Page 33: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/33.jpg)
Sinusoidové vzory sa zobrazia vo frekvenčnom spektre ako body.
![Page 34: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/34.jpg)
Nízke frekvencie sú pri strede a vysoké na okrajoch
![Page 35: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/35.jpg)
![Page 36: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/36.jpg)
![Page 37: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/37.jpg)
Sampling Theorem
Continuous signal:
Shah function (Impulse train):
xf
x
Sampled function:
n
s nxxxfxsxfxf 0
xs
x0x
n
nxxxs 0
![Page 38: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/38.jpg)
Sampling
![Page 39: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/39.jpg)
Sampling and the Nyquist rate
Pri vzorkovaní spojitej funkcie môže vzniknúť aliasing ak vzorkovacia frekvencia nie je dostatočne vysoká
Vzorkovacia frekvencia musí byť taká vysoká aby zachytila aj tie najvyššie frekvencie obrazu
![Page 40: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/40.jpg)
Predísť aliasingu: Vzorkovacia frekvencia > 2 * max
frekvencia v obraze Treba viac ako 2 vzorky na periódu Minimálna vzorkovacia frekvencia
sa nazýva Nyquist rate
Sampling and the Nyquist rate
![Page 41: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/41.jpg)
Diskrétna Fourierova transformácia
![Page 42: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/42.jpg)
Rozšírenie DFT do 2D
Predpokladajme že f(x,y) je M x N.
DFT
Inverzná DFT:
![Page 43: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/43.jpg)
Filtre
![Page 44: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/44.jpg)
Vizualizácia DFT Väčšinou zobrazujeme |F(u,v)| Dynamický rozsah |F(u,v)| je obvykle
veľmi vysoký
Aplikujeme logaritmus:
(c je konštanta)
before scaling after scalingoriginal image
![Page 45: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/45.jpg)
DFT Properties: (1) Separability
The 2D DFT can be computed using 1D transforms only:
Forward DFT:
Inverse DFT:
2 ( ) 2 ( ) 2 ( )ux vy ux vy
j j jN N Ne e e
kernel isseparable:
![Page 46: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/46.jpg)
DFT Properties: (1) Separability
Rewrite F(u,v) as follows:
Let’s set:
Then:
![Page 47: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/47.jpg)
How can we compute F(x,v)?
How can we compute F(u,v)?
DFT Properties: (1) Separability
)
N x DFT of rows of f(x,y)
DFT of cols of F(x,v)
![Page 48: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/48.jpg)
DFT Properties: (1) Separability
![Page 49: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/49.jpg)
DFT Properties: (2) Periodicity
The DFT and its inverse are periodic with period N
![Page 50: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/50.jpg)
DFT Properties: (3) Symmetry
• If f(x,y) is real, then
![Page 51: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/51.jpg)
DFT Properties: (4) Translation
f(x,y) F(u,v)
) N
• Translation is spatial domain:
• Translation is frequency domain:
![Page 52: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/52.jpg)
DFT Properties: (4) Translation
![Page 53: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/53.jpg)
DFT Properties: (4) Translation
Warning: to show a full period, we need to translate the origin of the transform at u=N/2 (or at (N/2,N/2) in 2D)
|F(u-N/2)|
|F(u)|
![Page 54: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/54.jpg)
DFT Properties: (4) Translation
To move F(u,v) at (N/2, N/2), take
Using ) N
![Page 55: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/55.jpg)
DFT Properties: (4) Translation
no translation after translation
![Page 56: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/56.jpg)
DFT Properties: (5) Rotation
Otočením f(x,y) o uhol θ, sa otočí F(u,v) o ten istý uhol θ
![Page 57: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/57.jpg)
DFT Properties: (6) Addition/Multiplication
but …
![Page 58: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/58.jpg)
DFT Properties: (7) Scale
![Page 59: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/59.jpg)
DFT Properties: (8) Average value
So:
Average:
F(u,v) at u=0, v=0:
![Page 60: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/60.jpg)
Magnitude and Phase of DFT
What is more important?
Hint: use inverse DFT to reconstruct the image using magnitude or phase only information
magnitude phase
![Page 61: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/61.jpg)
Magnitude and Phase of DFT
Reconstructed image using magnitude only(i.e., magnitude determines the contribution of each component!)
Reconstructed image using phase only(i.e., phase determineswhich components are present!)
![Page 62: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/62.jpg)
Magnitude and Phase of DFT
![Page 63: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/63.jpg)
Výpočtová náročnosť DFT
{f0, f1, ... , fN-1} – vstupná body{F0, F1, ... , FN-1} – výsledok Fourierovej transformácie
Výpočet pomocou 2 cyklov – > zložitosť O(N2)
Snaha zredukovať na O(Nlog2N) – > FFT
discrete Fourier transform — DFT
![Page 64: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/64.jpg)
Fast Fourier Transform - FFT
Pre N=8
Rozdelíme na párne a nepárne členy
Urobíme to isté vo zátvorkách
![Page 65: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/65.jpg)
Suma vo vnútorných zátvorkách je rovnaká pre n=0, 2, 4, 6 a pre n=1, 3, 5, 7
Takže máme 4 (zátvorky) x 2 súčtov na najnižšej úrovniKeďže n=1, 3, 5, 7 zodpovedá polovici periódy П a platídostaneme 1 pre n=0, 2, 4, 6 a
- 1 pre n=1, 3, 5, 7
![Page 66: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/66.jpg)
V hranatých zátvorkách je perióda exponentu n=4 – > n=0, 4; n=1, 5; n=2, 6 a n=3, 7.
Pre n=0, 4 factor je 1 pre n=2, 6 je to -1; pre n=1, 5 je -i a pre n=3, 7 je i.
Takže máme 2 (zátvorky) x 4 súčtov na strednej úrovni
![Page 67: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/67.jpg)
Na najvyššej úrovni máme 1 sumu a periódu exponentu n=8– > 1 x 8 súčtovPolovicu z nich môžeme vypočítať iba zmenou znamienkaNa každej úrovni urobíme 8 operácií (n)Máme 3 = log 8 úrovne (log n)
O( n log n )
![Page 68: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/68.jpg)
FFT - algoritmus
Prepare input data for summation — put them into convenient order;For every summation level:
For every exponent factor of the half-period: Calculate factor;For every sum of this factor:
Calculate product of the factor and the second term of the sum;Calculate sum;
{f0, f1, f2, f3, f4, f5, f6, f7}→{f0, f4, f2, f6, f1, f5, f3, f7}.
![Page 69: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/69.jpg)
Poradie koeficientov pre FFT
0 000 000 000 0
1 001 010 100 4
2 010 100 010 2
3 011 110 110 6
4 100 001 001 1
5 101 011 101 5
6 110 101 011 3
7 111 111 111 7
![Page 70: Transform ácie obrazu](https://reader037.vdocuments.mx/reader037/viewer/2022103007/56814865550346895db573e7/html5/thumbnails/70.jpg)
Príklad pre N=16