1 image segmentation chapter 9 dr. mario chacón dsp & vision lab
TRANSCRIPT
11
Image SegmentationImage SegmentationChapter 9Chapter 9
Dr. Mario ChacónDr. Mario Chacón
DSP & Vision LabDSP & Vision Lab
22
Introduction to Image SegmentationIntroduction to Image Segmentation
La segmentación en procesamiento de imágenes en forma genérica se puede definir como la determinación de estructuras o subestructuras que correspondan a la imagen de un objeto de interés.
Adquisiciónde
Imágenes
Preprocesado SegmentaciónExtracción
deCaracterísticas
Reconocimiento e Interpretación
Figura 9. 1 Segmentación en le proceso de análisis de escena.
33
Introduction to Image SegmentationIntroduction to Image Segmentation
Figura 9. 2 Complejidad de la segmentación e interpretación de escena.
44
Introduction to Image SegmentationIntroduction to Image Segmentation
Los métodos de segmentación en procesamiento de imágenes tienen dos corrientes principales:
•Basada en la determinación de bordes de objetos, uso de discontinuidades, para delimitar los objetos de interés.
•Basada en similitud de la información para realizar agrupamientos que formen los objetos.
55
Image SegmentationImage SegmentationEdge DetectionEdge Detection
Figura 9. 3 a) Imagen can varios objetos, b) bordes en la imagen.
66
Image SegmentationImage SegmentationEdge DetectionEdge Detection
Figura 9. 4 a) Borde de transición suave sin ruido, b) con disturbios, c) Borde de transición brusca sin ruido, d) con disturbios.
77
Image SegmentationImage SegmentationEdge DetectionEdge Detection
yx GGy
yxI
x
yxIyxI ,
),(,
),(),(
yx GGyxI ),(
88
Image SegmentationImage SegmentationEdge DetectionEdge Detection
321987 22 iiiiiiGx
741963 22 iiiiiiG y
y
x
G
Gyx 1tan),(
99
Image SegmentationImage SegmentationEdge DetectionEdge Detection
1010
Image SegmentationImage SegmentationEdge DetectionEdge Detection
Figura 9. 6 a) Original, b) Prewitt vertical, c) Prewitt horizontal, d) Sobel vertical, d) Sobel horizontal, e) Robert
1111
Image SegmentationImage SegmentationEdge DetectionEdge Detection
Figura 9. 7 a) Original, b) Prewitt vertical, c) Prewitt horizontal, d) Sobel vertical, d) Sobel horizontal, e) Robert with other threshold
1212
Image SegmentationImage SegmentationEdge DetectionEdge Detection
2
2
2
22 ),(),(
),(y
yxI
x
yxIyxI
864252 4),( iiiiiyxI
El operador Laplaciano está definido como.
1313
Image SegmentationImage SegmentationEdge DetectionEdge Detection
1414
Image SegmentationImage SegmentationEdge DetectionEdge Detection
Figura 9. 8 a) Perfile de borde, b) primera derivada, c) segunda derivada.
1515
Image SegmentationImage SegmentationEdge linkingEdge linking
)','( asimilar es ),(
)','(),( )','(),(
yxIyxIentonces
TyxyxyTyxIyxISi L
1616
Image SegmentationImage SegmentationEdge Detection CannyEdge Detection Canny
Primera, el error de detección de bordes, que indica que se deben localizar todos los bordes y no se deben generar respuestas falsas.
La segunda se refiere a la localización del borde la cual se relaciona con la distancia entre el pixel detectado como borde y el borde real, la cual deberá ser minimizada.
La tercera meta se agrega ya que las dos primeras no son suficientes y es para evitar la posibilidad de tener respuestas múltiples de un borde simple.
1717
Image SegmentationImage SegmentationEdge Detection, CannyEdge Detection, Canny
Figura 9. 10 Operador Canny, a) Original, b) c) , d) 9.0 5.0 1.0
1818
Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera
El primero es cómo encontrar los píxeles pertenecientes a un borde bajo un criterio específico.
El segundo problema es como decidir cuales píxeles de los seleccionados como posibles píxeles de bordes van a ser marcados como bordes, esto es definición de bordes.
Y por último el tercer problema sería el encadenamiento de bordes o extensión de los mismos.
1919
Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera
•Se aplica un filtro Gaussiano de orden 5x5, ecuación (9.9), a la imagen original
•Se definen los niveles de bordes usando un operador de bordes•Se calcula un umbral para decidir la cantidad de niveles de bordes a ser detectados, esto es, píxeles candidatos a ser bordes.•Se usa la información topológica para clasificar a los candidatos a bordes•Se encadenan los bordes clasificados y se expanden
2
2
2, 2exp
2
1
y
yx
yxG
2020
Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera
Figura 9. 11 Visualización de la topología referente a bordes.
2121
Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera
yxpsibordecandidatopixelesno
yxpsicandidatopixelunes
yxp,a
,borde a
,
pIyxP ,max
10/)1(
2222
Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera
1y borde de pixelun es
2 regla la cumple y y
borde de pixelun es
2 regla la cumple y y
,1,1,
,,1,,1,1
,
,,1,,1,
yxyxyx
yxyxyxyxyx
yx
yxyxyxyxyx
ptptptthen
ptptptptptifElse
ptthen
ptptptptptIfRule 1
otra formadebordeunesno
ptpt
yptpt
sibordeunespt dyx
yxyxuyx
yxyxyx
31
31
,,
,,,
,,
forma otra de
31
31
,
,,,
,,,
bordeunesno
ptpt
yptpt
sibordeunespt ryx
yxyxlyx
yxyxyx
Rule 2 H
Rule 2 V
2323
Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera
Píxel vecino
Píxel final
Dirección del borde1 2
3
20
37
18
Figura 9. 15 a) Dirección del borde, b) Extensión del borde.
2424
Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera
6
bordes
Figura 9. 16 a) Imagen a procesar, b) , c) histograma de , d) , e) encadenado de bordes.
),( yxI p),( yxI p ),( yxIed
2525
Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera
Figura 9. 17 a) Original, b) Prewitt, c) Canny, d) Cordillera.
2626
Image SegmentationImage SegmentationHough TransformHough Transform
baxy ii ii yaxb
x
y
.
.
(xi,yi)
(xj,yj)
b= -a xj +,yj
a’
a
b
b= -a xi +,yi
.
b’
a) b)
Figura 9. 18 Mapeo de puntos a rectas, a) puntos, b) rectas correspondientes.
2727
Image SegmentationImage SegmentationHough TransformHough Transform
sincos yx
Figura 9. 19 Interpretación de y
x
y
2828
A
B
Image SegmentationImage SegmentationHough TransformHough Transform
1 2
4
5
6
3
7
Figura 9. 20 a) Puntos en la imagen, b) su transformada Hough.
2929
Image SegmentationImage SegmentationHough TransformHough Transform
Figura 9. 21 a) Documento, b) Región para análisis, c) acumulador de Hough, d) detección de líneas.
3030
Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation
TyxI
TyxIyxI N ),(1
),(0),(
)],(),,(,,[ yxIyxiyxTT
3131
Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation
Figura 9. 22 a) objeto y fondo, b) su histograma.
3232
Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation
Tp1(z)
p2(z)
21 CCpE 12 CCpE
Figura 9. 23 Ilustración de los dos tipos de errores debido a clasificación equivocada.
3333
Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation
dzzpCCpT
E
221
dzzpCCpT
E
112
112221 CpCCpCpCCpTp EEE
Tp1(z)
p2(z)
21 CCpE 12 CCpE
3434
Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation
aplicando la regla de Liebnitz tenemos
0)(
T
TpE
dzzpCpt
dzzpCpTT
Tp
T
TE
1122
)(
0)(
1122
TT
E zpCpzpCpT
Tp
0)(
1122
TpCpTpCp
T
TpE
Tp
Tp
Cp
Cp
1
2
2
1
3535
Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation
0.5
1
1 2 3 4 5 6
p1(z)
p2(z)
Figura 9. 24 Distribuciones de pixeles
3636
Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation
forma otra de
zzzp0
312
1
2
3
1
forma otra de
zzp0
422
1
2
2
12
1
2
12
1
2
3
z
2
1
2
1
2
3 z Tz 2
3737
Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation
0221
dzzpCCpT
E
3
2
112 4
1
2
1
2
3dzzdzzpCCp
T
E
8
1
2
1
4
1TpE
3838
Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation
k
jjkk
C de proviene x que decida Entonces
kjy Mj para CpCxpCpCxp Si ,...,2,1
3939
Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation
En la literatura existen otras variaciones al método de mínima probabilidad. Uno de los más mencionado en la literatura es el de maximización de la varianza entre clases propuesto por Otsu, se recomienda al lector consultar (Otsu [1979]) para una descripción detallada del método.
4040
Image SegmentationImage SegmentationThreshold Segmentation,binarizationThreshold Segmentation,binarization
Figura 9. 25 a) Imagen a segmentar, b) histograma, c)perdida de pixeles del objeto, d) incorporación de fondo al objeto, e) usando umbral óptimo.
4141
Image SegmentationImage SegmentationEdge Threshold SegmentationEdge Threshold Segmentation
Figura 9. 26 a) Original, b) su histograma, c) sus bordes, d) bordes dilatados, e) pixeles cercanos al borde del objeto, e) su histograma.
4242
Image SegmentationImage SegmentationTexture Segmentation Texture Segmentation
),(),(: yxIyxIT tE
))),( vecindario(var( yxipromTE DR,DLh,V,promyxTi var,var,var,var),(
2),(
),(,1
1
vecinosyx
yxIyxIN
var
vecinosyx
yxIN
yxI),(
,1
),(
4343
Image SegmentationImage SegmentationTexture Segmentation Texture Segmentation
varDL
i(x,y)
varDR
varH
varV
Figura 9. 27 Direcciones de cálculo de varianza.
4444
Image SegmentationImage SegmentationTexture Segmentation Texture Segmentation
a) b) c)
Figura 9. 28 Procesamiento con el operador de textura, a) original, b) imagen de textura, c) regiones.
4545
Image SegmentationImage SegmentationTexture Segmentation Texture Segmentation
21
22,),(
,),(),(),(
s ts t
RR
s t
RR
IW
wtysxwItsI
wtysxwtsItsIyxR
Normalized autocorrelation function
4646
Image SegmentationImage SegmentationTexture Segmentation Texture Segmentation
Figura 9. 29 a) Original, b) imagen de textura, c) regiones candidatas, d) máscara de placa, e) resultado de correlación, d)
4747
Image SegmentationImage SegmentationRegion Based Segmentation Region Based Segmentation
Bajo este esquema podemos considerar a la segmentación como un proceso para particionar a en subimágenes , , .., de manera que i) , que indica que toda la imagen se descompone en regiones distintas. ii) , cada pixel de una región debe cumplir un criterio de conectividad con los demás pixeles que forman la misma región. iii) , indica regiones disjuntas. Los pixeles en una región sólo pueden formar parte de esa región. iv) , los pixeles dentro de una región deberán satisfacer el predicado o conjunto de predicados, que se utilizan para distinguir las regiones. Por ejemplo un predicado puede ser “el valor del pixel esta dentro del rango de tonos de gris ”. V) , esta condición indica la distinción entre regiones, es decir la característica o características definidas con el o los predicados de una región no puede ser iguales en otra región.
),( yxI ),(1 yxI ),(2 yxI ),( yxI n
),(),(1
yxIyxI i
n
i
conectadaregión una es ,...,2,1 para ),( niyxI i
jijiyxIyxI ji ,y ),(),(
niVERDADERORP i ,...,2,1,para
iRP
21 , ll
jiFALSORRP ji ,para
4848
Image SegmentationImage SegmentationRegion Growing Segmentation Region Growing Segmentation
0 0 2 0 1
1 6 7 7 0
2 7 8 7 2
1 7 7 7 1
1 2 0 0 1
R1 R1 R1 R1 R1
R1 R2 R2 R2 R1
R1 R2 R2 R2 R1
R1 R2 R2 R2 R1
R1 R1 R1 R1 R1
a) b)
Figura 9. 30 a) Imagen con semillas, b) resultado de segmentación por crecimiento de región
4949
Image SegmentationImage SegmentationRegion Growing Segmentation Region Growing Segmentation
“pixeles con valor en el rango de (0,50)” “pixeles con valor en el rango de (100,150)” “pixeles con valor >240”
1RP
2RP
3RP
x
x
x
Figura 9. 31 Generación de regiones con semilla y predicado. A) Original, b) Región 1, c) Región 2 (fondo), d) Región 3.
5050
Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging
),( yxI i
),( yxI j
VERDADERORRP kj
Divida cada región en cuatro nuevas regiones disjuntas donde sea falso.
Para evitar separaciones de regiones igual, una las regiones adyacentes e siempre y cuando .
Repita i) e ii) mientras exista la posibilidad de continuar la división de la imagen
iRP
),( yxI k
5151
Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging
5252
Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging
5353
Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging
R1 R1
R1
R1
R1
R1
R2
5454
Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging
R1 R1
R1
R1
R1
R1
R2
5555
Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging
R1 R1
R1
R1
R1
R1
R2
5656
Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging
R1 R1
R1
R1
R1
R1
R2
R1
R2