0% found this document useful (0 votes)
4 views

Module 4 problems

The document outlines problems and solutions related to computer graphics and image processing, including calculations for storage requirements of binary and color images, pixel dimensions based on physical size and resolution, transmission times for grey-scale and binary images, and operations on image matrices. It also covers transformations such as translation, scaling, rotation, skewing, and mirroring, as well as entropy calculations for given symbols and images. The document serves as a practical guide for understanding key concepts and computations in image processing.

Uploaded by

F09 SHARATH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Module 4 problems

The document outlines problems and solutions related to computer graphics and image processing, including calculations for storage requirements of binary and color images, pixel dimensions based on physical size and resolution, transmission times for grey-scale and binary images, and operations on image matrices. It also covers transformations such as translation, scaling, rotation, skewing, and mirroring, as well as entropy calculations for given symbols and images. The document serves as a practical guide for understanding key concepts and computations in image processing.

Uploaded by

F09 SHARATH
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Computer Graphics and Fundamentals of Image Processing (21CS63)

Module 4 Problems

1) What is the storage requirement for a 1024 x 1024 binary image ?

Solution:

For a binary image, one bit is sufficient for representing the pixel value. So the number of bits
required will be 1024 x1024x1=10,48,576 bits=1,31,072 bytes =131.072 Kb (Assume 1Kb
=1000 bytes)

2) What is the storage requirement for a 1024 x 1024 24-bit colour image ?

Solution:

Since colour images are three-band images(red,green,blue components), the storage requirement
is 1024  1024  3 bytes =31,45,728 bytes. If it is assumed that 1Kb is 1000 bytes, the storage
requirement is 3,145.728 Kb

3) A picture of physical size 2.5 inches by 2 inches is scanned at 150 dpi. How many
pixels would be there in the image?

Solution:

The relation between the physical dimensions and the spatial resolution is simple. The pixel
dimensions are obtained by multiplying the physical width and height by the scanned resolution.
Therefore, the pixel dimension is as follows.

(2.5  150 ) (2  150)

=375  300 =112500 pixels would present

4) If a 375  375 grey-scale image needs to be sent across the channel of capacity 28
kbps, then how much transmission time is required?

Solution

If the picture is grey scale, then 8 bits are used. Therefore, transmission time would be

375  300  8
= 28  1000

Department of CSE Page 1


Computer Graphics and Fundamentals of Image Processing (21CS63)

112500  8
= 28000

=32.143 sec

5) Given a grey-scale image of size 5 inches by 6 inches scanned at the rate of 300 dpi,
answer the following.

a) How many bits are required to represent the image?


b) How much time is required to transmit the image if the modem is 28 kbps?
c) Repeat the aforementioned if it were a binary?

Solution

a) Number of bits required to represent grey-scale image (uses 8 bits)

= 530063008=1500  1800  8 = 21600000 bits

b) Total time taken to transmit the image

Total number of bits in the image


=
Transmission Speed

21600000
= 28000

= 771.43sec

c) If it is a binary image, then the number of bits required to represent binary image

= 5  300 6  300  1 =1500  1800  1 =2700000 bits


Total number of bits
The total transmission time would be = Transmission speed

2700000
= 28000

= 96.429 sec

6) Consider the following 4 x 4, 8 level images A and B. Find A+B, A-B,A  B, and A/B.

1 2 3 4
A= 5 5 6 6
6 7 6 6
6 7 2 3

Department of CSE Page 2


Computer Graphics and Fundamentals of Image Processing (21CS63)

1 3 5 7
B = 8 7 0 1
3 5 6 7
1 3 5 7
Solution

The given images are 4  4 and 8 grey level (0 – 7) images. As the grey levels are 0-7, any value
above 7 is reduced to 7.

1+1 2+3 3+5 4+7


5+8 5+7 6+0 6+1
A+B= 6+3 7+5 6+6 6+7
6+1 7+3 2+5 3+7

2 5 8 11
13 12 6 7
= 9 12 12 13
7 10 7 10

2 5 7 7
= 7 7 6 7
7 7 7 7
7 7 7 7

1-1 2-3 3-5 4-7


5-8 5-7 6-0 6-1
A-B= 6-3 7-5 6-6 6-7
6-1 7-3 2-5 3-7

0 -1 -2 -3
=
-3 -2 6 5
3 2 0 -1
5 4 -3 -4

0 0 0 0
= 0 0 6 5
3 2 0 0
5 4 0 0

Department of CSE Page 3


Computer Graphics and Fundamentals of Image Processing (21CS63)

