You are on page 1of 8

ENGG1015 Tutorial

Computer System and Digital Image


(Class A) Oct 10 and (Class B) Oct 11
Teaching Objectives

News

Describe the basic flow of a computer operation


Calculate data transmission traffic in image processing
Perform filtering operation and pixel calculation
Project and mid-term presentation
HW 1 (Deadline: 14 Oct)

Ack.: HKU ELEC3505, Digital Image Processing


(RE Woods)
1

Components inside My Computer

CPU (Central Processing Unit)


Datapath + Control Unit
RAM (Random Access Memory)
Motherboard
Graphics card
Input/Output
Hard disk
Optical drive
Power supply
2

Motherboard

Components use the motherboard to communicate and work


with each other
Memory, accessory cards and CPU are installed directly onto
the motherboard
Drivers and peripherals communicate with the motherboard
through wired connections

I/O Devices and Power Supply

Input/Output devices: Graphic card, Hard disk,


Optical drive (CD/DVD drive)
Power supply

Question 1: Question for Computer


Architecture
How the components of a computer work
together to perform the division of two values?

How to store data


into the memory?
How to perform
division?

Solution 1
1.

2.

3.

LOAD the memory with


two values from I/O
port
LOAD a register with a
value from memory
LOAD another register
with another value from
memory

1.

2.,3.

Solution 1
4.

5.

6.

Divide the contents of the


first register by the second
register and leave the
result in a third register.
STORE the contents of the
third register in memory
LOAD the I/O port with the
value from the memory
Use control to control the
whole flow

4.
5.

6.

Question 2: Data Transmission for videos

HDTV generates images with 1,125 horizontal TV


interlaced lines, where every other line is painted on
the tube face in each of two fields, each field being
1/60th of a second in duration.
The width-to-height aspect ration of the image is
16:9. The fact that the number of horizontal lines is
fixed determines the vertical resolution of the
images. Each pixel in the image has 24bits.
How many bits would it take to store a 2-hour HDTV
movie?
8

Solution 2

HDTV generates images with 1,125 horizontal TV


interlaced lines The width-to-height aspect
L
ration of the image is 16:9.

1125

16:9

L : The number of pixels per line


16/9 = L / 1,125 L = 2,000
9

Solution 2

HDTV generates images with 1,125 horizontal TV


interlaced lines, where every other line is painted on
the tube face in each of two fields, each field being
1/60th of a second in duration. Each pixel in the
image has 24bits. How many bits would it take to
store a 2-hour HDTV movie?
The overall data rate
(2,000 x 1,125/2) pixels/frame x 60 frames/sec
x 24 bits/pixel x 2 hours x 3600 sec/hour
= 1.166*1013 bits
10

Question 3: Resolution

Determine the actual physical measurement


in millimeters of an image with 1400
rectangular pixels and a resolution of 72 dpi.

Measurement = 1400 pixel / ((72 x 72) dot


(pixel) per inch2)
13.2 mm
= 0.27 inch2 = 174.2 mm2
13.2 mm

11

Question 4a: Image Filtering

What does this program do?


(Part I)
for all pixels {
Get its 8 immediate neighbors
Compute their mean
Return the value as the intermediate image at that pixel location
}
(Part II)
The final output image is formed by subtracting the input image
from
the intermediate image
(Part III)
Do the filtering operation with a 5x5 matrix

12

Solution 4a
(I) To construct a lowpass filter
(II) To construct a highpass filter from a lowpass filter

1.
2.

1 1 1 0 0 0
1 1 1
1
1
k = 1 0 1 0 1 0 = 1 8 1
8
8
1 1 1 0 0 0
1 1 1

Lowpass filter

Highpass filter

13

Solution 4b: Filtering using Matrix


Convolution

How to do a filtering (2D convolution)?

26

1 1 1 32
1
110
1

8
1

8
1 1 1 80
48

27
34
115
81
46

28
36
128
68
40

29
38
132
62
32

Arbitrary assigned

30 255
40 255
147 = 255

50 255
10 255

255 255 255 255


29 31 33 255
44 57 61 255

2 12 14 255
255 255 255 255

( 26 + 27 + 28 + 32 + 35 + 110 +
1
115 + 128 34 8 ) = 29
8
14

Question 5: Linear Filtering

Determine the possible maximum and minimum


results (pixel values) and its corresponding
situation for a linear filter with
1 2 0
H ( i, j ) = 2 0 2
0 2 1

when applied to an 8-bit grayscale image. Assume


that no clamping of the results occurs.

15

Solution 5

8-bit grayscale

Pixel values in the range [0, 255]


%

1 2 0 "
2 0 2 "


0 2 1 "
$

# $
n "
255 "

n 255 255 "


#
#
# %
#

0
0

0
n

Maximum value = (-1 x 0 + -2 x 0 + -2 x 0 + 0 x n


+ 0 x n + 0 x n + 1 x 255 + 2 x 255 + 2 x 255) / 10
= 127.4
Minimum value = 0
16

Question 6: Edge Detection

The center rectangle in the binary image shown is


of size m x n pixels. Sketch the gradient of this
image, D, using the approximation D=|Dx|+|Dy|.
Assume that Dx and Dy are obtained by using the
Sobel operators.

Show all relevant different pixel


values in the gradient image.

17

Solution 6

A 3x3 region of the image (zs are binary values)


and masks Gx and Gy employed in Sobel operators:

Gradient components corresponding to the masks


Dx = (z3 + 2z6 + z9) (z1 + 2z4 + z7)
Dy = (z7 + 2z8 + z9) (z1 + 2z2 + z3)
18

Solution 6

Need to treat the pixels at some specific positions


The top/bottom edge of the rectangle
The left/right edge of the rectangle
The four corners

Dx = (z3 + 2z6 + z9) (z1 + 2z4 + z7)


Dy = (z7 + 2z8 + z9) (z1 + 2z2 + z3)
D = |Dx|+|Dy|

19

The numbers in brackets are values of [Dx,Dy]


20

Quick Testing
1 1 1 3 4 5 , , ,
1 2 1 6 7 8 = , x ,

1 1 1 9 10 11 , , ,

21

Quick Testing
1 1 1 3 4 5 , , ,
1 2 1 6 7 8 = , 7 ,

1 1 1 9 10 11 , , ,
3 + 4 + 5 + 6 + 8 + 9 + 10 + 11 + 7 2
=7
1+1+1+1+ 2 +1+1+1+1

22

You might also like