Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

Ozan Galip EROL/ Volkan ARAN

Morphological Image Processing Question

Question:

Milling cutters are tools that remove


material by their movement within the object.
A 2D object wanted to be manufactured from
sheet (or bulk) material but tool geometries
cause certain limitations on resulting
geometries thus manufactured part can not be
exactly the same as desired one.
Generate an algorithm, using
morphological operations, to create geometry
of product with respect to various tool
geometries.

(Adopted from: www.efunda.com)


Some tool geometries and their corresponding effects on work pieces.

Hint:

Answer:

Define B as the structuring element. Let tool shape is described by B matrix. Desired
geometry consists of inner and outer boundaries. Let outer boundary described by A1 matrix
and inners are A2i matrices. Simply by closing the outer boundary and opening inner
boundaries with B achievable contours it to be found. At the end the sum (combination) of
resulting matrices gives estimated manufactured piece geometry.
Questions Cigdem Avci & Kerem Sahin

From the lowpass and higpass filters in frequency domain , which one is used for
smoothing and which for sharpening? Why?

Lowpass used for smoothing, highpass for sharpening because low pass allows low
frequencies of image in fourier domain and low frequencies represents general view of iimage
without sharp details and edges,high pass is the opposite.

Considering the fourier transformed image given above, how do you obtain low pass
filtering, high pass filtering and band pass filtering?

That image is origin centered and from the origin i select a dimaeter length and allow the
frequencies inside that diameter to pass and with inverse fourier transfor reconstruct the
image. For high pass, again i select a diameter from center but this time the frequencies
outside that diameter i will allow to pass and reconstruct the image by taking inverse fourier
transform.

Which operations do you use to reduce noise in that image,why?

To reduce noise, i use low pass filtering because it does not passes high frequencies that
correspond to edges in original image.

Which property of fourier transform gains importance when recognizin same shape on
different parts of image? Why?

Shifting property. Because with the same image on different part of the image, the image’s
only changed by a constant .

What is the cause of ringing effect?

If your sampling rate does not include all frequencies in your image, ringing effect occurs.
CENG 466

SAMPLE MIDTERM QUESTION

a. Write down the equation of opening operation. What is the geometrical interpretation of
this operation can be?

b. A binary image is given through the matrix follows. (0 corresponds to black and 1
corresponds to white.)

A=
1 1 0 1 1 1 0 0 0
1 0 0 0 1 1 0 0 0
0 0 0 0 0 0 0 0 0
1 0 0 0 1 1 0 0 0
1 1 0 1 1 1 0 0 0

What does the resulting image look like after applying opening operation on this image with a
disk structural element of radius 1 pixel.
Comment on the result.

c. Extract the boundary of the object with a structural element,

B=
0 0 0
0 0 0
0 0 0

d. Suppose the image is corrupted by salt and pepper noise which is present in the object part
of the image (not background). Which morphological operation will you prefer for
eliminating it?
SOLUT
TIONS:

a. A º B = (A
A B) B

