Image Processing

32
Image Processing Image Processing Segmentation Segmentation 1. 1. Process of partitioning a digital Process of partitioning a digital image into multiple segments (sets image into multiple segments (sets of pixels). of pixels). 2. Clustering pixels into salient image regions, i.e., regions corresponding to individual surfaces, objects, or natural parts of objects.

description

Image Processing. Segmentation Process of partitioning a digital image into multiple segments (sets of pixels). 2. Clustering pixels into salient image regions, i.e., regions corresponding to individual surfaces, objects, or natural parts of objects. Image Processing. Segmentation - PowerPoint PPT Presentation

Transcript of Image Processing

Page 1: Image Processing

Image ProcessingImage Processing

SegmentationSegmentation

1.1. Process of partitioning a digital Process of partitioning a digital image into multiple segments (sets image into multiple segments (sets of pixels).of pixels).

2. Clustering pixels into salient image regions, i.e., regions corresponding to individual surfaces, objects, or natural parts of objects.

Page 2: Image Processing

Image ProcessingImage Processing

SegmentationSegmentation3.3. Used to locate objects and Used to locate objects and

boundaries (lines, curves, etc.) in boundaries (lines, curves, etc.) in images. images.

4.4. Process of assigning a label to every Process of assigning a label to every pixel in an image such that pixels pixel in an image such that pixels with the same label share certain with the same label share certain visual characteristics.visual characteristics.

Page 3: Image Processing

Image ProcessingImage Processing

SegmentationSegmentation

Two of the most common techniques: Two of the most common techniques:

thresholdingthresholding and and

edgeedge findingfinding

Page 4: Image Processing

Image ProcessingImage Processing

SegmentationSegmentationTwo of the most common techniques: Two of the most common techniques:

thresholdingthresholdingedgeedge findingfinding

Page 5: Image Processing

Image ProcessingImage Processing

B. Detection of discontinuities B. Detection of discontinuities

The objects in image:

Three basic types of gray-level discontinuities in a digital image:

points,lines.edges.

The original image:

Page 6: Image Processing

Image ProcessingImage Processing

The common way The common way run a mask through the image

R = f(x-1, y-1) * M1 + f(x, y-1) * M2 + f(x+1, y-1) * M3

+ f(x-1, y) * M4 + f(x, y) * M5 + f(x+1, y) * M6

+ f(x-1, y+1)* M7 + f(x, y+1)* M8 + f(x+1, y+1)* M9

Page 7: Image Processing

Image ProcessingImage Processing

The common way The common way

run a mask through the image

R = f(x-1, y-1) * M1 + f(x, y-1) * M2 + f(x+1, y-1) * M3

+ f(x-1, y) * M4 + f(x, y) * M5 + f(x+1, y) * M6

+ f(x-1, y+1)* M7 + f(x, y+1)* M8 + f(x+1, y+1)* M9

Select some threshold . If |R(x,y)| then (x,y) to belong to object (background).

Page 8: Image Processing

Image ProcessingImage Processing

ExampleExample

a) b)

Original and segmented images:

a) Mask H8

b) Threshold = 2

If R(x,y) 2 Then g(x,y) = 1

Else g(x,y) = 0

H8=

Page 9: Image Processing

Image ProcessingImage Processing

Line detectionLine detection

A masks are usualy used for detection of isolated points in an image are:

Page 10: Image Processing

Image ProcessingImage Processing

Example of line detectionExample of line detection

The original I image and segmented image Io with horizotal mask

Page 11: Image Processing

Image ProcessingImage Processing

Example of line detectionExample of line detection

The original I image and segmented image I45 with 45o mask

Page 12: Image Processing

Image ProcessingImage Processing

Example of line detectionExample of line detection

The original I image and segmented image Iv with vertical mask

Page 13: Image Processing

Image ProcessingImage Processing

Example of line detectionExample of line detection

The original I image and segmented image I135 with 135o mask

Page 14: Image Processing

Image ProcessingImage Processing

Example of line detectionExample of line detection

The original I image and segmented image I8 with H8 mask

Page 15: Image Processing

Image ProcessingImage Processing

Formula:Formula:

Set (x,y):

R=0for k=1 to 3for q=1 to 3

R = R + f(x+k-2,y+q-2)*M(k,q)If R Then g(x,y) = 255 (object)

Else g(x,y) = 0 (non-object)

1 x ImageWidth1 y ImageHeight

Page 16: Image Processing

Image ProcessingImage Processing

Egde detection:Egde detection:

Page 17: Image Processing

Image ProcessingImage Processing

Egde detection:Egde detection:

Page 18: Image Processing

Image ProcessingImage Processing

Gradient-based procedure:Gradient-based procedure:

Page 19: Image Processing

Image ProcessingImage Processing

Gradient-based procedure:Gradient-based procedure:

The function f(x) is defined as horizontal gray-level of the image.

The first derivative f’(x) is positive at the point of transition into and out of the ramp as moving from left to right along the profile.

Page 20: Image Processing

Image ProcessingImage Processing

Gradient-based procedure:Gradient-based procedure:

A point M is being an edge point if its two-dimention first order derivative is greater than a specified threshold.

