forked from giordano/wiener-filter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwiener.tex
373 lines (334 loc) · 11.6 KB
/
wiener.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
\documentclass[10pt]{beamer}
\usetheme{Madrid}
\setbeamercovered{dynamic}
\setbeamertemplate{navigation symbols}{}
\usepackage[T1]{fontenc}
\usefonttheme{professionalfonts}
\usepackage[sfmath,slantedGreeks]{kpfonts}
\usepackage[utf8]{inputenc}
\usepackage[hyperref,backend=biber,maxbibnames=4,firstinits=true]{biblatex}
\usepackage{graphicx,tikz,listings,bm,braket}
\usepackage[font=scriptsize,labelformat=empty]{caption}
\addbibresource{bibliography.bib}
\newcommand{\arxiv}[1]{{\usebeamercolor[fg]{bibliography entry note}
\href{http://arxiv.org/abs/#1}{arXiv: \texttt{#1}}}}
\newcommand{\doi}[1]{{\usebeamercolor[fg]{bibliography entry note}
\href{http://dx.doi.org/#1}{\textsc{doi}: \texttt{#1}}}}
\title{Introduction to Wiener Filtering}
\author{Mosè Giordano}
\date{26 November 2014}
\institute[UniSalento and INFN Lecce]{Università del Salento and INFN Lecce}
\titlegraphic{\includegraphics[width=20mm]{figures/logo-unisalento}}
% Customise the caption: do not insert the caption name, nor the number, just
% insert a smaller caption text.
\setbeamertemplate{caption}{\scriptsize\insertcaption}
%% Personalizzo modello prima pagina
\setbeamercolor*{institute}{parent=palette primary}
\defbeamertemplate*{title page}{customized}[1][]
{
\vbox{}
\vfill
\centering
% Nome Università
\mbox{\begin{beamercolorbox}[rounded=true,shadow=true,ht=2.5ex,
wd=0.7\paperwidth,sep=3pt,center]{institute}%
\large\scshape\insertinstitute\par%
\end{beamercolorbox}}
% Logo
\vskip0.5em
{\usebeamercolor[fg]{titlegraphic}
\includegraphics[width=20mm]{figures/logo-unisalento}\quad
\includegraphics[width=50mm]{figures/dipartimento}\quad
\includegraphics[width=20mm]{figures/infn}\par}
\vskip0.25em%
% Titolo
\begin{beamercolorbox}[sep=8pt,center,#1]{title}
\usebeamerfont{title}\inserttitle\par%
% % Decommenta se c'è un sottotitolo
% \ifx\insertsubtitle\@empty%
% \else%
% \vskip0.25em%
% {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
% \fi%
\end{beamercolorbox}%
\vskip1em\par
\begin{center}
\emph{Mosè Giordano} \\[4ex]
\insertdate
\end{center}
\vfill
}
\makeatletter
\defbeamertemplate*{footline}{customized}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=.3\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
\usebeamerfont{author in head/foot}\insertshortauthor\expandafter\beamer@ifempty\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.4\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
\usebeamerfont{title in head/foot}\insertshorttitle
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.3\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
\usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
\insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
\end{beamercolorbox}}%
\vskip0pt%
}
\makeatother
%%% Beamer colors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Some tango colors
% butter (yellowish)
\definecolor{tabutter}{rgb}{0.98824, 0.91373, 0.30980} % #fce94f
% orange
\definecolor{taorange}{rgb}{0.98824, 0.68627, 0.24314} % #fcaf3e
\definecolor{ta2orange}{rgb}{0.96078, 0.47451, 0} % #f57900
% Custom colors
\definecolor{mm3orange}{rgb}{0.90784, 0.36078, 0}
\definecolor{mmskyblue}{rgb}{0.34706, 0.56078, 0.81176}
\definecolor{mm2skyblue}{rgb}{0.10392, 0.39608, 0.64314}
\definecolor{mm3skyblue}{rgb}{0.02549, 0.29020, 0.52941}
\definecolor{mmLightSteelBlue}{rgb}{.5, .77, .87}
\setbeamercolor{normal text}{fg=black,bg=white}
\setbeamercolor{alerted text}{fg=mm3orange}
\setbeamercolor*{example text}{fg=lightgray,bg=black}
\setbeamercolor{structure}{fg=mm2skyblue}
% \setbeamercolor{title in head/foot}{fg=white, bg=mmskyblue}
% \setbeamercolor{author in head/foot}{fg=white, bg=mm3skyblue}
\setbeamertemplate{itemize items}[circle]
\setbeamercolor{headline}{fg=tabutter,bg=mm3skyblue}
\setbeamercolor{footline}{fg=tabutter, bg=mm3skyblue}
\setbeamercolor{separation line}{bg=ta2orange}
\setbeamercolor{framesubtitle}{fg=white, bg=ta2gray}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\lstdefinelanguage{gdl}{
morekeywords={abs,cos,findgen,fft,mean,randomu,read_jpeg,sin,systime},
sensitive=false,
morecomment=[l]{;},
morestring=[b]",
}
\lstset{
language=gdl,
basicstyle=\scriptsize\ttfamily,
keywordstyle=\color{blue}\bfseries,
commentstyle=\color{red},
stringstyle=\color{purple}\itshape,
% columns=flexible,
showstringspaces=false,
frame=single,
breaklines=true, % spezza le righe lunghe...
breakindent=10pt, % ...impostando l'indentazione delle continuazioni a 10pt
% aggiungo manualmente la "conversione" in comandi LaTeX per tutti i simboli
% "strani" presenti nei sorgenti che includo usando il pacchetto `listings'
literate=
{à}{{\`a}}1
{è}{{\`e}}1
{È}{{\`e}}1
{é}{{\'e}}1
{ì}{{\`i}}1
{ò}{{\`o}}1
{ù}{{\`u}}1
{·}{{\textperiodcentered}}1
{×}{{\texttimes}}1
{²}{{\ap{2}}}1
{º}{{\textdegree}}1
}
\begin{document}
\begin{frame}[plain]
\maketitle
\end{frame}
\begin{frame}
\frametitle{The purpose of Wiener filtering}
Reduce degradation and noise in images, audio signals, etc.
\begin{figure}
\centering
\(\vcenter{\hbox{\includegraphics[width=0.2\textwidth]{moon.jpg}}}\) ~
\tikz{\draw[-latex,mm2skyblue,thick] (0,0) -- node[above] {Degradation}
(1.7,0);} ~
\(\vcenter{\hbox{\includegraphics[width=0.2\textwidth]{figures/degraded_moon.jpg}}}\)
~
\tikz{\draw[-latex,mm2skyblue,thick] (0,0) -- node[above] {Filtering}
(1.7,0);} ~
\(\vcenter{\hbox{\includegraphics[width=0.2\textwidth]{figures/filtered_moon.jpg}}}\)
\caption{Picture of the Moon taken by the Galileo spacecraft on 7 December 1992}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{The theory}
Suppose you have a \alert{signal} \(S(\bm{t})\) in the time domain (whatever
``time'' is: actual time, point in space, pixel of an image, etc), degraded by
\alert{known blurring shift-invariant function} \(B(\bm{t})\) and
\alert{additive noise} \(N(\bm{t})\)
\begin{equation*}
X(\bm{t}) = (B * S)(\bm{t}) + N(\bm{t})
\end{equation*}
The Fourier transform in the frequency domain of this \alert{degraded signal}
\(X(\bm{t})\) is
\begin{equation*}
\hat{X}(\bm{f}) = \mathcal{F}(X)(\bm{f}) = \hat{B}(\bm{f})\hat{S}(\bm{f}) +
\hat{N}(\bm{f})
\end{equation*}
\end{frame}
\begin{frame}
\frametitle{The theory (cont.)}
We want to find an appropriate filter \(W(\bm{f})\) such that the function
\(W(\bm{f})\hat{X}(\bm{f})\) is as much close as possible to the Fourier
transform of the original signal \(\hat{S}(\bm{f}) = \mathcal{F}(S)(\bm{f})\),
i.e. we want to minimize the quantity
\begin{equation*}
\Braket{W(\bm{f})\hat{X}(\bm{f}) - \hat{S}(\bm{f})} =
\Braket{W(\bm{f})(\hat{B}(\bm{f})\hat{S}(\bm{f}) + \hat{N}(\bm{f})) -
\hat{S}(\bm{f})}
\end{equation*}
This condition is fulfilled by
\begin{equation*}
W(\bm{f}) = \frac{\hat{B}^{*}(\bm{f})}{|\hat{B}(\bm{f})|^{2} +
|\hat{N}(\bm{f})|^{2}/|\hat{S}(\bm{f})|^{2}}
\end{equation*}
This is the \alert{Wiener filter} function and
\(\mathcal{F}^{-1}(W\hat{X})(\bm{t})\) is the \alert{filtered signal}. This
function gives more importance to frequencies with \alert{higher signal to
noise ratio}. In absence of blurring
\begin{equation*}
W(\bm{f}) = \frac{|\hat{S}(\bm{f})|^{2}}{|\hat{S}(\bm{f})|^{2} +
|\hat{N}(\bm{f})|^{2}}
\end{equation*}
\end{frame}
\begin{frame}
\frametitle{The theory (cont.)}
Theoretically, in order to calculate the Wiener filter function we need to
know
\begin{itemize}
\item the original signal
\item the blurring function
\item the noise
\end{itemize}
or at least their power spectra. Actually, power spectra need not to be known
exactly (\alert{noise power spectrum can often be easily estimated},
e.g. white noise has constant spectrum) because
\begin{itemize}
\item most signals of the same class have fairly \alert{similar power spectra}
\item the Wiener filter is \alert{insensitive to small variations} in the
original signal power spectrum
\end{itemize}
We can estimate the original signal power spectrum using a
\alert{representative of the class of signals being filtered}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to a temporal signal}
IDL/GDL code:
\lstinputlisting[linerange={25-47}]{filtro_wiener.pro}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to a temporal signal (cont.)}
\begin{figure}
\centering
\includegraphics[width=0.85\textwidth]{figures/signal}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to a temporal signal (cont.)}
\begin{figure}
\centering
\includegraphics[width=0.85\textwidth]{figures/signal-noise}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to a temporal signal (cont.)}
\begin{figure}
\centering
\includegraphics[width=0.85\textwidth]{figures/signal-spectra}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to a temporal signal (cont.)}
\begin{figure}
\centering
\includegraphics[width=0.85\textwidth]{figures/filter}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to a temporal signal (cont.)}
\begin{figure}
\centering
\includegraphics[width=0.85\textwidth]{figures/result}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to an image}
IDL/GDL code:
\lstinputlisting[linerange={64-88}]{filtro_wiener.pro}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to an image (cont.)}
\begin{figure}
\centering
\vspace{-0.5em}
\includegraphics[width=0.6\textwidth]{lena}
\caption{The original image, file \texttt{lena.jpg}}
\vspace{-1em}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to an image (cont.)}
\begin{figure}
\centering
\vspace{-0.5em}
\includegraphics[width=0.6\textwidth]{figures/degraded_lena}
\caption{The image has been degraded with a large noise}
\vspace{-1em}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to an image (cont.)}
\begin{figure}
\centering
\vspace{-0.5em}
\includegraphics[width=0.6\textwidth]{elaine}
\caption{The picture used to filter the degraded image, file
\texttt{elaine.jpg}}
\vspace{-1em}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to an image (cont.)}
We can use a different picture to filter the degraded image because they have
similar power spectra
\begin{figure}
\centering
\includegraphics[width=\textwidth]{figures/power-spectra}
\caption{Left: power spectrum of \texttt{lena.jpg} file; right: power
spectrum of \texttt{elaine.jpg} file}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to an image (cont.)}
\begin{figure}
\centering
\vspace{-0.5em}
\includegraphics[width=0.8\textwidth]{figures/img-filter}
\caption{The Wiener filter function in the frequency domain}
\vspace{-1em}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Wiener filter applied to an image (cont.)}
\begin{figure}
\centering
\vspace{-0.5em}
\includegraphics[width=0.6\textwidth]{figures/filtered_lena}
\caption{The filtered image}
\vspace{-1em}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{\refname{} and further reading}
\nocite{*}
\printbibliography{}
\end{frame}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% ispell-local-dictionary: "american"
%%% End: