Top Banner
Tutorial # 9 Nov. 21, 2013 1
23

Tutorial # 9 Nov. 21, 2013 1. Segmentation Isolating a region/regions of interest in an image Useful for: Collect more meaningful data from an image.

Dec 22, 2015

Download

Documents

Irma Martin
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

1

Tutorial # 9

Nov. 21, 2013

Page 2: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

2

Segmentation Isolating a region/regions of interest in an

image Useful for:

Collect more meaningful data from an image Easier analysis Locate objects Locate boundaries

Page 3: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

3

K-means clustering Unsupervised clustering algorithm

Classifies input data points into K classes based on their inherent distance to each other

Points are clustered around centroids/means

Which are obtained by minimizing:

Where there are K clusters and is the centroid of all points

Ref: http://www.ics.uci.edu/~dramanan/teaching/ics273a_winter08/projects/avim_report.pdf

Page 4: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

4

Example – 1 Channel Given a gray scale image, use K-means to

segment the image. Choose K = 2 (Cluster A and Cluster B)

1 5 3

2 6 2

5 5 1

Page 5: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

5

1.) Calculate the histogram

0 1 2 3 4 5 60

0.5

1

1.5

2

2.5

3

3.5

Intensity

Frequency

Page 6: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

6

2.) Initialize centroids Randomly initialize centroids

0 1 2 3 4 5 60

0.51

1.52

2.53

3.5

Intensity

Fre-quency

𝜇𝐴 𝜇𝐵

Page 7: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

7

3) Cluster intensities based on distance

1 2 3 5 6

Distance with 0 1 4 16 25

Distance with 4 1 0 4 9

A A B B B

Note: Points with intensity 2 can be classified as either, but our algorithm chooses the first cluster.

Page 8: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

8

4.) Recalculate centroids New centroids

0 1 2 3 4 5 60

0.51

1.52

2.53

3.5

Intensity

Fre-quency

𝜇𝐴2 𝜇𝐵 2

Page 9: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

9

5.) Recluster intensities using new centroids

1 2 3 5 6

Distance with 0.25 0.25 2.25 12.25 20.25

Distance with 14.44 7.84 3.24 0.04 1.44

A A A B BWe have a new clustering!

Recalculate the centroid.

Page 10: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

10

New centroids

0 1 2 3 4 5 60

0.51

1.52

2.53

3.5

Intensity

Fre-quency

𝜇𝐴3 𝜇𝐵 2

Page 11: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

11

Recalculate the means and we find:

This means we can stop and we have our final clusters

1 2 3 5 6

Distance with 0.64 0.04 1.44 10.24 17.64

Distance with 18.063 10.56 5.063 0.63 0.56

A A A B B

Page 12: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

12

Final Clustering/Segmentation

A B A

A B A

B B A

This answer would change if we chose K = 3. Also, the number of iterations would change depending on the starting centroids.

Page 13: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

13

Real example

Page 14: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

14

Real example

Page 15: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

15

Number of Clusters: K = 1

Page 16: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

16

Number of Clusters: K = 3

Page 17: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

17

Actual Segmentation

Cluster 1 Cluster 2 Cluster 3

Page 18: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

18

Similar intensities

Page 19: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

19

Number of Clusters: K = 5

Oversegmentation – K is too high

Page 20: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

20

What about colour segmentation? Different regions of interest may have the

same intensity but different colours Can use the colour information of an image to

improve segmentation Let’s focus only on the colour and remove the

intensity by converting to a different colour space: HSI (Hue Saturation Intensity) YCbCr (Luma, Blue difference, Red difference) L*a*b* (Lightness, a* - colour that falls on the red-

green axis, b* - colour that falls on the blue-yellow axis)

Page 21: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

21

Using L*a*b* space Our K-means problem becomes a 2D problem Our centroid will now have two variables, one

defining the intensity of the a* channel and one defining the b* channel

http://www.mathworks.com/help/releases/R2013b/stats/kmeans.gif

Page 22: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

22

K = 1 K = 3 K = 5

Page 23: Tutorial # 9 Nov. 21, 2013 1. Segmentation  Isolating a region/regions of interest in an image  Useful for:  Collect more meaningful data from an image.

23

Cluster 1 Cluster 2 Cluster 3