Page 21: Image Processing

Image ProcessingImage Processing

Gradient-based procedure:Gradient-based procedure:

If using the second-derivative to define the edge points in an image as the zero crossing of its second derivative.

Page 22: Image Processing

Image ProcessingImage Processing

Gradient-based procedure:Gradient-based procedure:

The signs of second derivative can be used to determine an edge pixel lies on the dark or light side of an edge

Page 23: Image Processing

Image ProcessingImage Processing

Gradient-based procedure:Gradient-based procedure:

The zero crossing property of the second derivative is quite useful for locating the centers of thick edges.

Page 24: Image Processing

Image ProcessingImage Processing

Gradient-based procedure:Gradient-based procedure:

The first is gradient vector of an image f(x, y), and

The second is quantity (magnitude) of gradient vector

Page 25: Image Processing

Image ProcessingImage Processing

The Prewitt gradient vector for detecting x-direction (y-The Prewitt gradient vector for detecting x-direction (y-direction) and direction) and

the Prewitt gradient vectors for detecting diagonal the Prewitt gradient vectors for detecting diagonal edges:edges:

-1 -1 -1 -1 0 1

0 0 0 -1 0 1

1 1 1 -1 0 1

0 1 1 -1 -1 0

-1 0 1 -1 0 1

-1 -1 0 0 1 1

Gx = (W2 + W3 + W6) – (W4 + W7 + W8)

Gy = (W6 + W8 + W9) – (W1 + W2 + W4)

Gx = (W7 + W8 + W9) – (W1 + W2 + W3)

Gy = (W3 + W6 + W9) – (W1 + W4 + W7)

Page 26: Image Processing

Image ProcessingImage Processing

The general formulaThe general formulafor i = 2 to Height-1for i = 2 to Height-1

for j = 2 to Width-1for j = 2 to Width-1

{ {

t1 = 0t1 = 0

t2 = 0t2 = 0

for p = 1 to 3 for p = 1 to 3

for q = 1 to 3for q = 1 to 3

{ {

t1 = t1 + Gt1 = t1 + G11[p, q] * f[i+p-2, j+q-2][p, q] * f[i+p-2, j+q-2]

t2 = t2 + Gt2 = t2 + G22[p, q] * f[i+p-2, j+q-2]}[p, q] * f[i+p-2, j+q-2]}

ts = Abs(t1) + Abs(t2)ts = Abs(t1) + Abs(t2)

if ts > if ts > thenthen Q[i,j] = 1Q[i,j] = 1elseelse Q[i,j] = 0Q[i,j] = 0

}}

}}

Page 27: Image Processing

Image ProcessingImage Processing

ExampleExample

1 1 1 3 1 1

1 1 1 3 1 1

1 1 1 3 1 1

3 3 3 3 3 3

1 1 1 3 1 1

1 1 1 3 1 1W

For the window W from image I, caculating the valueR(3,3) = |Dx*W| + |Dy*W|

= |-6+12| + |-6+12| = 12For all pixels of I, except boundary of I, we have matrix R:

0 8 0 8

8 12 4 12

0 4 0 4

8 12 4 120 0 0 0

0 1 0 1

0 0 0 0

0 1 0 1

If using threshold at 10:

Page 28: Image Processing

Image ProcessingImage Processing

The Prewitt gradient vector for detecting x-direction (y-The Prewitt gradient vector for detecting x-direction (y-direction) and direction) and

the Prewitt gradient vectors for detecting diagonal the Prewitt gradient vectors for detecting diagonal edges:edges:

Page 29: Image Processing

Image ProcessingImage Processing

The Sobel gradient vector for detecting x-The Sobel gradient vector for detecting x-direction and y-direction edges: direction and y-direction edges:

G1= (W2 + 2W3 + W6 ) – (W4 + 2W7 + W8)G2= (W6 + 2W9 + W8 ) – (W2 + 2W1 + W4)

Gx = (W7 + 2W8 + W9) – (W1 + 2W2 + W3)Gy = (W3 + 2W6 + W9 )– (W1 + 2W4 + W7)

-1 -2 -1 -1 0 1

0 0 0 -2 0 2

1 2 1 -1 0 1

The Sobel gradient vector for detecting diagonal edges:

0 1 2 -2 -1 0

-1 0 1 -1 0 1

-2 -1 0 0 1 2

Page 30: Image Processing

Image ProcessingImage Processing

Examples Examples

ofof

Sobel Sobel

filter filter

Page 31: Image Processing

Image ProcessingImage Processing

Second-order derivative: The Second-order derivative: The LaplacianLaplacian

2

2

2

22

y

f

x

ff

0 -1 0 -1 -1 -1

-1 4 -1 -1 8 -1

0 -1 0 -1 -1 -1

Page 32: Image Processing

Image ProcessingImage Processing

Second-order derivative: The Second-order derivative: The LaplacianLaplacian 0 0 -1 0 0

0 -1 -2 -1 0

-1 -2 16 -2 -1

0 -1 -2 -1 0

0 0 -1 0 0

The Laplacian is not used in its original form for edge detection (because of sensitive to noise).The Laplacian is combined with smoothing as a precursor to finding

edges via zero-crossing.