digital image processing chapter 10: image segmentation 13 july 2005

106
Digital Image Processing Chapter 10: Image Segmentation 13 July 2005

Upload: amy-daugherty

Post on 03-Jan-2016

265 views

Category:

Documents


17 download

DESCRIPTION

Digital Image Processing Chapter 10: Image Segmentation 13 July 2005. Element of Image Analysis. ISAN-DSP GROUP. Preprocess Image acquisition, restoration, and enhancement. Intermediate process Image segmentation and feature extraction. High level process - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Digital Image ProcessingChapter 10:

Image Segmentation13 July 2005

Digital Image ProcessingChapter 10:

Image Segmentation13 July 2005

Page 2: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

PreprocessImage acquisition, restoration, and enhancement

Intermediate processImage segmentation and feature extraction

High level processImage interpretation and recognition

ISAN-DSP GROUP

Element of Image Analysis Element of Image Analysis

Page 3: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Image segmentation is used to separate an image into constituentparts based on some image attributes. Image segmentation is an important step in image analysis

Benefit1. Image segmentation reduces huge amount of unnecessary

data while retaining only importance data for image analysis 2. Image segmentation converts bitmap data into better

structured data which is easier to be interpreted

Importance of Image Segmentation Importance of Image Segmentation

Page 4: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

1. Similarity properties of pixels inside the object are used to grouppixels into the same set.

2. Discontinuity of pixel properties at the boundary between objectand background is used to distinguish between pixels belonging to the object and those of background.

Discontinuity:Intensity change

at boundary

Similarity:Internal

pixels sharethe same intensity

Image Attributes for Image Segmentation Image Attributes for Image Segmentation

Page 5: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Spatial Filtering Application to Shape Detection Spatial Filtering Application to Shape Detection

One application of spatial filtering is shape detection: findinglocations of objects with the desired shape.

Unlike frequency selective masks that are designed basedon the concept of frequency, shape detection masks arederived from the shapes to be detected themselves.

A mask for shape detection usually contains the shape or a partof the shape to be detected.

The location that is most correlated to the mask is the location where the highest filter response occurs. The shape is most likely to exist there.

Page 6: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Point Detection Point Detection

We can use Laplacian masksfor point detection.

Laplacian masks have the largest coefficient at the center of the maskwhile neighbor pixels have anopposite sign.

This mask will give the high response to the object that has the similar shape as the mask such as isolated points.

Notice that sum of all coefficients of the mask is equal to zero. This is due to the need that the response of the filter must be zero inside a constant intensity area

-1 -1

-1

8

-1

-1

-1

-1

-1

-1 0

0

4

-1

-1

0

-1

0

Page 7: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Point Detection Point Detection

X-ray image of the turbine blade with

porosity

Laplacian image After thresholding

Location of porosity

Point detection can be done by applying the thresholding function:

otherwise 0

),( 1),(

Tyxfyxg

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 8: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Line Detection Line Detection

Similar to point detection, line detection can be performedusing the mask the has the shape look similar to a part of a line

There are several directions that the line in a digital image can be.

For a simple line detection, 4 directions that are mostly used areHorizontal, +45 degree, vertical and –45 degree.

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Line detection masks

Page 9: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Line Detection Example Line Detection Example

Binary wirebond mask

image

Absolute valueof result after

processing with-45 line detector

Result after thresholding

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Notice that –45 degreelines are most sensitive

Page 10: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Edges Edges

Generally, objects and background have different intensities. Therefore,Edges of the objects are the areas where abrupt intensity changes occur.

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Ideal step edge Ideal ramp edge

Blurred edge

Page 11: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Ideal Ramp Edges and its Derivatives Ideal Ramp Edges and its Derivatives

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Original image

Edge

Page 12: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Gray level profile

The 1st derivative

-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5-0.20

0.20.40.60.8

11.2

-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5-0.06-0.04-0.02

00.020.040.06

-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5-5-4-3-2-1012345

x 10 -3

Edge Edge

Minimum point

Maximumpoint

+ +- -

Zero crossing

Inte

nsit

y

Smoothed Step Edge and Its Derivatives Smoothed Step Edge and Its Derivatives

The 2nd derivative

Page 13: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Derivative Based Edge Detection Derivative Based Edge Detection

From the previous slide, we can conclude that:Local maxima of the absolute of the 1st derivative and Zero crossing of the 2nd derivative occur at edges.

Therefore, for detecting edges, we can apply zero crossing detection to the 2nd derivative image or thresholding the absolute of the 1st derivative image.

Nevertheless, derivative operator is very sensitive to noise as wewill see in the next slide.

Page 14: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Noisy Edges and Derivatives Noisy Edges and Derivatives

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Derivative operator is a highpass filter and thus enhances noise.

Edge responses are buried by noise.

AWGN = 0.1

AWGN = 1.0

AWGN = 10

dx

df2

2

dx

fdf(x)

Page 15: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Masks for Estimating Partial Derivatives Masks for Estimating Partial Derivatives

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Normally, the mask for estimating partial derivative is anti-symmetry with respect to the orthogonal axis

x

f

For example, the Sobel mask for

computing is anti-symmetry

with respect to the y-axis. It has the positive sign on the right side and negative sign on the left side.

Notice that sum of all coefficients is equal to zero to make sure that the response of a constant intensity areais zero.

Page 16: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Masks for Detecting Diagonal Edges Masks for Detecting Diagonal Edges

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

The mask for detecting -45-degreeedges is anti-symmetry with respect to the –45-degree lines while the mask for detecting 45-degree edges is anti-symmetry with respect to the 45-degree lines.

Page 17: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Example of Image Gradient Example of Image Gradient

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

x

f

y

f

),( yxf

y

f

x

f

Page 18: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Example of Image Gradient Example of Image Gradient

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Note: the original image is smoothed by a 5x5 moving average mask first.

x

f

y

f

),( yxf

y

f

x

f

Page 19: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Example of Diagonal Edges Example of Diagonal Edges

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Note: the original image is smoothed by a 5x5 moving average mask first.

Using -45-degree mask Using 45-degree mask

Page 20: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Laplacian Masks Laplacian Masks

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

2

2

2

22

y

P

x

PP

The Laplacian masks are used to estimate the Laplacian image:

Ideally, the Laplacian mask must be directional invariant: symmetry inall direction (radially symmetry ). However, for 3x3 masks, there areOnly 8 possible directions. Hence, we can use the following masks:

Page 21: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Laplacian Masks Laplacian Masks

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

For a large scale Laplacian mask, we can use a Laplacian of Gaussian(LOG) as a mask:

2

22

2

4

2222 ),(

yx

eyx

yxG

Surface plot of LOG, Looks like a “Mexican hat” LOG image

Cross sectionof LOG

5x5 LOG mask

Page 22: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Example of Laplacian ImageExample of Laplacian Image

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

The angiogram image(blood vessels)

PWe can compute theLaplacian image by:

1. Smooth the imageby the Gaussian mask2. Compute the Laplacianimage using the mask

12

PG *2

Zero crossingThreshold ofThe left image

Page 23: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

เป็�นวิ�ธีการแยกองค์�ป็ระกอบของร�ป็ภาพโดยด�จากค์วิามเหม�อนก�นของค์ ณสมบ�ติ�ของพ�กเซลภายในพ�'นที่)เพยงอย*างเดยวิ เช่*นวิ�ธีการ Intensity Thresholding

0 50 100 150 200 250

0

100

200

300

400

500

T = 102

1 ( , ) ( , )

0 ( , )

f x y Tg x y

f x y T

ใช่,ได,ดก�บภาพที่)วิ�ติถุ ก�บฉากหล�งแยกก�นช่�ดเจน ส�งเกติได,จาก Histogram ของภาพเป็�นแบบ multimodal

After thresholding

สของแบค์ที่เรยสของฉากหล�ง

Pixel Oriented Image Segmentation: ThresholdingPixel Oriented Image Segmentation: Thresholding

Page 24: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Intensity Thresholding ExampleIntensity Thresholding Example

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 25: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Automatic Threshold Level Selection Automatic Threshold Level Selection The major problem of intensity thresholding is to find a good threshold level

Algorithm: effective for bimodal histogram

1. Set initial value of T

2.

3.

4.

5. Repeat step 2

)),(),((1 TyxpyxpAverageT

)),(),((2 TyxpyxpAverageT

221 TT

T

Page 26: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Automatic Threshold Level Selection Example Automatic Threshold Level Selection Example

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 27: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

ในบางกรณที่)มวิ�ติถุ ที่)มค์วิามเข,มติ*างก�นอาจจ0าเป็�นติ,องใช่, Threshold Level หลายค์*า

0 50 100 150 200 250

0

500

1000

1500 T1 = 158

T2 = 196

T3 = 228

Histogram

T1< P <T2 T2< P <T3 P > T3

Multilevel Intensity Thresholding Multilevel Intensity Thresholding

Page 28: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

0 50 100 150 200 250

0

50

100

150

200

250

เม�)อใช่,ก�บภาพที่)มส�ญญาณรบกวิน จะที่0าให,ได,ภาพที่)ไม*ติ*อเน�)อง

Image degraded byGaussian noise ( =12)

Histogram

T1 = 158

T2 = 196

T3 = 228

T1< P <T2 T2< P <T3 P > T3

peak ไม*ช่�ดเจน

Noise ProblemNoise Problem

Page 29: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Nonuniform Illumination ProblemNonuniform Illumination Problem

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

An image can be expressed as

),(),(),( yxryxiyxf

i(x,y) = illumination componentr(x,y) = reflectance component

Reflectance Function r(x,y)

Illumination Function i(x,y)

Histogram

Image histogram

f(x,y)

Page 30: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Nonuniform Illumination and Global ThresholdingNonuniform Illumination and Global Thresholding

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Global thresholding of nonuniform illumination image can cause hugeerrors!

Histogram

Global threshold level

Nonuniform illumination image

Global thresholding result

Page 31: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Nonuniform Illumination and Local ThresholdingNonuniform Illumination and Local Thresholding

Local thresholding:1. Divide an image into subimages.2. Threshold each subimage independently

2.1 Compute histogram of each subimage and select a suitable threshold value for each subimage2.2 threshold each subimage using a threshold value in 2.12.3 Combine all local thresholding results

16 subimages Result of local thresholding

Error

Page 32: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Histogram of Subimages and Local ThresholdingHistogram of Subimages and Local Thresholding

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

If areas of object and background are nearlyequal, a histogram will be bimodal

If areas of object and background are not balanced, a histogram will be unimodal.

Page 33: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

เม�)อใช่,ภาพที่)ค์วิามสวิ*างไม*เที่*าก�นติลอดภาพ จะที่0าให,ผลล�พธี�ผ�ดไป็อย*างมาก

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0

100

200

300

400

500

600

700

800

900

T=0.4

Error บร�เวิณขอบภาพISAN-DSP GROUP

Example of Nonuniform Illumination Problem Example of Nonuniform Illumination Problem

Page 34: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Optimum Thresholding Optimum Thresholding

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

p1(z) = PDF of object pixels p2(z) = PDF of background pixelsObject

Background

Error due to background pixelsclassified as object pixels is :

T

dzzpTE )()( 21

Error due to object pixels classified as background pixels is:

T

dzzpTE )()( 12

Total error = )()()( 2112 TEPTEPTE

P1 = Probability of occurrence of object pixelsP2 = Probability of occurrence of background pixels

Page 35: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Optimum Thresholding Optimum Thresholding

Page 36: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Optimum Thresholding Optimum Thresholding

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 37: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Optimum Thresholding Optimum Thresholding

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 38: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Pixel Oriented Image Segmentation for Color Images Pixel Oriented Image Segmentation for Color Images

RGB, CMY color models: Thresholding based on distance in the color space.

HSI color model: Thresholding based on H and S component mainly.

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 39: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Color Segmentation in HSI Color Space Color Segmentation in HSI Color Space

Hue

Saturation Intensity

Color image

1 2

3 4

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 40: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Color Segmentation in HSI Color Space (cont.) Color Segmentation in HSI Color Space (cont.)

Product of and

5 6

7 8

52Binary thresholding of S componentwith T = 10%

Histogram of 6 Segmentation of red color pixels

Red pixels

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 41: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Color Segmentation in HSI Color Space (cont.) Color Segmentation in HSI Color Space (cont.)

Color image Segmented results of red pixels

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 42: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Color Segmentation in RGB Vector Space Color Segmentation in RGB Vector Space

1. Each point with (R,G,B) coordinate in the vector space represents one color.2. Segmentation is based on distance thresholding in a vector space

TyxD

TyxDyxg

T

T

)),,(( if 0

)),,(( if 1),(

cc

cc

cT = color to be segmented.c(x,y) = RGB vector at pixel (x,y).D(u,v) = distance function

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 43: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Example: Segmentation in RGB Vector Space Example: Segmentation in RGB Vector Space

Color image

Results of segmentation inRGB vector space with Thresholdvalue

Reference color cT to be segmentedbox thein pixel ofcolor average Tc

T = 1.25 times the SD of R,G,B valuesIn the box

Page 44: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Color Image Segmentation ExampleColor Image Segmentation Example

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 45: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

0.2

0.4

0.6

0.8

10.2

0.4

0.6

0.8

10

0.5

1

RedGreen

Blu

e

Image Domainภาพถุ*ายเม�อง Munich จากอวิกาศ

Feature Space (RGB)

หล�กการของ pixel oriented image segmentation สามารถุน0าไป็ใช่,ก�บภาพแบบmultispectrum เช่*นภาพส ได, โดยการแบ*ง partition ใน Feature space หร�อการแยกองค์�ป็ระกอบติามสของพ�กเซลน�'นเอง

From www.jpl.nasa.gov/radar/sircxsar/munch.html

PartitionBoundary

Pixel Oriented Image Segmentation for Multispectral Images Pixel Oriented Image Segmentation for Multispectral Images

Page 46: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

เราสามารถุใช่, Self Organizing Map (SOM) ในการค์0านวิณหาสที่)เหมาะสมที่)จะใช่,ในการแยกองค์�ป็ระกอบติามสของพ�กเซลได,

ขั้��นตอนการหาสี�หลั�ก1. ก0าหนดจ0านวินสหล�กที่)จะใช่,แบ*ง 2. ก0าหนดค์*าเร�)มติ,นให,ก�บสหล�กที่ กส3. ส0าหร�บพ�กเซลแติ*ละพ�กเซล น0าค์*า (R,G,B) มาค์0านวิณหาระยะที่างระหวิ*างสหล�กที่ กส ก�บสของพ�กเซลที่)ได,4. หาสหล�กที่)ระยะที่างในข,อ 3 ติ0)าที่)ส ด (สหล�กที่)ช่นะ) สหล�กที่)ได,จะเป็�นสที่)ใกล,เค์ยงก�บสของพ�กเซลมากที่)ส ด ที่0าการป็ร�บค์*าสของสหล�กสน�'นในที่�ศที่างเข,าส�*สของพ�กเซล5. กล�บไป็ที่0าข,อ 3-4 จนกระที่�)งค์*าสของสหล�กไม*เป็ล)ยนแป็ลงมาก

ขั้��นตอนการแยกองค์�ประกอบ1. ส0าหร�บพ�กเซลแติ*ละพ�กเซล น0าค์*า (R,G,B) มาค์0านวิณหาระยะที่างระหวิ*างสหล�กที่ กส ก�บสของพ�กเซลที่)ได,2. หาสหล�กที่)ระยะที่างในข,อ 1 ติ0)าที่)ส ด (สหล�กที่)ช่นะ) จ�ดให,พ�กเซลน�'นอย�*ในกล *มของสหล�กที่)ช่นะ

Self Organizing Map for Color Image SegmentationSelf Organizing Map for Color Image Segmentation

Page 47: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

ภาพเม�อง Munich ป็ระกอบด,วิยสขาวิ พ�'นที่)ส�)งก*อสร,างในเม�อง สม*วิง พ�'นที่)ป็4าที่5บ สเขยวิแก* พ�'นที่)การเกษติรหนาแน*น สด0า พ�'นที่)แหล*งน0'าสผสม พ�'นที่)การเกษติรเบาบาง

ผลของการแยกองค์�ป็ระกอบติามสของร�ป็ภาพโดยใช่, SOM

ISAN-DSP GROUP

Self Organizing Map for Color Image SegmentationSelf Organizing Map for Color Image Segmentation

Page 48: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

ข,อดเน�)องจากวิ�ธีการน'ใช่,ข,อม�ลของค์ ณสมบ�ติ�ของพ�กเซลเพยงอย*างเดยวิ

ที่0าให,ไม*ติ,องมการค์0านวิณมาก และใช่,เวิลารวิดเร7วิ

ข,อเสยไม*สามารถุใช่,ก�บภาพที่)มส�ญญาณรบกวิน และภาพที่)มค์วิามสวิ*าง

ไม*ค์งที่) และผลล�พธี�ม�กได,ภาพที่)ไม*ติ*อเน�)อง

ISAN-DSP GROUP

Advantages and Disadvantage of Pixel Oriented Image SegmentationAdvantages and Disadvantage of Pixel Oriented Image Segmentation

Page 49: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

เป็�นวิ�ธีการแยกองค์�ป็ระกอบของภาพโดยด�จากติ0าแหน*งของพ�กเซลและค์วิามเหม�อนก�นของค์ ณสมบ�ติ�ของพ�กเซลภายในพ�'นที่) โดยถุ,าพ�กเซลที่)อย�*ติ�ดก�นและมค์ ณสมบ�ติ�เหม�อนก�นจะถุ�กจ�ดให,เข,ากล *มเดยวิก�น ข,อดของการที่0าเช่*นน'จะได,พ�'นที่)ที่)ติ*อเน�)องติ�วิอย*างวิ�ธีการ Region oriented image segmentation

1. Region Growing

2. Region Splitting and Merging

P

Pixel P and its neighbors

Connectedpixels

Region Oriented Image SegmentationRegion Oriented Image Segmentation

Page 50: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

เร�)มจาก seed pixel ที่0าการรวิมกล *มพ�กเซลข,างเค์ยงที่)มค์ ณสมบ�ติ�เหม�อนก�นให,พ�'นที่)โติข5'นเร�)อยๆ

พ�'นที่)เร�)มขยายติ�วิ

การที่0างานจะหย ดเม�)อไม*สามารถุขยายพ�'นที่)ออกไป็ได,มากกวิ*าน' (เม�)อช่นก�บขอบของวิ�ติถุ )

ISAN-DSP GROUP

Region Growing AlgorithmRegion Growing Algorithm

Page 51: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

ติ�วิอย*าง Region growing โดยใช่,กฏการรวิมก�น ถุ,าพ�กเซลข,างเค์ยงมค์*าค์วิามเข,มของแสงติ*างก�บพ�กเซลป็:จจ บ�นไม*เก�น 4 ให,จ�ดอย�*ในกล *มเดยวิก�นเร�)มติ,น

จากภายใน

ส�'นส ดที่)ขอบ

ISAN-DSP GROUP

Region Growing Image Segmentation ExampleRegion Growing Image Segmentation Example

Page 52: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Region Growing Image Segmentation ExampleRegion Growing Image Segmentation Example

X-ray image of defective weld

Histogram

Page 53: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Region Growing Image Segmentation ExampleRegion Growing Image Segmentation Example

Page 54: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

1. Region Splitting1. แบ*งภาพติ�'งติ,นออกเป็�นภาพย*อยๆ2. ส0าหร�บภาพย*อยแติ*ละภาพ ถุ,าพ�กเซลของพ�'นที่)ภายในย�งไม*มค์ ณสมบ�ติ�เป็�นหน5)งเดยวิก�นให,แบ*งติ*อไป็เร�)อยๆ

ขบวินการน'ม 2 ข�'นติอนค์�อ1. แบ*งภาพเป็�นภาพย*อยที่) แติ*ละภาพย*อยมพ�กเซลภายในที่)ค์ ณสมบ�ติ� uniform2. รวิมภาพที่)แบ*งได,เข,าเป็�นกล *มติามค์วิามเหม�อนก�นของค์ ณสมบ�ติ�ของพ�กเซล

ISAN-DSP GROUP

Region Splitting and Merging AlgorithmRegion Splitting and Merging Algorithm

Page 55: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Quadtree for Region Splitting RepresentationQuadtree for Region Splitting Representation

Page 56: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Region Splitting

ISAN-DSP GROUP

Region Splitting AlgorithmRegion Splitting Algorithm

Page 57: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

ภาพติ�'งติ,น

ผลของการที่0า Region Spliting โดยให, standard deviation ของพ�กเซลในภาพย*อยไม*เก�น 5

ISAN-DSP GROUP

Region Splitting ExampleRegion Splitting Example

Page 58: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

2. Merging น0าภาพย*อยที่)แบ*งได,ที่�'งหมดที่)มพ�กเซลภายในที่)ค์ ณสมบ�ติ�เหม�อนก�นมารวิมก�น

ISAN-DSP GROUP

Region Merging AlgorithmRegion Merging Algorithm

Page 59: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

ภาพติ�'งติ,น

ผลของการที่0า Region Merging โดยให,ค์*าเฉล)ยของพ�กเซลในภาพย*อยที่)จะรวิมก�นติ*างก�นไม*เก�น 50

ISAN-DSP GROUP

Region Merging ExampleRegion Merging Example

Page 60: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Region Splitting and Merging ExampleRegion Splitting and Merging Example

Page 61: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

ป�ญหาอ�ปสีรรค์ขั้องวิ�ธี�การ Region Growing

1. การก0าหนดกฎเกณฑ์�ที่)เหมาะสมที่)ใช่,ติรวิจสอบวิ*าพ�กเซลน�'น “มค์ ณสมบ�ติ�เหม�อนก�น”เพ�)อใช่,ในการรวิมกล *มเข,าด,วิยก�น2. การก0าหนด seed pixel มค์วิามส0าค์�ญมาก ติ,องก0าหนดไวิ,ภายในพ�'นที่)ที่)จะที่0าการแยกองค์�ป็ระกอบ3. การก0าหนดกฎเกณฑ์�ที่)เหมาะสมในการให,โป็รแกรมหย ดการที่0างานเม�)อพ�'นที่)ขยายไป็ถุ5งขอบของวิ�ติถุ