11 23 35 47


58 57 60 61
AxB=
63 75 66 67
61 73 25 37

1 6 15 28
40 35 0 6
= 18 35 36 42
6 21 10 21

1 6 7 7
= 7 7 0 6
7 7 7 7
6 7 7 7

1/1 2/3 3/5 4/7


5/8 5/7 6/0 6/1
A/B= 6/3 7/5 6/6 6/7
6/1 7/3 2/5 3/7

1 0 0 0
0 0 0 6
= 2 1 1 0
6 2 0 0

7) Consider the following two images

𝟏 𝟎 𝟎 𝟏 𝟏 𝟏
f1= 𝟏 𝟏 𝟏 f2= 𝟏 𝟏 𝟏
𝟎 𝟎 𝟏 𝟏 𝟏 𝟏
Perform the logical AND, OR, NOT and difference operations.

Solution:

11 01 01 1 0 0


AND f1 AND f2 = 11 11 11 = 1 1 1
01 01 11 0 0 1

Department of CSE Page 4


Computer Graphics and Fundamentals of Image Processing (21CS63)

11 01 01 1 1 1


OR f1 OR f2 = 11 11 11 = 1 1 1
01 01 11 1 1 1
1 0 0 0 1 1
NOT NOT (f1) = 1 1 1 = 0 0 0
0 0 1 1 1 0
Difference

0 0 0
f1 AND (f2) = 0 0 0
0 0 0
0 1 0
f2 AND (f1) = 0 0 0
0 0 0

8) Consider an image point [2,2] . Perform the following operations and show the results of
these transformations.

(a) Translate the image right by 3 units.


(b) Perform a scaling operation in both x-axis and y-axis by 3 units.
(c) Rotate the image in x-axis by 450
(d) Perform horizontal skewing by 450
(e) Perform mirroring about x-axis
(f) Perform shear in y-direction by 30 units.

Solution:

(a) Translation of the image right by 3 units means that

x=3 and y=0

So the translation matrix is given as

1 0 x 1 0 3
T= 0 1 y = 0 1 0
0 0 1 0 0 1
Therefore,

x =T  x
1 0 3
0  [2,2,1] =[5 2 1 ]
T
= 0 1
0 0 1

Department of CSE Page 5


Computer Graphics and Fundamentals of Image Processing (21CS63)

(b) Scaling by 3 units in both directions means that

𝑆𝑥 0 0
S= 0 𝑆𝑦 0
0 0 1
3 0 0
S= 0 3 0  [2,2,1] T =[6 6 1 ]T
0 0 1
(c) Rotating the image in x-axis by 450

𝑐𝑜𝑠 −𝑠𝑖𝑛 0 𝑐𝑜𝑠45 −𝑠𝑖𝑛45 0


R = 𝑠𝑖𝑛 𝑐𝑜𝑠 0 = 𝑠𝑖𝑛45 𝑐𝑜𝑠45 0
0 0 1 0 0 1
0.707 −0.707 0
0.707 0.707 0  [2,2,1] = [0 2.828
T
R= 1]T
0 0 1
The fraction 2.828 will be rounded to 3. This is determined by the interpolation technique used.

(d) Performing horizontal skewing by 450

1 0 0 1 0 0
Skew = tan  1 0 = tan 45 1 0
0 0 1 0 0 1
1 0 0
Skew = 1 1 0  [2,2,1]T = [2, 4, 1]T
0 0 1
(e) Performing mirroring around x-axis

1 0 0
Mx = 0 −1 0
0 0 1
1 0 0
Mirroring= 0 −1 0  [2,2,1] = [2 -2 1]T
0 0 1
(f) Performing shear in y-direction by 30 units.

1 𝑆ℎ𝑦 0 1 30 0
Sheary = 0 1 0 =0 1 0
0 0 1 0 0 1

Department of CSE Page 6


Computer Graphics and Fundamentals of Image Processing (21CS63)

1 30 0
Mirroring = 0 1 0  [2,2,1]T =[62 2 1]T
0 0 1
9) Calculate the entropy for the symbols given in following Table.

Symbols 1 2 3 4 5
Probability 0.4 0.3 0.1 0.1 0.1

𝑛
Entropy H= - 𝑖=1 𝑝 i log2 pi

H= -(0.4log20.4 + 0.3 log2 0.3 + 0.1 log2 0.1 + 0.1 log2 0.1+0.1 log2 0.1)

H= -(-0.5288-0.5211-0.3322-0.3322-0.3322)