Openingg is like rollling a ball (for


( a disk sttructural eleement) insidde the bounndary of A. The
T
farthest points that the ball B reachs
r in thee boundary of A constiitutes the booundaries off A º B.

b.

Openingg broke the bridge betw


ween two obbjects, it eliminated thiin protrusionns and resullted in a
smootheer image.

c. Boundary
B o the objectt will be obttained by th
of he operationns A- (A B ).
(A B ):

A - (A B ): Thhe boundaryy of the objeect

d. For getting
g rid of
o the salt annd pepper noise
n that is present inside the objeect, closing is
preferreed. Dilation can also bee applied buut it changess the size off the object, so closing is the
best soluution.

Beliz Uğurhan
U
FINAL QUESTION
İren Berk Özalp 1449040 – Belkay Sarataş 1449081 CENG

Here is an diagram of Discrete Wavelet Transform is a wavelet transform for which the
wavelets are discretely sampled. Here is h[n] stands for high pass filter and g[n] stands for
low pass filter. Result of g[n] is approxiamation coefficients and results of h[n] is detail
coefficients.
Briefly show differences and similarities of the transform, when it is applied like the diagram
above and when the g and h filters are change places.
Answer;
High pass filter are keep high frequncies and return details of an image, low pass filter keep
low frequencies. So when it is applied like above we keep downsampling highpass filter as
our next input so at the end of process we kept less detail with respect to other way. Because
in the other approach we downsample low pass to the next input so kept high pass and kept
more details. But both of them makes some smoothing to the original image. Also both of the
approaches can be used for image compression, also the compression ratio is the same for
both approaches because level of downsamling is same.
C G 466 FINA
CENG AL QU
UESTIO
ON, 2nd Ch
h.

In
ntensity Values
0 1 2 1 0
16
1 4 8 4 1
14
2 8 15 8 2
12
1 4 8 4 1 10
8
6
4
2
0 A B
0 1 2 3 4 5 6

Answerr the follow


wing parts according to above 4-bit
4 image at left, wh hich is an im
mage of
2D Gau ussian funcction with σ=1,
σ and grraph at righ
ht, which iss the correesponding intensity
profile through th
he center off image from
m point A to B.
a) Find an esttimated 5x5 5 matrix rep presentation n of the Gaussian imagge by Samp pling and
Q
Quantization n.
T line from
The m point A too B is requirred to be divvided into 5 parts. We ccan say our parts are
f
from 0.5 to 1.5;
1 1.5 to 2..5 and so on.. Therefore for
f sampling (digitizing thhe coordinatte values)
part, we can take 1, 2, 2 3, 4 and 5 mid‐points as our coordinates of matrix. And A with
c
correspondin ng intensity values, we can make qu uantization (digitizing
( th
he amplitude
e values).
W this infformation ou
With ur 1x5 matrixx of the graph would be:

2 8 15 8 2
rd
This is the 3 line of our
T o 5x5 maatrix. Becau use of the syymmetry off Gaussian function
rd
f
from peak point,
p we caan say the 3 column is i also the same.
s The rest of matriix would
b estimatioon. The corrners of thee image are totally blacck, which m
be means “0”. And we
k
know the middle
m points of the edgges are “2”. The intensiity values off (1,2) ; (1,4
4); (2,1);
(
(2,5); (4,1);; (4,5); (5,2) and (5,4) points wou uld be betweeen “2” andd “0”, which means

“1”. Afterw wards, the only
o unknow wn values belongs
b to points
p (2,2)) ; (2,4) ; (4,2) and
(
(4,4). Also from the character
c off Gaussian function,
f w can say tthe value would
we w be
b
between “88” and “2”. The real representatio
r on to the Gaussian
G fuunction with h σ = 1,
t
those pixelss have the intensity vaalue of “4””. However,, 3-4-5-6 w would be accceptable
0 2 0 answerrs.
The reesult matrix is:
8
2 8 15 8 2
8
0 2 0
0 1 2 1 0

b) According to the matrix obtained from part A, find the boundary for 4‐adjacency and 8‐
adjacency. Let our region's V={0,1,2,3,4,5,6,7}.

Our region with respect to V={0,1,2,3,4,5,6,7} is:

0 1 2 1 0 Our border (Black pixels) with respect to 4-


1 4 8 4 1 adjacency is:

2 8 15 8 2
1 4 8 4 1
0 1 2 1 0

And finally, our border (Black pixels) with respect to


8- 0 1 2 1 0 adjacency is:
1 4 8 4 1
2 8 15 8 2
1 4 8 4 1
0 1 2 1 0

0 1 2 1 0
1 4 8 4 1
2 8 15 8 2
1 4 8 4 1
0 1 2 1 0
Ömer PEKTAŞ
Sara OMRANIAN

CENG 466
SAMPLE QUESTION FOR FINAL
(From Chapter 8)

QUESTION:

Consider a 7x7 image with each pixel represented by 3 bits. The binary images
corresponding to each bit plane of the image are compressed to reduce interpixel redundancies
by using run length coding as given below.

Bit Plane 0 : (1 3 3) (2 2 4) (3 3 3) (4 2 4) (5 3 3)
Bit Plane 1 : (2 1 5) (3 0 6) (4 0 6)
Bit Plane 2 : (1 3 3) (2 2 4) (3 1 5) (4 2 4) (5 0 6)

a) Determine the binary images for each bit plane.


