38
Digital Image Processing, 2nd ed. www.imageprocessingbook.com 002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Embed Size (px)

Citation preview

Page 1: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Melhoramento de Imagens

Paulo Sérgio Rodrigues

PEL205

Page 2: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 3: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 4: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Melhoramento no Domínio Espacial

Alguns tipos simples de transformações de intensidade

• Negativo

• Stretching

• Compressão

• Slicing

Uma maneira de realizar algumas dessas operações é atravésda função de transformação g(x,y) = c f(x,y)y

Page 5: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 6: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 7: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 8: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 9: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 10: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 11: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 12: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 13: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 14: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Bit-Plane Slicing

Chapter 3Image Enhancement in the

Spatial Domain: Bit-Plane Slicing

Page 15: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Bit-Plane Slicing

Chapter 3Image Enhancement in the

Spatial Domain: Bit-Plane Slicing

Page 16: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Bit-Plane Slicing

Chapter 3Image Enhancement in the

Spatial Domain: Bit-Plane Slicing

Page 17: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Melhoramento no Domínio Espacial

Processamento Baseado em Histograma: Equalização

O objetivo é usar uma função de transformação que torne o histograma o mais uniforme possível, criando uma imagemcom maior contraste.

Se usarmos como função de transformação o histograma cumulativoo resultado será uma distribuição mais uniforme (equalizada)

• Calcular o Histograma original• Calcular o Histograma cumulativo• Equalizar a imagem com o Histograma cumulativo

Page 18: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Melhoramento no Domínio Espacial

Processamento Baseado em Histograma: Equalização

1,...,1,0 10 )( Lkrn

nrp k

kkr

onde: pr(rk) é a probabilidade da intensidade rk

nk é o número de ocorrências de rk

n é o número total de ocorrências

Page 19: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Melhoramento no Domínio Espacial

Processamento Baseado em Histograma: Equalização

A função cumulativa é calculada como:

1,......,1,0 1,0

)(

)()(

1

00

Lksr

sTr

rpn

nrTs

kk

kk

k

jjr

k

j

jkk

Page 20: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Melhoramento no Domínio Espacial

Processamento Baseado em Histograma: Equalização

)(rpr )()( 1 sTsps

r s

Page 21: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain

Chapter 3Image Enhancement in the

Spatial Domain

Page 22: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Enhancing with Arithmetic/Logic Operations

Chapter 3Image Enhancement in the

Spatial Domain: Enhancing with Arithmetic/Logic Operations

Page 23: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Image Averaging

Chapter 3Image Enhancement in the

Spatial Domain: Image Averaging

a) Originalb) Original + ruídoc) Média de 8 imagensd) Média de 16 imagens e) Média de 32 imagensf) Média de 64 imagens

(a) (b)

(c) (d)

(e) (f)

Page 24: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Image Averaging

Chapter 3Image Enhancement in the

Spatial Domain: Image Averaging

Diferença de imagens

a) Original slide 23 – (c) slide 24 b) Original slide 23 – (d) slide 24(c) Original slide 23 – (e) slide 24(d) Original slide 23 – (f) slide 24

(a)

(b)

(c)

(d)

Page 25: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in theSpatial Domain: Filtering

Chapter 3Image Enhancement in theSpatial Domain: Filtering

Mecanismo parafiltragem no domínioespacial

Page 26: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in theSpatial Domain: Filtering

Chapter 3Image Enhancement in theSpatial Domain: Filtering

Representação da máscarade convolução

Page 27: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in theSpatial Domain: Filtering

Chapter 3Image Enhancement in theSpatial Domain: Filtering

Exemplo de máscaras de suavização

Page 28: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in theSpatial Domain: Filtering

Chapter 3Image Enhancement in theSpatial Domain: Filtering

(a) (b)

(c) (d)

(e) (f)

Exemplo de suavização

a)Imagem original

(b) a (f) Resultados de suavização com máscaras de tamanho 3, 5, 9,15 e 35

Page 29: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in theSpatial Domain: Filtering

Chapter 3Image Enhancement in theSpatial Domain: Filtering

a) Imagem do telescópio Hubble; b) suavização com máscara 15 x 15; c) Limiarização de (b)

(a) (b) (c)

Page 30: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Edge Detection

Chapter 3Image Enhancement in the

Spatial Domain: Edge Detection

(a)

(c)

(b)

(d)

a) Máscara para o Laplaciano;

b) Extensão incluindo as diagonais;

c) Outra implementação para (a)

d) Outra implementação para (b)

Page 31: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Edge Detection/Filtering

Chapter 3Image Enhancement in the

Spatial Domain: Edge Detection/Filtering

a) Imagem original;b) Laplaciano;c) (b) escalonado;d) Melhoramento

usando a equação abaixo

(a) (b)

(c)(d)

Page 32: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Edge Detection/Filtering

Chapter 3Image Enhancement in the

Spatial Domain: Edge Detection/Filtering

(a) (b)

(c) (d)

a) Filtros Laplacianos;b) Imagem microscópicac) Filtragem com (a)

superiord) Filtragem com (a)

inferior

Page 33: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Popular Masks

Chapter 3Image Enhancement in the

Spatial Domain: Popular Masks

a) Máscara 3 x 3;b) Máscara 2 x 2 sensível

a diagonal;c) Filtro Sobel horizontald) Filtro Sobel Vertical

(a)

(b)

(c) (d)

Page 34: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Chapter 3Image Enhancement in the

Spatial Domain: Edge with Sobel

Chapter 3Image Enhancement in the

Spatial Domain: Edge with Sobel

(a) (b)

a) Imagem de Lentes de Contato; (b) Aplicação do Gradiente Sobel

Page 35: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Melhoramento no Domínio Espacial

Filtragem com função Sigmoid

Se uma escala de reflectância das regiões de interesse são conhecidas, pode-se usar uma função que se adapte aos valoresconhecidos para direcionar a suavização. Exemplo: região em torno da mama

Page 36: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Melhoramento no Domínio Espacial

Filtragem com função Sigmoid

Em caso de tumores de mama, um estudo de tais regiões, produz a seguinte escala:

Page 37: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Melhoramento no Domínio Espacial

Filtragem com função Sigmoid

Tal escala, pode ser utilizada em uma função sigmoid como a seguinte:

Min

e

MinMaxII

1

1)(

~

onde ....

Page 38: Digital Image Processing, 2nd ed.  © 2002 R. C. Gonzalez & R. E. Woods Melhoramento de Imagens Paulo Sérgio Rodrigues PEL205

Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com

© 2002 R. C. Gonzalez & R. E. Woods

Melhoramento no Domínio EspacialFiltragem com função Sigmoid

interesse de faixa da mínimo e máximo valoresos são e

dacentraliza está interesse de faixa a qual do tornoem valor o é

interesse de faixa da largura a é

original luminância de valor o é

suavizado luminância de valor o é ~

1

1)(

~

MinMax

I

I

Min

e

MinMaxII