Lecture4-Segmentation
Lecture4-Segmentation
Chapter 4: Segmentation
2
CONTENTS
3
Y tế (chuẩn đoán hình ảnh)
4
5
6
7
8
9
10
11
Example:
The algorithm will be demonstrated using the simple 6x6 image shown
below. The histogram for the image is shown next to it. To simplify the
explanation, only 6 greyscale levels are used.
12
• The calculations for finding the foreground and background variances (the
measure of spread) for a single threshold are now shown. In this case the
threshold value is 3.
13
14
• The next step is to calculate the 'Within-Class Variance'. This is simply the sum of
the two variances multiplied by their associated weights.
• This final value is the 'sum of weighted variances' for the threshold value 3. This
same calculation needs to be performed for all the possible threshold values 0
to 5. The table below shows the results for these calculations. The highlighted
column shows the values for the threshold calculated above.
15
16
• It can be seen that for the threshold equal to 3, as well as being used for the
example, also has the lowest sum of weighted variances. Therefore, this is the
final selected threshold. All pixels with a level less than 3 are background, all
those with a level equal to or greater than 3 are foreground. As the images in
the table show, this threshold works well.
17
A Faster Approach
• By a bit of manipulation, you can calculate what is called the between
class variance, which is far quicker to calculate. Luckily, the threshold with the
maximum between class variance also has the minimum within class variance.
So it can also be used for finding the best threshold and therefore due to being
simpler is a much better approach to use.
18
A Faster Approach
• The table below shows the different variances for each threshold
value.
Within Class
σ2W = 3.1196 σ2W = 1.5268 σ2W = 0.5561 σ2W = 0.4909 σ2W = 0.9779 σ2W = 2.2491
Variance
Between Class
σ2 B = 0 σ2B = 1.5928 σ2B = 2.5635 σ2B = 2.6287 σ2B = 2.1417 σ2B = 0.8705
Variance
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Homework:
• Read (rice.jpeg) in matlab image data
• Find threshold
• Convert to BW image
• Count the number of rice
• Remove small regions (noise region)
• Labelling for each region
• Show the color of regions
• Bounding box each region 55
Thank you for
your listening
Q&A
56