= 2.0465

10) Calculate the entropy of the given image.

1 2 3 5
3 4 4 6
9 9 8 7
1 3 5 6

Solution:

The formula for computing entropy is


𝑛
Entropy = - 𝑖=1 𝑝i log pi

The probability of all the pixels are computed and shown in the following table.

Symbol in image Probability of occurrence (pi)


1 2/16
2 1/16
3 3/16
4 2/16
5 2/16
6 2/16
7 1/16
8 1/16
9 2/16

Department of CSE Page 7


Computer Graphics and Fundamentals of Image Processing (21CS63)

Therefore, entropy is computed as follows:


2 2 1 1 3 3 2 2 2 2 2 2 1 1 1
Entropy= -{16 log(16 )+ log(16 ) +16 log(16 )+ 16 log(16 )+ 16 log(16 )+ 16 log(16 )+ 16 log(16 )+ 16
16
1 2 2
log(16 )+ 16 log(16 ) }

= - {-0.375 -0.25-0.45-0.375-0.375-0.375-0.25-0.25-0.375}

=-{-3.075}

Therefore, the entropy of the image is 3.075

11) Consider the following two images

𝟏 𝟑 𝟕
f1= 𝟓 𝟏𝟓 𝟕𝟓
𝟐𝟎𝟎 𝟓𝟎 𝟏𝟓𝟎
𝟓𝟎 𝟏𝟓𝟎 𝟏𝟐𝟓
f2= 𝟒𝟓 𝟓𝟓 𝟏𝟓𝟓
𝟐𝟎𝟎 𝟓𝟎 𝟕𝟓
Perform addition, subtraction, multiplication and division operations. Assume both the
images are of the 8-bit integer type(unit8 of MATLAB type)

Solution:

Addition:

1 + 50 3 + 150 7 + 125 51 153 132


g=f1+f2 = 5 + 45 15 + 55 75 + 155 = 50 70 230
200 + 200 50 + 50 150 + 75 400 100 225
If the data type unit8 is assumed, the minimum and maximum allowed values are 0 and 255,
respectively. So if the value is larger than 255, it is reset to 255. Similarly, if the value is less
than 0 it is reset to 0.

So, the result of image addition is

51 153 132
g= 50 70 230
255 100 225

Department of CSE Page 8


Computer Graphics and Fundamentals of Image Processing (21CS63)

Subtraction:

1 − 50 3 − 150 7 − 125 −49 −147 −118


g= f1- f2 = 5 − 45 15 − 55 75 − 155 = −40 −40 −80
200 − 200 50 − 50 150 − 75 0 0 75

Since the data type is unit8, values less than 0 are reset to 0.

0 0 0
g= 0 0 0
0 0 75
It can be observed that the modulus of the difference results in a different image.

Multiplication:

150 3150 7125 50 450 875


g=f1  f2 = 545 1555 75155 = 225 825 11625
200200 5050 15075 40000 2500 11250
Since the data type is unit8, values greater than 255 are reset to 255

50 255 255
g = 225 255 255
255 255 255
Division:

1/50 3/150 7/125 0.02 0.02 0.056


g=f1/ f2 = 5/45 15/55 75/155 = 0.11 0.272 0.484
200/200 50/50 150/75 1 1 2
0 0 0
g= 0 0 0
1 1 2

Department of CSE Page 9


Computer Graphics and Fundamentals of Image Processing (21CS63)

12) Let V={0,1}. Compute the De,D4, D8 distance between two pixels p and q. Let the pixel
coordinates of p and q be (3,0) and (2,3) respectively for the image shown below.

0 1 2 3

0 0 1 1 1

1 1 0 0 1

2 1 1 1 1(q)

3 1(p) 1 1 1

Figure: Sample Image

Solution:

The Euclidean distance is

= 1+9

= 10

D4 =|x-s|+ |y-t|

=|3-2|+ |0-3|

=1+3=4

D8 = max(|x-s|,|y-t|)

=max(|3-2|, |0-3| )

=max(1,3)=3

Department of CSE Page 10


Computer Graphics and Fundamentals of Image Processing (21CS63)

13) Consider the following image with marked pixels p and q.

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

If V={1,2}, find the shortest m-path between pixels p and q.

Solution :

The shortest path for set V {1,2} is shown below

3 1 2 1 (q)

2 2 0 2

1 2 1 1

1 0 1 2

(p)

The shortest m-path is 1- 2 -1 -2 -1. Therefore Dm distance is 4.

Department of CSE Page 11

You might also like