1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

56
1 Image Segmentation Image Segmentation Chapter 9 Chapter 9 Dr. Mario Chacón Dr. Mario Chacón DSP & Vision Lab DSP & Vision Lab

Transcript of 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

Page 1: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

11

Image SegmentationImage SegmentationChapter 9Chapter 9

Dr. Mario ChacónDr. Mario Chacón

DSP & Vision LabDSP & Vision Lab

Page 2: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & 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.

Page 3: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

33

Introduction to Image SegmentationIntroduction to Image Segmentation

Figura 9. 2 Complejidad de la segmentación e interpretación de escena.

Page 4: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 5: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

55

Image SegmentationImage SegmentationEdge DetectionEdge Detection

Figura 9. 3 a) Imagen can varios objetos, b) bordes en la imagen.

Page 6: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 7: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

77

Image SegmentationImage SegmentationEdge DetectionEdge Detection

yx GGy

yxI

x

yxIyxI ,

),(,

),(),(

yx GGyxI ),(

Page 8: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

88

Image SegmentationImage SegmentationEdge DetectionEdge Detection

321987 22 iiiiiiGx

741963 22 iiiiiiG y

y

x

G

Gyx 1tan),(

Page 9: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

99

Image SegmentationImage SegmentationEdge DetectionEdge Detection

Page 10: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 11: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 12: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

1212

Image SegmentationImage SegmentationEdge DetectionEdge Detection

2

2

2

22 ),(),(

),(y

yxI

x

yxIyxI

864252 4),( iiiiiyxI

El operador Laplaciano está definido como.

Page 13: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

1313

Image SegmentationImage SegmentationEdge DetectionEdge Detection

Page 14: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

1414

Image SegmentationImage SegmentationEdge DetectionEdge Detection

Figura 9. 8 a) Perfile de borde, b) primera derivada, c) segunda derivada.

Page 15: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

1515

Image SegmentationImage SegmentationEdge linkingEdge linking

)','( asimilar es ),(

)','(),( )','(),(

yxIyxIentonces

TyxyxyTyxIyxISi L

Page 16: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 17: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

1717

Image SegmentationImage SegmentationEdge Detection, CannyEdge Detection, Canny

Figura 9. 10 Operador Canny, a) Original, b) c) , d) 9.0 5.0 1.0

Page 18: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 19: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 20: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

2020

Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera

Figura 9. 11 Visualización de la topología referente a bordes.

Page 21: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

2121

Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera

yxpsibordecandidatopixelesno

yxpsicandidatopixelunes

yxp,a

,borde a

,

pIyxP ,max

10/)1(

Page 22: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 23: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 24: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 25: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

2525

Image SegmentationImage SegmentationEdge Detection, CordilleraEdge Detection, Cordillera

Figura 9. 17 a) Original, b) Prewitt, c) Canny, d) Cordillera.

Page 26: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 27: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

2727

Image SegmentationImage SegmentationHough TransformHough Transform

sincos yx

Figura 9. 19 Interpretación de y

x

y

Page 28: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 29: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 30: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

3030

Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation

TyxI

TyxIyxI N ),(1

),(0),(

)],(),,(,,[ yxIyxiyxTT

Page 31: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

3131

Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation

Figura 9. 22 a) objeto y fondo, b) su histograma.

Page 32: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 33: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

3333

Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation

dzzpCCpT

E

221

dzzpCCpT

E

112

112221 CpCCpCpCCpTp EEE

Tp1(z)

p2(z)

21 CCpE 12 CCpE

Page 34: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 35: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 36: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 37: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 38: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

3838

Image SegmentationImage SegmentationThreshold SegmentationThreshold Segmentation

k

jjkk

C de proviene x que decida Entonces

kjy Mj para CpCxpCpCxp Si ,...,2,1

Page 39: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 40: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 41: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 42: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

),(

Page 43: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

4343

Image SegmentationImage SegmentationTexture Segmentation Texture Segmentation

varDL

i(x,y)

varDR

varH

varV

Figura 9. 27 Direcciones de cálculo de varianza.

Page 44: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 45: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

4545

Image SegmentationImage SegmentationTexture Segmentation Texture Segmentation

  

21

22,),(

,),(),(),(

s ts t

RR

s t

RR

IW

wtysxwItsI

wtysxwtsItsIyxR

Normalized autocorrelation function

Page 46: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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)

Page 47: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 48: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

  

Page 49: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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.

Page 50: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

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

Page 51: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

5151

Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging

 

  

Page 52: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

5252

Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging

 

  

Page 53: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

5353

Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging

 

  

R1 R1

R1

R1

R1

R1

R2

Page 54: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

5454

Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging

 

  

R1 R1

R1

R1

R1

R1

R2

Page 55: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

5555

Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging

 

  

R1 R1

R1

R1

R1

R1

R2

Page 56: 1 Image Segmentation Chapter 9 Dr. Mario Chacón DSP & Vision Lab.

5656

Image SegmentationImage SegmentationSplitting and Merging Splitting and Merging

 

  

R1 R1

R1

R1

R1

R1

R2

R1

R2