PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL -...

20
1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED SEGMENTATION Let R represent the entire image region. Segmentation may be viewed as a process that partitions R into n subregions, R 1 , R 2 , …, R n ,such that i.e., the every pixel must be in a region; R i is a connected region, i = 1,2,…n; i.e., the regions are disjoints; (e.g., all pixel within a region have the same intensity); (e.g.., intensities of pixel in different regions are different) where P(R i ) is a logical predicate defined over the points in the set R i , and Ø is the null set. R R i n i = =1 , , , ) ( j i j i FALSE R R P j i 2200 = ; ,..., 2 , 1 , ) ( n i for TRUE R P i = = , , , j i R R j i 2200 = φ © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 2 Image Segmentation REGION GROWING BY PIXEL AGGREGATION Start with a seed pixel (or a set of seed pixels); Append to each pixel in the region those of its 4-connected or 8-connected neighbors that have similar properties (gray level, color, texture, etc); Stop when the region cannot be grown any further. Example: (b) absolute difference less than 3; (c) absolute difference less than 8.

Transcript of PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL -...

Page 1: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

1

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1

Image Segmentation

REGION ORIENTED SEGMENTATION

• Let R represent the entire image region.

• Segmentation may be viewed as a process that partitions Rinto n subregions, R1, R2, …, Rn,such that

– i.e., the every pixel must be in a region;

– Ri is a connected region, i = 1,2,…n;

– i.e., the regions are disjoints;

– (e.g., all pixel within a region have the same intensity);

– (e.g.., intensities of pixel in different regions are different)

where P(Ri) is a logical predicate defined over the points inthe set Ri , and Ø is the null set.

RR ini =∪ =1

,,,)( jijiFALSERRP ji ≠∀=∪

;,...,2,1,)( niforTRUERP i ==

,,, jiRR ji ∀=∩ φ

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 2

Image Segmentation

REGION GROWING BY PIXEL AGGREGATION

• Start with a seed pixel (or a setof seed pixels);

• Append to each pixel in theregion those of its 4-connectedor 8-connected neighbors thathave similar properties (graylevel, color, texture, etc);

• Stop when the region cannot begrown any further.

• Example:(b) absolute difference less

than 3;(c) absolute difference less

than 8.

Page 2: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

2

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 3

Image Segmentation

(a) original image showingseed point;

(b) early stage of regiongrowth;

(c) intermediate stage;(d) final region.

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 4

Image Segmentation

Difficulty:• results depend upon selection of seed pixels, and• measure of similarity (inclusion criteria).

Possible solution:• our multi-tolerance region growing procedure!

Page 3: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

3

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 5

Image Segmentation

REGION SPLITTING AND MERGING• Assuming the image to be square, subdivide the entire image

R successively into smaller and smaller quadrant regionssuch that, for any region

• In other words, if P(R) = FALSE, divide the image intoquadrants; if P is FALSE for any quadrant, subdivide that intosubquadrants, and so on ...

• This splitting technique may be represented as a quadtree.

• As the splitting procedure could result in adjacent regionsthat are similar, apply a merging step:

– merge two adjacent regions

• Stop the procedure when no further splitting; or merging ispossible.

.)(, TRUERPR ii =

TRUERRPifRandR kiki =∪ )(

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 6

Image Segmentation

Page 4: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

4

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 7

Image Segmentation

(a) original image;(b) result of split and merge

procedure;(c) result of thresholding.

P(Ri) = TRUE if at least 80%of the pixels in Ri have theproperty

zj: the gray level of jth pixelmi: mean gray level of Ri

iij mz σ2≤−

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 8

Image Segmentation

The use of motion insegmentation

>−=

otherwise

Ttyxftyxfifyxd ji

ji0

),,(),,(1),(,

Page 5: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

5

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 9

Image Segmentation

Accumulative differences

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 10

Representation and Description

• External characteristics:– Boundary or contour morphology,– Boundary roughness,– Boundary complexity.

It is desirable that boundary descriptors are invariant totranslation, scaling, and rotation.

• Internal characteristics:– Gray level,– Color,– Texture,– Statistics of pixel population.

Page 6: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

6

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 11

Representation and Description

• Descriptions of (dis)similarity;– Distance measures,– Correlation coefficient.

• Relational descriptions:– Placement rules,– String, tree, and web grammars,– Structural descriptions,– Syntactic analysis.

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 12

Representation and Description

CHAIN CODES

– Chain codes are used to represent a boundary by a connectedsequence of straight line segments of specified length anddirection.

– 4-connectivity or 8-connectivity may be used.

– As the chain code depends upon the starting point, it may benormalized by redefining the starting point such that the codeforms an integer of minimum magnitude.

Page 7: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

7

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 13

Representation and Description

(c) 0033333323221211101101 (d) 076666553321212

resampling

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 14

Representation and Description

• Polygonalapproximations

Page 8: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

8

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 15

Representation and Description

SIGNATURES

• A signature is a 1-D functional representation of a boundary.

• An example is a plot of the distance from the centroid of theregion to the boundary as a function of angle (or to eachboundary pixel).

• Another example is to represent the coordinates (xi,yi) ofeach boundary pixel as a complex variable

– where N is the number of boundary pixels (closed loop).

– zi may then be analyzed as a periodic signal.

• Signatures reduce boundary description from a 2D problemto a 1-D problem.

,1,...,2,0),( −=+= Nijyxz iii

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 16

Representation and Description

Page 9: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

9

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 17

Representation and Description

SKELETONIZATION• The skeleton of a region may be obtained by a thinning

algorithm:– Assume that the region has been binarized, with the

region pixels being 1 and the background pixels being 0.– A contour point is any pixel with value 1 having at least

one 8-connected neighbor valued 0.– Define the indexing of pixels in an 8-connected

neighborhood as below, where p1 is the pixel beingprocessed:

567

418

329

ppp

ppp

ppp

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 18

Representation and Description

• Step 1: Flag a contour point p1 for delection if the following aretrue (repeat for all border points):

• Step 2: Delete all flagged pixels (change to 0).• Step 3: Do the same as Step 1, but replace (c) and (d) with:

• Step 4: Delete all flagged pixels.• Iterated steps 1-4 until no further pixels are deleted.

;0..)(

;0..)(

;1)()(

;6)(2)(

864

642

1

1

==

=≤≤

pppd

pppc

pSb

pNa

.0..)’(

;0..)’(

862

842

==

pppd

pppc

N(p1) is the number of nonzero neighbors of p1,

i.e, N(p1) = p2+ p3+ p4+ p5+ p6+ p7+ p8+ p9.

S(p1) is the number of 0-1 transitions in thesequence p2 , p3 ,…, p9.

Page 10: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

10

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 19

Representation and Description

(a) result of step 1 of the thinning algorithmduring the first iteration through a region;

(b) result of step 2;(c) final result.

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 20

Representation and Description

Page 11: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

11

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 21

Representation and Description

SHAPE FACTORS

The shape complexity of a region’s boundary may bedescribed in terms of its– Compactness– Moments of distances to the centroid– Fourier descriptors of the signature– Chord-length statistics

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 22

Representation and Description

COMPACTNESS• The common definition of compactness is ,

where p is the perimeter and a is the area of the region.• Compactness is a measure of the efficiency of a contour in

containing maximal area.• A circle has the minimum compactness value of 4π.• The compactness of a square is 16.• Compactness may redefined as

which is normalized to the range (0,1), with 0 for a circle.• Compactness is invariant to translation, scaling, and rotation,

and has been useful in classifying breast tumors andcalcifications as benign or malignant.

2

41’

p

aC

π−=

apC /2=

Page 12: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

12

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 23

Representation and Description

CHORD-LENGTH STATISTICS• A chord is a line joining a boundary pixel to another

boundary pixel. For a boundary contour with N points,K = N(N - 1)/2 distinct chords exist.

• Statistical measures of the distribution of the chord-lengthsLi, i = 1,2, . . ., K may be useful in differentiating betweensome types of boundary shapes.

Mean: Variance:

Skewness:

Kurtosis:

,1

111 ∑

=

=K

ic L

KM

,)(1 3

113

23 ∑

=

−=K

ici

cc ML

MM

41

114

24 )(

11c

K

icc ML

KMM −= ∑

=

,)(1 2

11

22 ci

K

ic ML

KM −= ∑

=

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 24

Representation and Description

MOMENTS OF DISTANCES TO THE CENTROID

• Let represent the distances from thecentroid of the region to each of the N boundary pixels.

• Moments of various orders of the may assist indistinguishing between contours of different types: thevariance will be zero for a circle, and large for a complexshape with a "rough" boundary.

• The shape factor has been useful inclassifying tumors and calcifications in mammograms asbenign or malignant, where

[ ] .)(11

,)(11

1

4

14

11

31

211

11 ∑∑

==

−=−=N

ii

N

i

mzNm

FmzNm

F

Sz i ’

Niz i ,...,2,1, =

∑=

=N

iiz

Nm

11 ,

1

3131 FFMF −=−

Page 13: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

13

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 25

Representation and Description

FOURIER DESCRIPTORS• Consider the representation of each boundary pixel as a

complex variable

• where N is the number of boundary pixels.• The DFT of may then be computed as

• Normalized Fourier descriptors may then be defined as

• Note that the boundary may have to be resampled to have samples, k being an integer, for the sake of FFT computations.

[ ]∑−

=

−=−=1

0

.1...,2,1,0,/2exp.1

)(N

kk NuNukjz

NuA π

=)(kNFD

.12/,...,2,1);1(/)(

2/,...,2,1);1(/)(

0;0

+−−−=+=

=

NkANkA

NkAkA

k

.1,...,2,0),( −=+= Nijyxz iii

iz

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 26

Representation and Description

A digital boundary and its representationas a complex sequence. The points (xo, yo)an (x1, y1) are (arbitrarily) the first twopoints in the sequence.

Page 14: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

14

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 27

Representation and Description

[ ]∑−

=

−==1

0

.1...,2,1,0,/2exp).()(ˆM

u

NkNukjuAks πinversa

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 28

Representation and Description

• As rough contours will lead to increased higher-frequencycomponents, we could compute a shape factor withincreasing weights for higher-frequency components.

• However, this could lead to sensitivity to noise and errors inboundary representation.

• A better approach is to use a decreasing weight for higher-frequency components, and then subtract it from 1:

• FF is limited to the range (0,1), and increases with roughness.• FF has been useful in classifying breast tumors and

calcifications as benign or malignant.

.)(

/)(1 2/

2/

2/

12/

∑∑

=

+−=−=N

Nk

N

Nk

kNFD

kkNFDFF

Page 15: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

15

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 29

Representation and Description

REGION EDGE DEFINITION AND ACUTANCE• Acutance is a measure of change of density from a region of

interest (ROI) to its background.• Acutance has been defined in 1D as the mean-squared

gradient along a knife-edge spread function:

• where f(x) is the spread function, and a and b are the end-points of the spread function.

• Acutance has been shown to be a well correlated withsubjectively perceived edge sharpness in images.

,)(

)()(

12

dxdx

xdf

afbfA

b

a

−= ∫

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 30

Representation and Description

ADAPTIVE COMPUTATION OF 2DIMAGE EDGE PROFILE ACUTANCE

– Polygonal approximation of the boundary;– Adaptive computation of differences along normals at

boundary pixels.

Page 16: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

16

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 31

Representation and Description

• Step 1: Compute the sum of the differences along the normalat each boundary pixel j.

where f(i) and b(i), I=1,2,…,D j, are pixels along the normalinside and outside the ROI;j = 0,1, 2, . . ., N-1 represent the boundary pixels.

• Step 2: Compute the normalized root mean-squareddifference over all boundary pixels:

dmax is a normalization factor such that A is limited to (0, 1)and depends upon the gray level dynamic range and max{Dj}

.)(11 1

0

2

max∑

=

=N

i jD

jd

NdA

∑=

−=jD

i i

ibifjd

1 2

)()()(

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 32

Representation and Description

APPLICATION OF ACUTANCE TO TUMOR ANALYSIS

– Features of Benign Masses:

• Smooth, round, or oval shape;

• Circumscribed,

• Sharp, well-defined edges.

– Features of Malignant Tumors:

• Rough, spiculated, or stellate shape;

• Fuzzy or blurred boundaries.

Page 17: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

17

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 33

Representation and Description

Table 1: Numbers of different types of masses and tumors in thedatabase used in the study.

Database CB CM SB SM TotalMIAS 16 4 12 7 30

Calgary 0 3 0 12 15

Combined 16 7 12 19 54

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 34

Representation and Description

Clasification using A only# of correctly

classified casesCombineddatabase

# ofcases

Benign Malignant

%correct

Benign 28 26 2 92.9Malignant 26 2 24 92.3Total 54 - - 92.6

Table 3 : Details of the best benign / malignant classifier for thecombined database.

Page 18: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

18

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 35

Representation and Description

Table 4: Benign / malignant classification rates for variouscombinations of features.

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 36

Representation and Description

Table 7: Circumscribed / spiculated classifications rates forvarious combinations af features.

Page 19: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

19

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 37

Representation and Description

Table 9: Details of the best four-group classifier for thecombined database.

Clasification using A only FF

# of correctly classified casesCombineddatabase

# ofcases CB CM SB SM

%correct

CB 16 16 0 0 0 100CM 7 0 5 1 1 71.4SB 12 0 1 11 0 91.7SM 19 0 2 1 16 84.2Total 54 - - - - 88.9

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 38

Representation and Description

Table 10: Four-group classifications rates for variouscombinations of features.

Page 20: PEE5830 aula06 final - lsi.usp.brroseli/pee5830/pee5830_aula06.pdf · 1 © Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1 Image Segmentation REGION ORIENTED

20

© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 39

Representation and Description

OBSERVATIONS ON TUMOR CLASSIFICATION

• Compactness, FF, and provide good circumscribed/

spiculated classification;

• Acutance provides excellent benign/ malignant classification;

• Four-group classification requires acutance and shape

factors.

31−MF