Filtros en el dominio espacial
Lecci´on 05.1
Dr. Pablo Alvarado Moya
CE5201 Procesamiento y An´
alisis de Im´
agenes Digitales
´
Area de Ingenier´ıa en Computadores
Tecnol´
ogico de Costa Rica
Contenido
1
Operaciones sobre los valores de vecindades
2
Teor´ıa de sistemas y filtrado espacial
Linealidad e Invarianza a la traslaci´on
Convoluci´on
Separabilidad
Operaciones espaciales
1
Operaciones geom´etricas
2
Operaciones sobre valores de p´ıxeles
3
Transformaciones de dominio
Operaciones sobre los valores de vecindades
Para imagen de entrada
A
, la imagen de salida
B
es
Teor´ıa de sistemas
Tres tareas b´
asicas
a(x
,
y
)
b(x,
y
)
T
[
·
]
1
Simulaci´
on
de sistemas:
T
y
a
conocidos, determinar
b
2Reconstrucci´
on
de se˜
nales:
T
y
b
conocidos, determinar
a
3Identificaci´
on
de sistemas:
a
y
b
conocidos, determinar
T
Diferencias de PDI con PDS tradicional
1
la se˜
nales se definen en el espacio y no en el tiempo
2
dos variables independientes espaciales en vez de una
Linealidad
a(x
,
y
)
b(x,
y
)
T
[
·
]
Si
b
i
(x
,
y) =
T
[a
i
(x
,
y)] entonces
T
[k
1
a
1
(x
,
y) +
k
2
a
2
(x
,
y
)] =
k
1
T
[a
1
(x
,
y
)] +
k
2
T
[a
2
(x
,
y)]
o en general
T
"
N
X
k
=1
k
i
a
i
(x
,
y)
#
=
N
X
k
=1
k
i
T
[a
i
(x
,
y)] =
N
X
k
=1
k
i
b
i
(x
,
y
)
Invarianza a la traslaci´
on
a(x
,
y
)
b(x,
y
)
T
[
·
]
Si
b(x
,
y) =
T
[a(x
,
y)] entonces:
Sistemas LSI
LSI
:
L
inear and
S
hift
I
nvariant
LTI
:
L
inear and
T
ranslation
I
nvariant
Impulso unitario bidimensional
δ
(x
,
y
) =
δ
(x)
δ
(y) =
(
1 si
x
=
y
= 0
0 en el resto
Propiedad de muestreo:
u v u vP´ıxel en posici´on (u
,
v):
f
(x
,
y)
δ
(x
−
u
,
y
−
v)
Imagen como suma de p´ıxeles
f
(x
,
y) =
X
(
u
,
v
)
Convoluci´
on
Sea
T
un sistema LSI
g
(x
,
y) =
T
[f
(x
,
y)] =
T
X
(
u
,
v
)
f
(u
,
v)
δ
(x
−
u
,
y
−
v
)
=
X
(
u
,
v
)
T
[f
(u
,
v
)
δ
(x
−
u
,
y
−
v)]
=
X
(
u
,
v
)
f
(u
,
v)T
[
δ
(x
−
u
,
y
−
v)]
=
X
(
u
,
v
)
f
(u
,
v)h(x
−
u
,
y
−
v
)
=
f
(x
,
y
)
∗
h(x
,
y)
Funci´
on de dispersi´
on puntual
La respuesta al impulso
h(x
,
y) =
T
[
δ
(x
,
y)] llamada en PDI
tambi´en
funci´
on de dispersi´
on puntual
o PSF por
point spread
Pasos de la convoluci´
on
f
(x
,
y
)
∗
h(x
,
y) =
X
(
u
,
v
)
f
(u
,
v)h(x
−
u
,
y
−
v)
Cuatro pasos:
1
Invertir
h
tanto en
x
como en
y
(rotaci´on en 180
◦
)
2
Trasladar origen de
h
invertida a p´ıxel de inter´es en (x
,
y)
3
Multiplicar punto a punto
h
invertida y trasladada con
x
4
Sumar todos los productos anteriores y asignarlos al resultado
Otra interpretaci´
on
Convoluci´
on
f
(x
,
y
)
∗
h(x
,
y) =
X
(
u
,
v
)
f
(u
,
v)h(x
−
u
,
y
−
v)
superposici´on de la PSF desplazada a cada (u
,
v) y amplificada por
Propiedades
Convoluci´
on
Conmutatividad:
a(x
,
y)
∗
b(x
,
y) =
b(x
,
y)
∗
a(x
,
y)
Asociatividad:
a(x
,
y)
∗
b(x
,
y)
∗
c(x
,
y) = [a(x
,
y)
∗
b(x
,
y)]
∗
c(x
,
y)
=
a(x
,
y
)
∗
[b(x
,
y)
∗
c
(x
,
y
)]
Distributividad:
Costo de la convoluci´
on
Imagen
f
(x
,
y
) tiene
R
filas y
C
columnas
h(x
,
y) (kernel, n´
ucleo, m´ascara, PSF) tiene
N
filas y
M
columnas con
x
∈ {
x
i
, . . . ,
x
f
}
,
y
∈ {
y
i
, . . . ,
y
f
}
,
N
=
y
f
−
y
i
+ 1,
M
=
x
f
−
x
i
+ 1
La convoluci´on se puede reescribir
f
(x
,
y)
∗
h(x
,
y
) =
y−y
iX
v
=
y−y
fx−x
iX
u
=
x−x
ff
(u
,
v
)h(x
−
u
,
y
−
v)
para recorrer la m´ascara.
Tama˜
no m´ascara:
K
=
NM, tama˜
no imagen:
S
=
RC
Cada p´ıxel:
K
productos,
K
−
1 sumas
Filtro separable
Kernel
h(x
,
y
) separable si
Convoluci´
on con filtro separable
f
(x
,
y
)
∗
h(x
,
y) =
y−y
iX
v
=
y−y
fx−x
iX
u
=
x−x
ff
(u
,
v)h
h
(x
−
u)h
v
(y
−
v)
=
y−y
iX
v
=
y−y
fh
v
(y
−
v)
x−x
iX
u
=
x−x
ff
(u
,
v)h
h
(x
−
u)
La suma interna
g
x
(x
,
v
) =
x−x
iX
u
=
x−x
ff
(u
,
v)h
h
(x
−
u) es un filtrado
unidimensional para cada fila
v
de
f
(x
,
y
), y as´ı:
f
(x
,
y
)
∗
h(x
,
y) =
y−y
iX
Costo de convoluci´
on separable
P´ıxel en una fila:
M
productos,
M
−
1 sumas
(Producto punto)
Fila:
MC
productos y
C
(M
−
1) sumas
Todas las filas
MRC
=
MS
productos,
RC
(M
−
1) =
S(M
−
1) sumas.
P´ıxel en una columna:
N
productos,
N
−
1 sumas.
Columna:
NR
productos y
R(N
−
1) sumas.
Todas las columnas
NRC
=
NS
productos,
RC
(N
−
1) =
S(N
−
1) sumas.
Comparaci´
on de m´
ascaras separables y no separables
As´
umase
N
=
M
,
R
=
C
(m´ascara e imagen cuadradas)
M´ascara no separable:
R
2
N
2
productos,
R
2
(N
2
−
1)
M´ascara separable:
R
2
2N
productos,
R
2
(2N
−
2) sumas
Correlaci´
on
Correlaci´on:
f
(x
,
y
)
◦
h(x
,
y) =
f
(x
,
y)
∗
h(
−
x
,
−
y
) =
X
u
,
v
f
(u
,
v
)h(x+u
,
y
+v
)
La m´ascara
no
se rota, como la convoluci´on
Resumen
1
Operaciones sobre los valores de vecindades
2
Teor´ıa de sistemas y filtrado espacial
Linealidad e Invarianza a la traslaci´on
Convoluci´on
Separabilidad
Este documento ha sido elaborado con software libre incluyendo LATEX, Beamer, GNUPlot, GNU/Octave, XFig,
Inkscape, LTI-Lib-2, GNU-Make y Subversion en GNU/Linux
Este trabajo se encuentra bajo una Licencia Creative Commons Atribuci´on-NoComercial-LicenciarIgual 3.0 Unpor-ted. Para ver una copia de esta Licencia, visitehttp://creativecommons.org/licenses/by- nc- sa/3.0/o env´ıe una carta a Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.