Вы находитесь на странице: 1из 10

Problem 1 (50 pts.

1.1) (15 pts.) Compute the DFT for the following two vectors with length N=4:
1 1 
1 0 
x1 =   , x2 =   .
1 1 
  
1 0 

1.2) (15 pts.) Compute the two-dimensional DFT with size M=N=4 for the following 4x4 stripe
.5 .5 .5 .5
0 0 0 0
image x3 =   , as shown in (a).
.5 .5 .5 .5
 
0 0 0 0

1.3) (20 pts.) Generate a 4x4 checker board pattern from the stripe image above by letting

x4 = 0.6 x3 .^ 2 + 0.8 x3 , here .^ denotes element-wise square operation on matrix x3 , as shown


T

in (b). Compute the Fourier transform of x4 from that of x3 .

0.5

0.4

0.3

0.2

0.1

N=4 N=4
(a) (b)

Solution:

3
1.1) DFT [ x1 ] = [1 / 4 ∑1 • e
u =0
− j 2πuk / 4
, k = 0,1,2,3] = [2 0 0 0]T
DFT [ x2 ] = [1 0 1 0]

note: all credits are given for correct calculation but different normalizing factors (e.g. 1/N instead
of 1/sqrt(N)), same applies below.

1.2) First perform DFT for each row: using DFT [ x1 ] we get [2 0 0 0] in the first and third row

and zero elsewhere. Then perform DFT for each column, using DFT [ x2 ] we get

1 0 0 0
0 0 0 0
 .
1 0 0 0
 
0 0 0 0

1.3) note that x3 .^ 2 = .5 * x3 , then

1.1 0 0.8 0
0 0 0 0
DFT 2[ x4 ] = DFT [0.6 x3 .^ 2 + 0.8 x3 ] = 
T

0.3 0 0 0
 
0 0 0 0

The convolution/product property of FFT, but that’s obviously more cumbersome.


Problem 2 (50 pts)

2.1) (10 pts) An observed image is affected by convolution with a Point Spread
Function h(x, y), plus random additive noise n(x, y), so that g(x, y) = f(x, y) * h(x, y) +
n(x, y). Describe how the image is restored using the Inverse Filtering method. Give a
mathematical expression for the noise n'(x,y) in the restored image f'(x,y). i.e. f'(x,y) =
f(x,y) + n'(x,y).

The distorted image g(x, y) shown below is affected by constant speed motion plus
noise. Hence h(x, y) is a square impulse function in x. Below right is shown the
transfer function H(u, v) which is the Fourier transform of h(x, y), also shown is a
slice through this transfer function the first local minimum of this function is -0.217
and the first local maximum has value 0.128).

To restore the image the Pseudo-Inverse method is used with two different values of
the minimum amplitude of H, e= 0.25 and e= 0.15. Copy the H(u, 0) slice and draw
on the restoring filter slices R(u, 0) for both values of e.
2.2) (15 pts) After applying the Pseudo-Inverse filter for e=0.25 the restored image
equals the true image convolved by a residual PSF plus noise. Give a drawing of the
residual PSF.

2.3) (15 pts) After applying the Pseudo-Inverse filter for e=0.15 what is the shape of
the residual transfer function? Give a drawing of the residual PSF with which the
restored image is convolved.

2.4) (10 pts) Compare the residual random noise in the three restorations in (a-c)
above in terms of total noise power and justify your ranking.

Solution:

2.1) n' ( x, y ) = IFFT ( FFT (n( x, y )) / FFT (h( x, y )) )

2.2)

f ' (u , v) = ( f (u, v) H (u, v) + n(u, v)) pinv( H (u, v))

where pinv( H (u , v)) is the pseudo-inverse of H (u , v) .

so
f ' (u , v)
( f (u , v) H (u , v) + n(u , v)) / H (u , v), when | H (u , v) |> e
=
0, otherwise
( f (u , v) + n(u , v) / H (u , v), when | H (u , v) |> e
=
0, otherwise
We can rewrite it as:

f ' (u , v) = f (u , v) R(u, v) + (n(u , v) / H (u, v)) R(u , v) .

Here, R(u , v) is:

1, if | H (u , v) |> e
R(u, v) = 
0, otherwise

Note e = 0.25 . And roughly estimated from the figure of H (u ,0) , we find:

When | u |< 20 , H (u ,0) > e = 0.25 .

So R (u , v) should be:
1, when | u |< 20
R(u, v) = 
0, otherwise
Hence

f ' ( x, y ) = f ( x, y ) * r ( x, y ) + n' ( x, y ) , where

r ( x, y ) = IFFT ( R(u , v)) .

R(u,0) r(x,0)

2.3)

Similarly as in b), however, the only difference is e = 0.15 here. So

