Image and Video processing Laboratory 3 Solution

$30.00 $24.00

Template method Template methods try to model the shape of edges and give an approximation of the gradient. Implement a function that performs edge detection using the following templates: Sobel 0 2 0 2 1 and g2 = 4 0 0 0 0 1 g1 = 4 1 @ 1 0 1 A 1 @…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)
  • Template method

Template methods try to model the shape of edges and give an approximation of the gradient. Implement a function that performs edge detection using the following templates:

Sobel

0

2

0

2

1

and

g2 = 4

0

0

0

0

1

g1 = 4

1

@

1

0

1

A

1

@

1

2

1

A

1

0

1

1

2

1

Prewitt

0

1

0

1

1

and

g2 = 3

0

0

0

0

1

g1 = 3

1

@

1

0

1

A

1

@

1

1

1

A

1

0

1

1

1

1

Roberts

= 0

0

0

1

1and

0

01

0

0

1

g1

0

1

0

g2 =

1

0

@

0

0

0

A

@

0

0

0

A

Where the template and the threshold value are the function parameters. Additionally, the function must allow di erent types of magnitude approximation :

p

L2-norm y(k; l) = (x g1(k; l))2 + (x g2(k; l))2

L1-norm y(k; l) = jx g1(k; l)j + jx g2(k; l)j

  • Compass operator

Compass operators approximate the gradient in a number of given directions, typically eight. Then,the gradient magnitude is taken as the maximum absolute value among all directions. Finally, the gradient magnitude is used to classify the edges. Implement a function that performs edge detection using the Kirsch operator. The kirsch masks are given by

  • 1

3 3 5

k0 = @

3

0

5

A

3

3

5

,

and k1; : : : ; k7, where ki is obtained by rotating ki 1 by 45 degrees counter-clockwise.

2

  • Laplace operator

Edge detectors based on the Laplace operator look for parts of the image where the second derivative (i.e. the Laplacian) changes its sign (goes through zero). These correspond to extrema of the gradient. Since the Laplacian is very sensitive to noise, the image is pre- ltered with a Gaussian lter to reduce the noise before applying the Laplacian. Instead of using two lters, we will combine both, Laplacian and Gaussian, to compose one lter, Laplacian of Gaussian (LOG). We apply this lter to the image and detect points where the Laplacian goes through zero.

Write a function that implements the LOG lter. This lter can be obtained by the Matlab function fspecial. The LOG lter size of 2d3 e + 1 is typically used because the Gaussian distribution takes negligible values after 3 . Typical values for are around 2 or 3.

The detection of points where the Laplacian goes through zero can be done by looking at two neighboring pixels (for example a pixel and its upper neighbor). For instance, if they are of opposite signs and their di erence is greater than a certain threshold, the negative pixel is considered as a part of the edge. This operation is applied to both, lines and columns.

  • Frei-Chen method

This method uses a slightly di erent approach than the previous methods. More precisely, the previous methods try to nd maxima of the rst derivative, or detect where the second derivative goes through zero. Instead, the Frei-Chen method projects the image into a nine-dimensional space. Two dimensions capture structures representing the edges while the others capture other types of structures (lines and uniform values). We obtain the edge’s intensity information by calculating the angle between the nine-dimensional vector corresponding to each pixel and its projection on the two dimensions representing the edge structures.

First, the image is ltered with the following masks:

f0 =

p

0 0

0

0 1

f1

=

p

0p

2 0

p21

f2

=

p 0 1

0

1

1

1

1

p

2

1

1

1 0

1

1

0

1

p2

@ 1

p

1A

@ 1 0

1 A

@ p

1

0 A

2

2

2

2

2

2

2

2

f3 =

p

0

1

0

1

1

f4

= 2

0 1

0

11

f5

= 2

0 0

0 0 1

1

p

2

1

0

1

0

1

0

1

1

0

1

@ 0

A

@010A

@ 1 0

1A

p

2

2

1

21

2

= 6

= 3

f6 = 6

0 2 4

f7

0 1

4

1 1

f8

01111

1

1

2

1

1

2

1

2

1

1

1

1

@ 1

2 1 A

@ 2 1

2A

@111A

We obtain the image yn for each mask fn. The required angle at each pixel is given by

(k; l) = arccos p

;

m(k; l)=s(k; l)

where

1

8

X

X

m(k; l) =

(yn(k; l))2;

s(k; l) =

(yn(k; l))2;

n=0

n=0

and k, l are the pixel coordinates.

Given that we will threshold this angle, we are only interested in its magnitude. Thus, we can threshold the cos( ) values directly(i.e. there is no need to apply the arccos function).

Implement a function that performs edge detection using this method.

3

  • Evaluation

    1. Apply the methods above to lena.png, road.png and rice.png. Compare their e ciency and complexity.

    1. Repeat the operation to lena.png or road.png disturbed by a Gaussian noise with standard de-viations 5, 11 et 25 (with respect to the dynamic range [0; 255]). We can use the Matlab function imnoise. What are your conclusions?

4

Image and Video processing Laboratory 3 Solution
$30.00 $24.00