ป�ญหาอ�ปสีรรค์ขั้องวิ�ธี�การ Region Splitting and Merging

1. การก0าหนดกฎเกณฑ์�ที่)เหมาะสมที่)ใช่,ติรวิจสอบวิ*าพ�กเซลที่�'งหมดในภาพย*อยแติ*ละภาพมค์ ณสมบ�ติ�เป็�นหน5)งเดยวิก�นหร�อไม*2. ติ,องการโค์รงสร,างข,อม�ลที่)ซ�บซ,อนในการจ�ดการก�บภาพย*อยที่)แบ*งได,

ISAN-DSP GROUP

Obstacle of Region Oriented Image SegmentationObstacle of Region Oriented Image Segmentation

Page 62: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

เป็�นวิ�ธีการแยกองค์�ป็ระกอบของภาพอาศ�ยค์วิามไม*ติ*อเน�)อง (Discontinuity) ของค์ ณสมบ�ติ�ของพ�กเซลบร�เวิณรอยติ*อระหวิ*างวิ�ติถุ ก�บฉากหล�ง วิ�ธีการน'ม *งที่)ขอบของวิ�ติถุ เป็�นหล�กผลล�พธี�ที่)ได,จากวิ�ธีการน'จะอย�*ในร�ป็เส,นพรมแดนระหวิ*างพ�'นที่)ติ*างๆ

ค์วิามไม*ติ*อเน�)องของสบร�เวิณรอยติ*อ

ISAN-DSP GROUP

Edge Oriented Image SegmentationEdge Oriented Image Segmentation

Page 63: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Gray level profile

The 1st derivative

-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5-0.20

0.20.40.60.8

11.2

-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5-0.06-0.04-0.02

00.020.040.06

-1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5-5-4-3-2-1012345

x 10 -3

Edge Edge

Minimum point

Maximumpoint

+ +- -

Zero crossing

Inte

nsit

y

Smoothed Step Edge and Its Derivatives Smoothed Step Edge and Its Derivatives

The 2nd derivative

Page 64: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Derivative Based Edge Detection Derivative Based Edge Detection

From the previous slide, we can conclude that:Local maxima of the absolute of the 1st derivative and Zero crossing of the 2nd derivative occur at edges.

Therefore, for detecting edges, we can apply zero crossing detection to the 2nd derivative image or thresholding the absolute of the 1st derivative image.

Nevertheless, derivative operator is very sensitive to noise as wewill see in the next slide.

Page 65: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Masks for Estimating Partial Derivatives Masks for Estimating Partial Derivatives

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Normally, the mask for estimating partial derivative is anti-symmetry with respect to the orthogonal axis

x

f

For example, the Sobel mask for

computing is anti-symmetry

with respect to the y-axis. It has the positive sign on the right side and negative sign on the left side.

Notice that sum of all coefficients is equal to zero to make sure that the response of a constant intensity areais zero.

Page 66: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Operator ที่)เก)ยวิข,องก�บอน พ�นธี�อ�นด�บ 1 ของภาพ 2 ม�ติ� ค์�อ Gradient Operator ( )ซ5)งสามารถุใช่,ในการติรวิจจ�บขอบได,

ˆ ˆP PP i j

x y

22P P

Px y

ภาพติ�'งติ,น P P

Gradient Magnitude

P

x

P

y

Gradient ImageGradient Image

Page 67: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

พ�'นผ�วิของ P บร�เวิณขอบมล�กษณะเหม�อนส�นเขา ติ0าแหน*งของขอบค์�อส�นเขา

PGradientVectorField

ภาพติ�'งติ,น

P

Gradient เป็�นป็ร�มาณแบบVector ที่)บอกถุ5งขนาดและที่�ศที่างของขอบของวิ�ติถุ

Gradient Vector FieldGradient Vector Field

Page 68: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

ภาพติ�'งติ,น

P|

Thresholding

Edge map

T=60 T=100ใช่, T มค์*าติ0)าไป็จะได,ขอบที่)หนา

ใช่, T มค์*าส�งไป็จะได,ขอบที่)ขาดบร�เวิณม ม

P

Gradient Based Image SegmentationGradient Based Image Segmentation

Page 69: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Operator ที่)เก)ยวิข,องก�บอน พ�นธี�อ�นด�บ 2 ของภาพ 2 ม�ติ� ค์�อ Gradient Operator ( )ซ5)งสามารถุใช่,ในการติรวิจจ�บขอบได,2 2