1, if | H (u, v) |> 0.15


R (u, v) = 
0, otherwise

From the figure of H (u , v) , we know:

| H (u, v) |> 0.15 ,when − 55 < u < −45 or − 25 < u < 25 or 45 < u < 55 ,

So R (u , v) should be:

1, when − 55 < u < −45 or − 25 < u < 25 or 45 < u < 55


R(u , v) = 
0, otherwise
The residual PSF:

r ( x, y ) = IFFT ( R(u , v)) .


R(u,0) r(x,0)

2.4)

From the discussion above, we know

f ' (u , v) = f (u, v) R (u, v) + (n(u , v) / H (u, v)) R(u, v) .

The total noise should be f ' (u , v) − f (u , v) = f (u , v)( R (u , v) − 1) + ( n(u , v) / H (u , v)) R (u , v)

If only considering the power of the second part ( n(u , v) / H (u , v)) R (u , v) , it is:

a) > c) > b).

However, for the first part: f (u , v)( R (u , v) − 1) , the noise power is:

a) < c) < b).

(In fact, we can consider two extreme cases, e = 0 and e = 1. When e = 1, R (u , v) is always

equal to 0, so the second part ( n(u , v) / H (u , v)) R (u , v) is zero, but the first part

f (u , v)( R(u, v) − 1) would be large; When e = 0, R (u, v) is always equal to 1, hence the first

part f (u , v)( R (u , v) − 1) is zero, but the second part ( n(u , v) / H (u , v)) R (u , v) would be large.

So in practice, the threshold e in pseudo inverse method should be neither too small nor too large,
but carefully chosen with an appropriate value. )

Problem 3 (50 pts, Optional program problem)

In this homework, we want to analyze the energy distributions of different types of images. A zip
pack of the four images used for experiments can be downloaded here.
3.1) [20%] First, convert the input M-by-N color image to the grayscale format. Plot the 2-D log
magnitude of the 2D DFT and DCT of the grayscale image, with center shifted. Visually compare
and comment on the similarity/differences among the images using the two transforms.

3.2) [20%] Apply the truncation windows discussed in the class to keep 25% and 6.25% (1/4 and
1/16) of the DFT and DCT coefficients, i.e. two different ratios for each transform. This truncation
is done by keeping the coefficients of the lowest frequencies (those within a centered smaller
rectangle of (M/2)x(N/2) and (M/4)x(N/4) on the shifted FFT, respectively). Apply the 2D inverse
DFT to reconstruct the image for each of the truncated spectra. Compute the
Signal-to-Noise-Ratio (SNR) value for each of the reconstructed images. Plot the reconstructed
images visually examine and comment on the effects of truncation.

3.3) [10% bonus] Discuss the differences between these two types of images, optionally extend or
validate what you've observed here with new images of your own, i.e., natural photos vs.
diagrams.

banboon monkeyking**

sunflower* hexagon

* from http://www.flickr.com/photos/suneko/208994078/, reused with the creative commons


license.
** from http://www.js.xinhuanet.com/zhuanlan/2005-05/19/content_4256139_3.htm, cartoon
production by Shanghai Animation Studio 1961
3.1)

Baboon Monkey King Sunflower hex


FFT

DCT

We can see clear pattern in both FFT and DCT of the hex image. The fft and DCT of Baboon is
most close to a uniform distribution, because it contains much texture so that the high frequency
part is also quite bright.
3.2)

Baboon Monkey King Sunflower Hex


FFT
25%

SNR = 26.1643 SNR = 24.3129


SNR = 29.8421
SNR = 18.9516
FFT
6.25%

SNR = 20.1158 SNR = 20.4930


SNR = 26.0111
SNR = 15.9172
DCT
25%

SNR = 20.9681
SNR = 20.1723 SNR = 26.3310
SNR = 16.4037

DCT
6.25%

SNR = 16.5664 SNR = 19.3661


SNR = 22.6434
SNR = 14.7330
First of all, it is very obvious that the larger the truncation window is, the better the recovered
image is. The reason is simple: more information is kept when the window is larger. We can also
observe that the simpler (less texture) the image is, the higher quality (higher SNR) the recovered
image is, because we only keep the low frequency part and texture usually causes high frequency.
Generally speaking, the recovery performance of FFT is a little better than that of DCT.

3.3)

Usually, natural photos contain much richer texture than diagrams, hence the high frequency part
of natural objects would be brighter (larger) than that of diagrams. Moreover, natural photos are
more complex, i.e., seldom contain objects with perfect symmetry, so usually we can not see
obvious pattern in its fft or dct. But we can find some perfect pattern in fft or dct of the diagrams
sometimes because of their simple structure.

Вам также может понравиться