1 of 17 thresholding thresholding is usually the first step in any segmentation approach we have...

Post on 22-Dec-2015

247 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1of17

Thresholding

Thresholding is usually the first step in any segmentation approach

We have talked about simple single value thresholding already

Single value thresholding can be given mathematically as follows:

Tyxfif

Tyxfifyxg

),( 0

),( 1),(

2of17

Thresholding Example

Imagine a poker playing robot that needs to visually interpret the cards in its hand

Original Image Thresholded Image

3of17

But Be Careful

If you get the threshold wrong the results can be disastrous

Threshold Too Low Threshold Too High

4of17

Basic Global Thresholding

Based on the histogram of an image

Partition the image histogram using a single global threshold

The success of this technique very strongly depends on how well the histogram can be partitioned

5of17

Basic Global Thresholding Algorithm

The basic global threshold, T, is calculated

as follows:1. Select an initial estimate for T (typically the

average grey level in the image)

2. Segment the image using T to produce two groups of pixels: G1 consisting of pixels with grey levels >T and G2 consisting pixels with grey levels ≤ T

3. Compute the average grey levels of pixels in G1 to give μ1 and G2 to give μ2

6of17

Basic Global Thresholding Algorithm

4. Compute a new threshold value:

5. Repeat steps 2 – 4 until the difference in T in successive iterations is less than a predefined limit T∞

This algorithm works very well for finding thresholds when the histogram is suitable

221

T

7of17

Thresholding Example 1Im

ag

es

take

n f

rom

Go

nza

lez

& W

oo

ds,

Dig

ital I

ma

ge

Pro

cess

ing

(2

00

2)

8of17

Thresholding Example 2Im

ag

es

take

n f

rom

Go

nza

lez

& W

oo

ds,

Dig

ital I

ma

ge

Pro

cess

ing

(2

00

2)

9of17

Problems With Single Value Thresholding

Single value thresholding only works for bimodal histograms

Images with other kinds of histograms need more than a single threshold

Ima

ge

s ta

ken

fro

m G

on

zale

z &

Wo

od

s, D

igita

l Im

ag

e P

roce

ssin

g (

20

02

)

10of17

Problems With Single Value Thresholding (cont…)

Let’s say we want to isolate the contents of the bottles

Think about what the histogram for this image would look like

What would happen if we used a single threshold value?

Ima

ge

s ta

ken

fro

m G

on

zale

z &

Wo

od

s, D

igita

l Im

ag

e P

roce

ssin

g (

20

02

)

11of17

Single Value Thresholding and Illumination

Uneven illumination can really upset a single valued thresholding schemeIm

ag

es

take

n f

rom

Go

nza

lez

& W

oo

ds,

Dig

ital I

ma

ge

Pro

cess

ing

(2

00

2)

12of17

Basic Adaptive Thresholding

An approach to handling situations in which single value thresholding will not work is to divide an image into sub images and threshold these individually

Since the threshold for each pixel depends on its location within an image this technique is said to adaptive

13of17

4

4

4

4

5

5

4

4

4

10

5

5

10 11 5

3

3

9

9

9

1 1 2 2 3

1 1 2 2 8

1 1 2 7 8

1 1 6 7 8

1 5 6 7 8

10

11

11

10

5

5

4 11 5

10 11 5

9

3

3

91 5 6 7 8

1 5 6 7 3

1 5 6 2 3

1 5 2 2 3

5

5

5

5

5

5

5

5

5

4 4 531 1 2 2 3 5

0

0

0

0

1

1

0

0

0

1

1

1

1 1 1

0

0

1

1

1

0 0 0 0 0

0 0 0 0 1

0 0 0 1 1

0 0 1 1 1

0 1 1 1 1

1

1

1

1

1

1

0 1 1

1 1 1

1

0

0

10 1 1 1 1

0 1 1 1 0

0 1 1 0 0

0 1 0 0 0

1

1

1

1

1

1

1

1

1

0 0 100 0 0 0 0 1

0

0

0

0

0

0

0

0

0

1

0

0

1 1 0

0

0

1

1

1

0 0 0 0 0

0 0 0 0 1

0 0 0 1 1

0 0 1 1 1

0 0 1 1 1

1

1

1

1

0

0

0 1 0

1 1 0

1

0

0

10 0 1 1 1

0 0 1 1 0

0 0 1 0 0

0 0 0 0 0

0

0

0

0

0

0

0

0

0

0 0 000 0 0 0 0 0

Thresholding T = 4.5

Thresholding T = 5.5

true object boundary

14of17

1 1 2 2 3

1 1 2 2 8

1 1 2 7 8

1 1 6 7 8

1 5 6 7 8

4

4

4

4

5

5

4

4

4

10

5

5

10 11 5

3

3

9

9

9

5

5

5

5

5

1 5 6 7 8

1 5 6 7 3

1 5 6 2 3

1 5 2 2 3

1 1 2 2 3

10

11

11

10

5

5

4 11 5

10 11 5

9

3

3

9

5

5

5

5

4 4 53 5

4

4

4

4

5

5

4

4

4

10

5

5

10 11 5

3

3

9

9

9

1 1 2 2 3

1 1 2 2 8

1 1 2 7 8

1 1 6 7 8

1 5 6 7 8

10

11

11

10

5

5

4 11 5

10 11 5

9

3

3

91 5 6 7 8

1 5 6 7 3

1 5 6 2 3

1 5 2 2 3

5

5

5

5

5

5

5

5

5

4 4 531 1 2 2 3 5

Split

– Spatially adaptive thresholding– Localized processing

15of17

1 1 2 2 3

1 1 2 2 8

1 1 2 7 8

1 1 6 7 8

1 5 6 7 8

4

4

4

4

5

5

4

4

4

10

5

5

10 11 5

3

3

9

9

9

5

5

5

5

5

1 5 6 7 8

1 5 6 7 3

1 5 6 2 3

1 5 2 2 3

1 1 2 2 3

10

11

11

10

5

5

4 11 5

10 11 5

9

3

3

9

5

5

5

5

4 4 53 5

0 0 0 0 0

0 0 0 0 1

0 0 0 1 1

0 0 1 1 1

0 1 1 1 1

0

0

0

0

0

0

0

0

0

1

0

0

1 1 0

0

0

1

1

1

0

0

0

0

0

0 1 1 1 1

0 1 1 1 0

0 1 1 0 0

0 1 0 0 0

0 0 0 0 0

1

1

1

1

0

0

0 1 0

1 1 0

1

0

0

1

0

0

0

0

0 0 00 0

Thresholding T = 4

Thresholding T = 7

Thresholding T = 4

Thresholding T = 7

spatially adaptive threshold selection

16of17

Thresholding Method

0

0

0

0

0

0

0

0

0

1

0

0

1 1 0

0

0

1

1

1

0 0 0 0 0

0 0 0 0 1

0 0 0 1 1

0 0 1 1 1

0 1 1 1 1

1

1

1

1

0

0

0 1 0

1 1 0

1

0

0

10 1 1 1 1

0 1 1 1 0

0 1 1 0 0

0 1 0 0 0

0

0

0

0

0

0

0

0

0

0 0 000 0 0 0 0 0

0 0 0 0 0

0 0 0 0 1

0 0 0 1 1

0 0 1 1 1

0 1 1 1 1

0

0

0

0

0

0

0

0

0

1

0

0

1 1 0

0

0

1

1

1

0

0

0

0

0

merge merge

merge merge

merge local segmentation results

0 1 1 1 1

0 1 1 1 0

0 1 1 0 0

0 1 0 0 0

0 0 0 0 0

1

1

1

1

0

0

0 1 0

1 1 0

1

0

0

1

0

0

0

0

0 0 00 0

17of17

Basic Adaptive Thresholding Example

The image below shows an example of using adaptive thresholding with the image shown previously

As can be seen success is mixed

But, we can further subdivide the troublesome sub images for more success

18of17

Basic Adaptive Thresholding Example (cont…)

These images show the troublesome parts of the previous problem further subdivided

After this sub division successful thresholding can be achieved

19of17

Region-Based Image Segmentation

Region Growing

Split and Merge

20of17

In mathematical sense the segmentation of the image I, which is a set of pixels, is the partition of I into n disjoint sets R1,R2, . . . , Rn, called segments or regions such that their union of all regions equals I. 

I =R1 U R2 U….. U Rn

21of17

22of17

23of17

Region Growing Region growing is a procedure that groups pixels or subregions

into larger regions. The simplest of these approaches is pixel aggregation, which

starts with a set of “seed” points and from these grows regions by appending to each seed points those neighboring pixels that have similar properties (such as gray level, texture, color, shape).

Region growing based techniques are better than the edge-based techniques in noisy images where edges are difficult to detect.

24of17

Region Splitting Region growing starts from a set of seed points. An alternative is to start with the whole image as a single region

and subdivide the regions that do not satisfy a condition of homogeneity.

Region Merging Region merging is the opposite of region splitting. Start with small regions (e.g. 2x2 or 4x4 regions) and merge the

regions that have similar characteristics (such as gray level, variance).

Typically, splitting and merging approaches are used iteratively.

25of17

Bahadir K. Gunturk EE 7730 - Image Analysis I

25

Region-Oriented Segmentation

top related