22 2

P PP

x y

ภาพติ�'งติ,น P 2P2

2

P

x

2

2

P

y

Laplacian ImageLaplacian Image

Page 70: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

2P

พ�'นผ�วิของ2P

เค์ร�)องหมายของ เป็�นลบภายนอกวิ�ติถุ

ภาพติ�'งติ,น P

เค์ร�)องหมายของ เป็�นบวิกภายในวิ�ติถุ

2P2P

Laplacian ImageLaplacian Image

Page 71: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

ภาพติ�'งติ,น

P

ZeroCrossingDetection

Edge map

Laplacianขยายส�ญญาณรบกวินให,ช่�ดเจนข5'น

2P

Zero crossingDetection ที่0าได,โดยที่0า thresholdingก�บ โดยใช่, T=02P

ISAN-DSP GROUP

Laplacian Based Image SegmentationLaplacian Based Image Segmentation

Page 72: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Gradient

P

Laplacian

P

ผลติอบสนองติ*อขอบแบบข�'น(step edge) ของวิ�ติถุ

Local Extremaof |P|

Zero Crossing

ค์วิามส0าค์�ญ บอกถุ5งที่�ศที่างและขนาดของขอบของวิ�ติถุ

บอกถุ5งติ0าแหน*งของขอบของวิ�ติถุ

การติรวิจจ�บขอบ Thresholding

|P|

Zero Crossing Detection

จ ดอ*อน ผลล�พธี�ม�กได, edge map ที่)ไม*สมบ�รณ�

ม�กไม*ที่นที่านติ*อส�ญญาณรบกวิน

ISAN-DSP GROUP

Gradient VS LaplacianGradient VS Laplacian

Page 73: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Gradient field Tangential velocity field

ˆ ˆP PP i j

x y

ˆ ˆP P

P i jy x

Gradient Vector Field Edge Vector Field(Hamiltonian Gradient Field)

Boundary ExtractionBoundary Extraction Based on Particle motion in a Vector Field Based on Particle motion in a Vector Field

Page 74: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Tangential velocity field

Tangential velocity field

ˆ ˆP PP i j

y x

Edge vector fieldมล�กษณะเหม�อนกระแสน0'าไหลวินรอบวิ�ติถุ

ISAN-DSP GROUP

Edge Vector FieldEdge Vector Field

Page 75: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

1 1k k kp p e

kp

ติ0าแหน*งป็:จจ บ�นของอน ภาค์ที่)เวิลา k

1kp ติ0าแหน*งในอดติของอน ภาค์ที่)เวิลา k-1

1ke

edge vector field ณ ติ0าแหน*ง ที่) 1kp

ติ0าแหน*งของอน ภาค์ค์0านวิณได,จากTangential velocity field

ติ0าแหน*งเร�)มติ,นของอน ภาค์ผลล�พธี�: ใน edge vector field อน ภาค์โค์จรรอบวิ�ติถุ มระยะห*างจากวิ�ติถุ ไกลข5'นเร�)อยๆ จนเก�ดที่างเด�นร�ป็ก,นหอย (spiral trajectory)

ค์*าค์งที่) > 0

Particle Trajectory in an Edge Vector FieldParticle Trajectory in an Edge Vector Field

Page 76: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

P0

ภาพติ�'งติ,น P

Edge vector field ที่างเด�นของอน ภาค์

Example: Particle Trajectory in an Edge Vector FieldExample: Particle Trajectory in an Edge Vector Field

Page 77: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Gradient field Sign of Laplacian image Normal compressive velocity field

n

2PP

เพ�)อที่)จะที่0าให,อน ภาค์เค์ล�)อนที่)ไป็ติามขอบของวิ�ติถุ โดยไม*หล ดไป็จากขอบของวิ�ติถุ เราติ,องการ vector field อกสนามที่)มค์ ณสมบ�ติ� “บบอ�ด” (normal compressive) เพ�)อบ�งค์�บให,อน ภาค์เด�นติามขอบ

ติ�วิอย*าง Normal Compressive Field21

n P Pc

A Normal Compressive Vector FieldA Normal Compressive Vector Field

Page 78: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Normal compressive velocity field

21n P P

c

ISAN-DSP GROUP

Example: A Normal Compressive Vector FieldExample: A Normal Compressive Vector Field

Page 79: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

v e n

t + n

มล�กษณะล�*เข,าส�*ขอบและไหลวินรอบวิ�ติถุ v

ISAN-DSP GROUP

