Image decimation and interpolation Solution



  1. Image decimation and interpolation: read the given 420×560 gray-scale image – “building.jpg” and store it as a variable xc. Perform the following image processing and see the effects by your own eyes (see also, textbook Fig. 6.36).

  1. Downsampling and linear (i.e., bilinear or bicubic) interpolation: Sample xc by

taking every 5th pixel horizontally and vertically to create a downsampled image x with its size = 84×112. Interpolate x to the size 420×560 to obtain xs. Display images xc, xs, and x and comment on their appearance.

The interpolation can be done with MATLAB function, imresize() with bilinear interpolation or bicubic interpolation or similar MATLAB functions.

  1. Decimation (i.e., antialiasing filtering + downsampling) and linear (i.e., bilinear or bicubic) interpolation: First blur the image xc using an anti-aliasing LPF to obtain

filtered image yc, then sample it by taking every 5th pixel horizontally and vertically to create a downsampled image y of size 84×112, and finally linearly interpolate y to the size 420×560 to obtain ys. Display images yc, ys, and y. Compare their appearance with those in (a) and comment on the antialiasing effects and any other effects if there is any (explained in the class) you observe.

Note that you have to design a proper anti-aliasing filter for the downsampling being performed. You can design the antialiasing filter with the help of the MATLAB function fir1() which provides you the finite impulse response of a 1-D digital filter. Please extend the 1-D filter generated by the fir1() to a 2-D filter by the concept taught in Topic 2 (see slide 100 and slide 101 in Topic2_ReviewOfFreqDomainAnalysis_Part2_HandWriting0406_2017.pdf), and then perform the 2D filtering with MATLAB function conv2().

The frequency response of the designed filter can be verified by the MATLAB function freqz() if needed. Please justify how you design the FIR filter and how you determine the required length of the impulse response of the FIR filter (i.e., how you determine the cutoff frequency and order of the FIR filter. Filter length = filter order + 1.).

  1. Implement your own interpolator, i.e., low pass filtering the upsampled signal. For example, upsample x in (a) and y in (b) to the size 420×560 to obtain xu and yu,


respectively (see the provided sample codes), and then low pass filter xu and yu to obtain xs and ys, respectively. Please design the 2D anti-image LPF with the help of the MATLAB function fir1(), as you did in (b). Justify how you determine the filter parameters, i.e., cutoff frequency and order for fir1(). Repeat (a) and (b) with your own interpolator, compare and comment on the results.

  1. Interpolate xc to the size 630×840 to obtain xi. Display images xc and xi, and comment on their appearance. Note that no MATLAB interpolation function can be used. Please specify how you implement the interpolation and the specification of your low pass filter as well if there is any.

  1. Please leverage and modify the sample codes provided in HW1 to perform 2D Fourier analysis over xc, xs, yc, ys, and xi. The 2D Fourier analysis simply needs to be done at the fundamental frequency range. You may also try to perform the 2D Fourier analysis over multiple fundamental frequency ranges. Please justify your finding over the 2D Fourier spectra of the 5 images. Via the 2D Fourier analysis, please verify whether aliasing distortion occurs or not for the 5 images, respectively (see also, textbook Fig. 6.34). You may need to perform log-conversion of the magnitude spectrum in order to visualize the changes in details.

Below are some useful MATLAB pseudo-codes:


LogConvertedSpectrum = 20*log10(2D magnitude spectrum/max(max(2D magnitude spectrum)));



colormap(gray); % or try colormap(jet)


  1. Please hand in your solution files to the LMS elearning system, including your word file of the detailed solutions, the associated Matlab codes, and all the related materials. It would be nice that you can put your codes with comments side by side along with your answer in the word file.

  1. Name your solution files “EE3660_HW4_StudentID.doc” and “EE3660_HW4_StudentID.m”, and archive them as a single zip file:

  1. The first line of your word or Matlab file should contain your name and some brief description, e.g.,