b) Obtain the compression ratio and the percent of redundancy eliminated by compression for
each bit plane.
c) Construct the original image from the bit planes obtained in part a.
d) Find the entropy and total information for the entire image.
e) Find the number of bits for storage with fixed length coding.
f) Apply Huffman coding. Discuss the effects of using variable length coding in terms of
storage space and redundancy elimination.

SOLUTION:

a)
Bit Plane 2 Bit Plane 1 Bit Plane 0

0 1 2 3 4 5 6

0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1
2 1 1 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1 1
3 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0 1 1 1
4 1 1 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 1 1
5 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1
6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
b)
For bit plane 0 : (1 3 3) (2 2 4) (3 3 3) (4 2 4) (5 3 3)
Each symbol is represented by 3 bits. Then totally,
( 3 × 3) ⋅ 5 = 45
7× 7× 1 1
CR 1.089 R 1− 0.08 8% redundancy
45 1.089

For bit plane 1 : (2 1 5) (3 0 6) (4 0 6)


7× 7× 1 1
CR 1.815 R 1− 0.45 45% redundancy
3× 3× 3 1.089

For bit plane 2 : (1 3 3) (2 2 4) (3 1 5) (4 2 4) (5 0 6)


7× 7× 1 1
CR 1.089 R 1− 0.08 8% redundancy
3× 3× 5 1.089

c) 0 1 2 3 4 5 6
0 7 7 7 7 7 7 7
1 7 7 7 2 7 7 7
2 7 5 0 0 0 5 7
3 5 1 1 0 1 1 5
4 5 5 0 0 0 5 5
5 3 3 3 2 3 3 3
6 7 7 7 7 7 7 7

Consider the first pixel: 7 Æ (111) =(Bit plane2, Bit Plane 1, Bit Plane 0)

d)
Histogram
Total number of pixels:
25 7x7=49
20
P(0) = 7/49
15
P(1) = 4/49
P(2) = 2/49
H(rk)

10 P(3) = 6/49
P(5) = 8/49
5
P(7) = 22/49
0
0 1 2 3 4 5 6 7 8
rk
n
H − ∑ (p(ai)⋅log(P(ai)))
i=0

−⎛⎜ ⋅ log⎛⎜ ⎞ + 4 ⋅ log⎛ 4 ⎞ + 2 ⋅ log⎛ 2 ⎞ + 6 ⋅ log⎛ 6 ⎞ + 8 ⋅ log⎛ 8 ⎞ + 22 ⋅ log⎛ 22 ⎞ ⎞


7 7
H ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟⎟ 2.20 bits/pixel
⎝ 49 ⎝ 49 ⎠ 49 ⎝ 49 ⎠ 49 ⎝ 49 ⎠ 49 ⎝ 49 ⎠ 49 ⎝ 49 ⎠ 49 ⎝ 49 ⎠ ⎠

For entire image : 7x7x2.20=108 bits information is carried by the source.


(Note that the base of the logarithm is 2)

e) Since the range of gray levels is [0,7] each pixel is represented by 3 bits in fixed length
coding.
m = 3 Î mx(MxN)=3x(7x7)=147 bits needed.

f) Huffman coding

Original Source Source Reduction

rk ( )
P rk Code 1 2 3 4

7 22/49 1 22 1 22 1 22 1 27
0
5 8/49 000 8 000 12 01 15 00 22
1
0 7/49 001 7 001 8 000 12 01
3 6/49 010 6 010 7 001
2 4/49 0110 6 011
1 2/49 0111

Note that the denominator (49) for P(rk) is not shown in the reduction phase just for
simplicity.

