Uploaded by hs03175568

133095461780418553

advertisement
COMSATS University Islamabad, Abbottabad Campus
Obtained
Max
20
Department of Electrical and Computer Engineering
Home Work No: 1
Class: BSE–6AB
Subject: Digital Image Processing
Time Allowed: 7 Days
Name:_______________________
Date: October 7, 2022 (in class)
Instructor: Dr. Zahid M. Jehangiri
Max Marks: 20
Registration #_______________________
Question
Course Learning
Objective
(CLO)
Program Learning
Objective
(PLO)
Domain /
Level
Justification
1–12
CLO-1
PLO-1
Cognitive/
C2
Fundamentals of digital
images
1. Consider the two image subsets, S1 and S2 in the following figure and assume that V = {1}, determine whether
these two subsets are:
(a) 4-adjacent
(b) 8-adjacent
(c) m-adjacent
Solution:
2. Consider the image segment shown in the figure below:
(a). As in Section 2.5, let V = {0,1} be the set of intensity values used to define adjacency. Compute the lengths of
the shortest 4-, 8-, and m-path between p and q in the following image. If a particular path does not exist between
these two points, explain why.
Solution:
(b). Repeat (a) but using V {1,2}.
Solution:
3. Consider two points p and q.
(a). State the condition(s) under which the D4 distance between p and q is equal to the shortest 4-path between these
points.
Solution:
(b). Is this path unique?
Solution:
4. In the given figure,
(a). sketch the set: (𝐴 − 𝐵) ∪ (𝐴 ∪)𝐶
Solution:
(b). Give expressions for the sets shown shaded in the following figure in terms of sets A, B, and C. The shaded
areas in each figure constitute one set, so give one expression for each of the three figures.
Solution:
5. We defined the background as (𝑅𝑢 )𝑐 , the complement of the union of all the regions in an image. In some
applications, it is advantageous to define the background as the subset of pixels (𝑅𝑢 )𝑐 that are not region hole
pixels (informally, think of holes as sets of background pixels surrounded by region pixels). How would you
modify the definition to exclude hole pixels from (𝑅𝑢 )𝑐 ? An answer such as “the background is the subset of
pixels of (𝑅𝑢 )𝑐 that are not hole pixels” is not acceptable.
(Hint: Use the concept of connectivity.)
Solution:
6. Define a matrix A of order 1×5 and display its 3rd member.
Solution:
Matlab Code:
Output:
7. Take the transpose of a matrix A of order 1×5 and display its 3rd member. (use A=A.’ to take transpose)
Solution:
Matlab Code:
Output:
8. Define a 5×5 matrix and display its 3rd row and 3rd column members only. (use : to access all rows or columns)
Solution:
Matlab Code:
Output:
9. Take a 3×3 matrix and compute its determinant and inverse. Also use the tic toc command to show the time
required to compute the inverse. Use det and inv commands to get a solution.
Solution:
Matlab Code:
10. Take a 4×3 matrix and show its order. (use size command to know) then replace all the values of your matrix
with zeros (use zeros command in Matlab).
Solution:
Matlab Code
Output:
11. An image in the Matlab is interpreted as a matrix. Read the image moon.jpg, show its order, display it on your
screen, and rotate the moon.jpg image by 45 0 clockwise. (Use imread, imshow, imrotate commands to complete
your task). Use title command to label the input and rotated image. Please use help imrotate command in
MatLab. Also show how much time your system takes to rotate the moon image.
Solution:
Matlab Code
Output Image
12. Create a matrix A, any size and shape you want, and fill it with arbitrary values. Compute AAT and ATA. The
results should be square, symmetric matrices. (Hint: use the rand command in MatLab to create a random
matrix of specified order).
Solution:
Matlab Code
Download