Combined Vector FieldCombined Vector Field

Page 80: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

t + n 1 1 1k k k kp p e n

ติ0าแหน*งของอน ภาค์

ติ0าแหน*งเร�)มติ,นของอน ภาค์

อน ภาค์โค์จรรอบวิ�ติถุ ติามเส,นที่างเดยวิ

เราสามารถุแกะรอยเส,นขอบของวิ�ติถุ ได,จากที่างเด�นของอน ภาค์

Particle Trajectory in a Combined Vector FieldParticle Trajectory in a Combined Vector Field

Page 81: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

P0

Edge vector field 21n P P

c

1 1 1k k k kp p e n

Particle trajectory

Shape distortion at a corner

Example: Example: Particle Trajectory in a Combined Vector FieldParticle Trajectory in a Combined Vector Field

Page 82: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

ถุ,าให,อน ภาค์เด�นไป็ในที่�ศที่างเดยวิจะมโอกาสได,เส,นขอบที่)ไม*สมบ�รณ�

2-way boundary extraction1-way boundary extraction

ISAN-DSP GROUP

Boundary Extraction of Multiple ObjectsBoundary Extraction of Multiple Objects

Page 83: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

1. เล�อก Mask ที่)เหมาะสมในการค์0านวิณ Gradient และ Laplacian ของภาพ2. ค์0านวิณ edge vector field และ normal compressive vector field

3. ก0าหนดติ0าแหน*งเร�)มติ,นให,อน ภาค์ ณ ติ0าแหน*ง Local maxima ของGradient magnitude image4. แกะรอยเส,นขอบติามที่างเด�นของอน ภาค์5. หย ดการที่0างานเม�)ออน ภาค์เด�นกล�บมาที่)จ ดเร�)มติ,นหร�อพบก�บเส,นขอบที่)เค์ยผ*านมาแล,วิ

ISAN-DSP GROUP

Boundary Extraction Algorithm Based on ParticleBoundary Extraction Algorithm Based on ParticleMotion in a Vector FieldMotion in a Vector Field

Page 84: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Obtained using multiple scale Gaussian differential masks with min = 0.5, max = 2.0)

ISAN-DSP GROUPภาพจาก The whole brain atlas, www.med.harvard.edu/AANLIB/home.html

Boundary Extraction ExampleBoundary Extraction Example

Page 85: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Original X-ray image Gradient image

Boundary extraction results (=1.0)

Boundary Extraction Example: Flaw DetectionBoundary Extraction Example: Flaw Detection

Flaws

Page 86: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

1=0.5 2=4.77 3=18.81

Gradient images and extracted boundaries

Multiscale Boundary ExtractionMultiscale Boundary Extraction

Page 87: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Image segmentation ที่)มป็ระส�ที่ธี�ภาพ จะติ,องมค์ ณสมบ�ติ�ส0าค์�ญด�งน'1. มขบวินการป็ร�บป็ร งภาพที่)ดเพ�)อที่0าให,ภาพง*ายติ*อการแยกองค์�ป็ระกอบ2. ใช่,ข,อม�ลส0าค์�ญให,เป็�นป็ระโยช่น� 2.1 ค์ ณสมบ�ติ�ที่)เหม�อนก�นของพ�กเซลภายในพ�'นที่)เดยวิก�น 2.2 ค์ ณสมบ�ติ�ที่)แติกติ*างก�นของพ�กเซลในพ�'นที่)ที่)ติ*างก�น 2.3 ติ0าแหน*งของพ�กเซล และการเช่�)อมติ*อก�น 2.4 ติ0าแหน*ง ขนาด ที่�ศที่างของรอยติ*อระหวิ*างพ�'นที่) 2.5 สมม ติ�ฐานเบ�'องติ,นที่)จ0าเป็�น (ค์วิามร� ,ช่� 'นส�ง)

3. มโค์รงสร,างข,อม�ลที่)สามารถุรองร�บวิ�ธีการแยกองค์�ป็ระกอบภาพได,4. ติ,องการ user defined parameters น,อยที่)ส ดเที่*าที่)จ0าเป็�น

ISAN-DSP GROUP

ConclusionsConclusions

Page 88: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 89: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 90: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 91: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 92: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 93: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 94: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 95: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 96: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Page 97: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005

Edge LinkingEdge Linking

Page 98: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005
Page 99: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005
Page 100: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005
Page 101: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005
Page 102: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005
Page 103: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005
Page 104: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005
Page 105: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005
Page 106: Digital Image Processing Chapter 10:  Image Segmentation 13 July 2005