1⋅ ⎛⎜
22 ⎞ ⎛ 8⎞ ⎛ 7⎞ ⎛ 6⎞ ⎛ 4⎞ ⎛ 2⎞
Lavg ∑ (l(rk)⋅P(rk)) ⎝ 49 ⎠
⎟ + 3⋅ ⎜ ⎟ + 3⋅ ⎜ ⎟ + 3⋅ ⎜ ⎟ + 4⋅ ⎜ ⎟ + 4⋅ ⎜ ⎟
⎝ ⎠
49 ⎝ ⎠
49 ⎝ ⎠
49 ⎝ ⎠
49 ⎝ 49 ⎠
2.22 bits/pixel
k

• For storage: (7x7)x2.22 = 109 bits needed. In part d the information carried by the
image was found to be 108 bits. Hence, Huffman coding can be assessed to be quite
successful in compression of this image.
• Redundancy:

3 1
CR 1.35 R 1− 0.26 26% of data in fixed length
22 1.35 coding is redundant.
Reyhan Taşpınar Sample Final Question ( Chapter
10)
Buğra Oktay CENG
466

Question: Given a Hough transform of an image. Roughly draw (only the detected) lines in
this image.

‐ (Θ,r) values for the marked points (Unit for “Θ” is degree and unit for “r“ is pixel)

Theta r
1 0 72
2 45 119
3 45 101
4 45 26
5 120 113
6 120 77
7 225 105
8 225 87
9 225 35
10 225 19
11 270 72
12 270 25

Note that theta values are measured clockwise (from x-axis) in the coordinate system.
Solution:
There is, however, an exception about the point 4. The Hough curves passing through
this point are not close to each other at some points along the curve. This means the peak
point (point 4) will not actually give us a line segment. It is true that there are points in
the image being in the same line but they do not form a line segment since those points
are not neighbours.
The final image:
Ozan Özgün Bilgin
Ahmet Çağan
Yıldırım
Question

a) The histograms of three images are illustrated below. For each image, sketch a
transformation function in the figure below that will help to equalize the histogram.
Figure 1A Figure 1B Figure 1C

b) For the image shown in Figure 2, find a transformation function that will approximately
equalize its histogram, draw the transformed image and give the histogram of the processed
image. Assume that the processed images can only take integer values between 0 and 7
(including 0 and 7).

Figure 2

Solution
a)
Figure 1A Figure 1B Figure 1C

b)

Histogram equalization:
s
r h(r) H(r) =(int(7*H(r)/25)) s h(s)
0 3 3 1 0 0
1 7 10 3 1 3
2 3 13 4 2 0
3 3 16 4 3 7
4 3 19 5 4 6
5 3 22 6 5 3
6 2 24 7 6 3
7 1 25 7 7 3

Resultant image: Histogram of Resultant Image:

h(s)
8

0
0 2 4 6 8 10
CENG 466 – FUNDAMENTALS OF IMAGE PROCESSING
FINAL QUESTION
OZAN ŞENER & YUSUF SOYMAN

1- 8 gray level image matrix is given below:

0 5 3 3 2
6 1 7 1 4
3 4 7 0 6
6 7 1 4 4
2 1 7 0 5

a) Resample the image by interpolating to obtain 9x9 image.


b) Threshold the image with tresholding rules specified below to convert it to
binary image.
Thresholding rule is defined as cumulative histogram of biggest valued pixel
divided by number of gray level.
c) Rotate the binary image 180 degree by applying belowed rotational
transformation matrix.
Rotational Transformation Matrix is defined as:

cosθ -sinθ
sinθ cosθ

d) Requantize the original image to obtain 3 level image.


SOLUTION MANUAL:

a)

0 3 5 4 3 3 3 3 2
3 4 3 2 5 4 2 3 3
6 4 1 4 7 4 1 3 4
5 2 3 5 7 4 1 3 5
3 4 4 6 7 4 0 3 6
5 6 6 5 4 4 2 4 5
6 7 7 4 1 3 4 4 4
4 5 4 4 4 4 2 4 5
2 2 1 4 7 4 0 3 5

