Docsity

Solved Questions on Image Processing - Final Exam - Fall 2003 | EECS 556, Exams of Electrical and Electronics Engineering

Toggle sidebar
bg1
EECS 556, Winter 2003 Final Exam Solutions 1
Dear EECS 556 Class – Thank you for your and participation in class. Please accept
my best wishes for an enjoyable summer. – Doug Noll
Final Exam Scores: Median = 91, 1st quartile = 94, 3rd quartile = 85
Overall Grade Ranges: 97 and up: A+; 91-96: A; 85-90: A-; 80-84: B+; 79 and below: B
1. Optimal deblurring and denoising.
a. The superposition principle states:
[ ] [ ]
[ ]
),;,(),(),(),(
),(),(),(**),(),(),(
lkmnhlkflmknSlkf
lmknlkfSmnmnfSmnfSmnf
lklk
lk
blur
∑∑∑∑
∑∑
=−−=
−−===
δ
δδ
We now column stack all quantities in (n,m) and we’ll get:
),;(),()( lkphlkfpf
lk
blur
∑
∑
=
and by letting q = k*M+1 (sorry – typo in the problem statement – should have been M
not N), we get:
);()()( qphqfpf
q
blur
∑
=
which is just the matrix multiplication Hf where the elements of H are h(p;q), where q is
the column index and p is the row index.
b. I did the “brute force” method, but there are lots of more elegant ways. See code.
c. f is a zero-mean, unit variance point Bernoulli process: ),(),(mnmnRfδ=, so Kf is the
identity matrix. v is a white Gaussian process convolved by a rect function:
)()(),(3mtrinmnRvδ=. See code for implementation of Kv.
d. We implement gKHKHKHf1111 ')'(
ˆ−−−− += vfv. See code.
e. xyx
Bωωω cos21),(+=
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Solved Questions on Image Processing - Final Exam - Fall 2003 | EECS 556 and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

Dear EECS 556 Class – Thank you for your and participation in class. Please accept my best wishes for an enjoyable summer. – Doug Noll

Final Exam Scores: Median = 91, 1st quartile = 94, 3rd quartile = 85 Overall Grade Ranges: 97 and up: A+; 91-96: A; 85-90: A-; 80-84: B+; 79 and below: B

  1. Optimal deblurring and denoising. a. The superposition principle states:

[ ] [ ]

( , ) [ ( , )] ( ,) ( , ; ,)

f kl S n k m l f kl hnmk l

f nm S f nm S f nm nm S f k l n k m l

k l k l

k l

blur

∑ ∑ ∑ ∑

∑ ∑

= − − =

δ

δ δ

We now column stack all quantities in ( n , m ) and we’ll get: f ( p ) f ( k , l ) h ( p ; k , l ) k l

blur =∑ ∑

and by letting q = k*M +1 (sorry – typo in the problem statement – should have been M not N ), we get: f ( p ) f ( q ) h ( p ; q ) q

blur =∑

which is just the matrix multiplication Hf where the elements of H are h ( p ; q ), where q is the column index and p is the row index. b. I did the “brute force” method, but there are lots of more elegant ways. See code. c. f is a zero-mean, unit variance point Bernoulli process: R (^) f ( n , m )= δ ( n , m ), so K f is the identity matrix. v is a white Gaussian process convolved by a rect function: Rv ( n , m )= δ ( n ) tri 3 ( m ). See code for implementation of K v.

d. We implement f ˆ^ = ( H ' K − v^1 H^ + K − f^1 )−^1 H ' K − v^1 g. See code. e. B ( ω (^) x , ωy )= 1 + 2 cos ωx

f. P (^) f ( ω (^) x , ωy )= 1 and Pv ( ω (^) x , ωy )=( nsd )^2 ( 1 + 2 cos ωy )^2

g. ( , ) ( , ) ( , )

f x y x y v x y

f x y x y x y P B P

P B

H

ω ω ω ω ω ω

ω ω ω ω ω ω

=. See code for implementation and

plots for results. MSE for Part d. is better, but not by much.

h. After reducing the noise variance, we can see more substantial differences between the standard (Fourier) Wiener filter and the statistical MMSE estimator.

At low noise levels, the filter is doing mainly deblurring. The statistical MMSE estimator is better because it properly models the spatially variant behavior at the edges of the object. The Wiener filter assumes circulant behavior or zeros in the case of zero padding

  • both assumptions are inaccurate.

Code: % eecs 556, 2003, final exam, problem 1 rand('state',0);randn('state',0); nx = 16; ny = 16; nsd = 1;

title(sprintf('Statistical MMSE Estimator, MSE = %.2f',msew)); subplot(224); imagesc(fhat2,clim); colormap gray; colorbar; axis('image') title(sprintf('Wiener Filtered Image (Fourier), MSE = %.2f',msew2)); figure(2) subplot(221); imagesc(H); colormap gray; colorbar; axis('image'); title('H') subplot(222); imagesc(kf); colormap gray; colorbar; axis('image'); title('Kf') subplot(223); imagesc(kv); colormap gray; colorbar; axis('image'); title('Kv, \sigma = 1') subplot(224); imagesc(kv); colormap gray; colorbar; axis('image'); axis([1 35 1 35]); title('Kv, \sigma = 1 - zoomed')

  1. Pyramid coding. a. See code. b. See code. c. Based on variance measures and on the fact that there are 16 times as many e0 pixels than f2 pixels, one might expect to assign 1.2668 for e0 and 3.7173 for f2. Without variable length codewords, we stand no chance of meeting our desired bit rate of 1.5, but we may if the probabilities levels of e0 are very non-uniformly distributed and we use a variable length code. It also looks like we are giving few levels than we’d like to give for f2 – 2 3.^7173 ≈ 13 , if we were to use a uniform length code, but in general, our allocation scheme seems to be reasonable based on the variance measures. d. Huffman code for 8 levels {110, 10, 00, 1110, 11110, 111111, 111110, 01}. Bit rate = 2.5420 bits/symbol. e. H = 2.5154. Our code came very close to meeting the entropy rate. The uniform bit rate would be 3 bit/symbol. There is some savings (15%), but not a huge savings. f. See code. g. See code. h. See code. i. Huffman code for 5 levels {0000, 001, 1, 01, 0001}. Bit rate = 1.0573 bits/symbol. j. D = 128.58. Overall bit rate = 1.2178 bits/symbol – we’ve met our target. This approach was better than PCM, not as good as VQ (and we hadn’t even used variable length coding with VQ). k. Interestingly, D = MSE 0. MSE 2 = 74.10. There is apparently a rather complicated relationship between MSE 0 and MSE 2 and the final distortion. In particular, the quantization errors of the higher stages only have an indirect effect on the final distortion. Shannon’s bit allocation scheme was derived from sum of error from each quantization level – this clearly does not apply to pyramid coding and thus, another system might be better (though Shannon’s rule isn’t a bad starting point).

Images:

Code: % eecs 556, 2003, final exam, problem 2 load hw7image; f0 = hw7image; f0(end+1,end+1)=0; % make filter a = .4; h1 = [(.25-a/2) .25 a .25 (.25-a/2)]; h = h1'h1; f0l = conv2(f0,h,'same'); f1 = f0l(1:2:end,1:2:end); f1l = conv2(f1,h,'same'); f2 = f1l(1:2:end,1:2:end); % linear interp kernel h2 = [1 2 3 4 3 2 1]/4; hh = h2'h2; % build estimate f0lhat = zeros(size(f0)); f0lhat(1:4:end,1:4:end) = f2; f0lhat = conv2(f0lhat,hh,'same'); e0 = f0 - f0lhat; subplot(421); imagesc(f0); colormap(gray); colorbar; title('f0'); subplot(422); imagesc(e0); colormap(gray); colorbar; title('e0'); subplot(423); imagesc(f2); colormap(gray); colorbar; title('f2'); % variances and bit rates ve0 = var(e0(:)); vf2 = var(f2(:)); vm = (ve0^(16)vf2).^(1/(16+1)); tmpbpp = 1.5prod(size(f0))/(prod(size(e0))+prod(size(f2))); be0 = (tmpbpp + 0.5*log2(ve0/vm))

T ( θ , a , b ), the rotation happens first followed by translation. One inverse would be to translate by – a and – b the rotate by – θ. a ' ≠ a and b ' ≠ b because in implementing as another matrix in the form T , we do the operations as rotation then translation, so the inverse translations have to be projected through the – θ rotation matrix:

− − − θ θ

θ θ θ θ

θ θ θ θ θ sin cos

cos sin sin cos

cos sin a b

a b y

x b

a y

x y b

x a R R R

c. We know from sampling theory that ( , ) ( , ) d

l d

k k l

Fs uv = ∑ ∑ F u − v − and

( )exp( 2 [^ ]^ )

∑ ∑

∑ ∑

d

l

d

k

d

l

d

k

k l

d

l d

k k l

s

v

u i a b v

u F

G uv Gu v

R θ π R θ

d. To reconstruct the f from gs , we first can consider that the relationship between f and g is known and invertible. Thus, we can consider what properties of g can be reconstructed and relate those back to f. g can be reconstructed from gs if G ( u , v ) is non-zero only for u (^) 2 d < 1 and v (^) 2 d < 1. Our conditions on f are then that F ( u , v ) must be non-zero only for

u v 2 d cos θ − sin θ <^1 and v u 2 d cos θ + sin θ <^1 , as shown below. This particular distribution does not allow reconstruction from fs. To allow reconstruction from both gs and fs we would need to add these conditions: d u 2 < 1 and d v 2 < 1 (an octagonal shaped

region). To handle an arbitrary angle θ , the condition is u^2 + v^2 < 21 d.

  1. Wavelet transforms. a. We can quickly see that A T A = I , therefore, A is a unitary or orthogonal matrix, which has orthogonal rows and is energy preserving. b. See code. c. This is not energy preserving – observe that this is approximately a 2x2 2D Haar transform with basis functions [1 1] and [1 –1]. The energy preserving basis functions

1/d 1/d

u

v F(u,v)

are [ 1 1 ]

2

1 and [ 1 1 ]

2

(^1) −. Since we are doing the transform in both x and y, the

output of haar2.m must be divided by 2. See haar2new.m below. d. Basis functions, by region: a. ax (0) and ay (0) b. ax (1) and ay (0) c. ax (0) and ay (1) d. ax (1) and ay (1) e. ax (2) and by (0), ax (3) and by (0), ax (2) and by (1), ax (3) and by (1) f. ay (2) and bx (0), ay (3) and bx (0), ay (2) and bx (1), ay (3) and bx (1) g. ax (2) and ay (2), ax (3) and ay (2), ax (2) and ay (3), ax (3) and ay (3)

where ( 0 ) [ 0 0 ]

2

1 2

=^1

bd and [ 2 ]

1 2

bd. We can see these visually in the following figure. This was generated by running “ihaar2.m” from part f. on a 4x delta function image with the delta function moved to all 16 possible locations specified by a-g. This is close, but not exactly a 4x4 2D Haar transform.

e. They are all orthogonal, as can be readily seen from the above figure. It is true that the b bases are not orthogonal with ad (0) and ad (1), but the b bases are always in combination with a bases in the orthogonal direction so the 2D bases are orthogonal. f. “haar2new.m” implements a 2x2 2D Haar transform. It turns out that the inverse transform is exactly the same for the 2x2 case, e.g. A T= A. The real challenge here is just the reordering of the transformed image pixels. See code and “ihaar2.m”.