22
Teaching assistant: Yimo Guo [email protected] 16.09.2010 Digital Image Processi ng (Digitaalinen kuvan käsittely) Exercise 1

Teaching assistant: Yimo Guo [email protected] 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

Embed Size (px)

Citation preview

Page 1: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

Teaching assistant: Yimo [email protected]

16.09.2010

Digital Image Processing (Digitaalinen kuvankäsittely)

Exercise 1

Page 2: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

Exercises webpage:http://www.ee.oulu.fi/research/imag/courses/dkk/index.php?page=exercises

• The Questions will be available one week before our exercise class.• The Matlab code of some questions will be given, along with the

Solutions.

Page 3: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

1. One of the several HDTV formats is 1080p24, which means video stream of full frames of 1920×1080 pixels at frame rate 24 fps. If each pixel has 24 bits of intensity resolution (8 bits each for red, green and blue channels), how many gigabytes are needed for 2 hours of HDTV video without compression?

HDTV formats is 1080p24.

Each pixel has 24 bits of intensity

resolution.

Frame rate 24 fps.

Video size is nb × nf bits

1 gigabyte = 8 × 10243 bits

Page 4: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

2. (Exam 4.12.2004) Perform connected component analysis of the follow-

ing binary image. Use the two-scan labeling algorithm and represent

results after each scan by using letters (a,b,c,. . . ) as labels.

(a) Assume 4-connectivity.

From left to right, top to bottom. Examine each pixel P and its neighbor pixels: left (x1) and up (x2).

First scan:

Page 5: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

Second scan: The image is scanned and

pixels are given final labels according to

the equivalences found during the first scan.

Page 6: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

(b) Assume 8-connectivity.The picture is scanned in the similar way as with 4-connectivity, but now we examine four neighbors of P (also the diagonal neighbors).

We notice that a is equal to b. They are given final label A in the second scan.

Page 7: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

3. (Gonzalez & Woods 2007, Ex. 2.15) Consider the image segment shown.

(a) Let V = {0, 1} and compute the lengths of the shortest 4-, 8-, and m-path between p and q. If a particular path does not exist between these points, explain why.

i. There is no 4-path between p and q, as none of the 4-neighborsof pixel q have values from V .

Page 8: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

ii. The shortest 8-path from p to q, considering 8 neighborhood of one pixel.

3

022

21

1 2 1 1

2

1 (q)

(p) 1 0 1 2

V = {0, 1}

p = (3; 0); (3; 1); (2; 2); (1; 2); (0; 3) = q

The length is N - 1 where N is the number of pixels on the path.

The length of the shortest 8-path is 4.

Page 9: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

iii. The shortest m-path from p to q.

m-adjacency (Page 67) :

Two pixels p and q with values from V are m-adjacent if:(i) q is in N4(p), or(ii) q is in ND(p) and the intersection

set of N4(p) N4(q) has no pixels whose values are from V.

3

022

21

1 2 1 1

2

1 (q)

(p) 1 0 1 2

V = {0, 1}

1 2 1

0 1

Intersection set of N4(p) and N4(q) is {1, 2}

Thus, the length of this path is 5.

Page 10: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

(b) Let V = {1, 2} and compute the lengths of the shortest 4-, 8-, and m-path between p and q. If a particular path does not exist between these points, explain why.

i. One possibility for 4-path:p = (3; 0); (2; 0); (2; 1); (2; 2); (2; 3); (1; 3); (0; 3) = qThe length of this path is 6.

ii. One possibility for the shortest 8-path:p = (3; 0); (2; 1); (1; 1); (0; 2); (0; 3) = qThe length of the shortest path is 4.

iii. One possibility for the shortest m-path: p = (3; 0); (2; 0); (2; 1); (1; 1); (0; 1); (0; 2); (0; 3) = qThe length of this path is 6.

Notice that these paths are not unique.

It is easily verifiedthat another path of the same length exists between p and q.

(Matlab code)

Page 11: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

Equalization of an image histogram

is the cumulative density function.

(a) Perform histogram equalization given the following histogram.(r=Gray level, n=number of occurrences)

First, calculate the probability p

k for each gray level:

pk = nk/sum(nk)

Page 12: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

Second, compute the discrete cumulative density function sk.

Finally, round to the nearest discrete value available:

The equalized histogram is:

x/7

Page 13: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

(b) Perform histogram specication of the previous histogram using the specied histogram shown in the following table. (r=Gray level, p=probability of occurrences)

Transform the histogram into a given distribution.

First, equalize the histogram.(in part (a) )

Second, changes the equalized histogram into the given targetdistribution.(inverse transform z = G-1(s), where G(z) is a mapping that equalizes the target distribution)

Compute this mapping:

First, cumulative the probability.

Page 14: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

Next, apply the inverse transform z = G-1(s), by finding the closest sk for each sk

’ computed in part (a).

part (a)

Thus, the histogram resulting from the transform is:

Page 15: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

5. An image is corrupted by additive uncorrelated, zero-average noise yielding

How is the signal-to-noise ratio aected if you average these K images?

Signal-to-noise power ratio:

For single image:

Page 16: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

zero-average noise:

Page 17: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

The average image:

Its signal-to-noise power ratio:

Page 18: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

Finally, the signal-to-noise ratio becomes:

(Matlab code)

Page 19: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

6. (Exam 2.12.2005) Explain different methods for handling border pixels with mask operations.

(a) operator modification

operator is modified for exceptions where some of the necessary neighbors are missing often complex seldom used

(b) adding zeroes

easy to perform often used

Page 20: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

(c) reflecting

usually better than adding zeroes often used

Page 21: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

(d) image is considered to be cyclic

seldom used one should have some reason for assuming the image to be periodic

Page 22: Teaching assistant: Yimo Guo yimo.guo@ee.oulu.fi 16.09.2010 Digital Image Processing (Digitaalinen kuvankäsittely) Exercise 1

(e) only the pixels that have all the necessary neighbors are processed

the only ‘right’ way processed image is smaller than original