b) Threshold value is 1 / 8 = 0.125

Histograms Probability density function After Thresholding


H( 0 ) = 3 K( 0 ) = 0.12 T( 0 ) = 0
H( 1 ) = 4 K( 1 ) = 0.16 T( 1 ) = 1
H( 2 ) = 2 K( 2 ) = 0.08 T( 2 ) = 0
H( 3 ) = 3 K( 3 ) = 0.12 T( 3 ) = 0
H( 4 ) = 4 K( 4 ) = 0.16 T( 4 ) = 1
H( 5 ) = 2 K( 5 ) = 0.08 T( 5 ) = 0
H( 6 ) = 3 K( 6 ) = 0.12 T( 6 ) = 0
H( 7 ) = 4 K( 7 ) = 0.16 T( 7 ) = 1

Original image Thresholded image


0 5 3 3 2 0 0 0 0 0
6 1 7 1 4 0 1 1 1 1
3 4 7 0 6 0 1 1 0 0
6 7 1 4 4 0 1 1 1 1
2 1 7 0 5 0 1 1 0 0

c) Rotational Transformation Matrix is:

-1 0 0
0 -1

1 valued pizel coordinates:


(1,1), (1,2), (1,3), (1,4),
(2,1), (2,2),
(3,1), (3,2), (3,3), (3,4),
(4,1), (4,2)
Multiply transformation matrix with all 1 valued coordinate of vector.
(1,1), (1,2), (1,3), (1,4) => (-1,-1), (-1, -2), (-1,-3), (-1,-4)
(2,1), (2,2) => (-2,-1), (-2, -2)
(3,1), (3,2), (3,3), (3,4) => (-3,-1), (-3, -2), (-3,-3), (-3,-4)
(4,1), (4,2) => (-4, -1), (-4, -2)

Shift all values by 4 =>


(-1,-1), (-1, -2), (-1,-3), (-1,-4) => (3,3), (3,2), (3,1), (3,0)
(-2,-1), (-2, -2) => (2,3), (2,2)
(-3,-1), (-3, -2), (-3,-3), (-3,-4) => (1,3), (1,2), (1,1), (1,0)
(-4,-1), (-4, -2) => (0,3), (0,2)

Finally, locate the 1 valued pixels to specified coordinates.

0 0 1 1 0
1 1 1 1 0
0 0 1 1 0 =
1 1 1 1 0
0 0 0 0 0

d) Specify number of 0 and 2 as 1.


Specify number of 3 and 5 as 4.
Specify number of 6 as 7.

Original image Requantized image


0 5 3 3 2 1 4 4 4 1
6 1 7 1 4 7 1 7 1 4
3 4 7 0 6 4 4 7 1 7
6 7 1 4 4 7 7 1 4 4
2 1 7 0 5 1 1 7 1 4
Group members: Tuncay U. OLCER
Ahmet YILMAZ

CENG 466
FUNDAMENTALS OF IMAGE PROCESSING
FINAL SAMPLE QUESTION
CHAPTER 7

True or false? If false, make the corrections.


QUESTION
• A decomposed image in subband coding can be reconstructed with an error which
should not be neglected.
• In Multiresolution analysis (MRA) , a scaling function is used to create a series of
approximations of an image, each differing by a factor of 2 in resolution from its
nearest neighboring approximations.
• One of the MRA requirement is the scaling function is orthogonal to its integer values.
• The Haar Transform is T=HFHT , H is a symmetric matrix.

ANSWER
9 FALSE. A decomposed image in subband coding can be reconstructed without
error (i.e. fully reconstructed)
9 TRUE
9 TRUE
9 FALSE. For example if we consider a 2 X 2 Haar matrix
1 ⎞ ⎛1 1 ⎞
H2 := ⎛⎜ ⎟ ⋅⎜ ⎟
⎝ 2 ⎠ ⎝ 1 −1 ⎠

It is obviously not a symmetric matrix.

You might also like