Digital Signal Processing Labs (PGEE11108)
Digital Signal Processing Labs
Digital Signal Processing Labs (PGEE11108)
Marked Assignment 1
Digital sampling and aliasing
Submission Deadline: 4pm 22nd February 2021
ALL SUBMISSIONS MUST BE THE STUDENTS OWN INDIVIDUAL WORK. SUBMISSIONS WILL BE
CHECKED USING ANTI-PLAGARISM SOFTWARE. PLAGARISM AND COPYING WILL BE SUBJECT TO
PENALTY.
Instructions
This assignment forms the first part of the marked assessment process for Digital Signal Processing Labs course PGEE11108.
The completed solution for this assignment must be submitted via Learn by the deadline above. All solution reports should be in the
form of a word document. Submissions should be made up of two elements:
1. A report of no more than 3 pages (excluding appendix) describing your understanding of the problem and providing a
detailed description of your proposed solutions and observations. All figures included should be clearly presented and fully
and correctly labelled.
2. MATLAB code created in the exercise should be fully commented and included in the appendix of the report. No other
material may be included in the appendix
Marks will be awarded for the following components of the work: Overall presentation 10%, Problem understanding 50%, and
Results and Conclusions 40%.
NOTE: MATLAB HAS A NUMBER OF SPECIFIC ROUTINES FOR INTERPOLATION OR RE-SAMPLING OF SIGNALS, AND
RESIZING AND ROTATING IMAGES. THESE ARE NOT TO BE USED FOR THE PURPOSES OF THIS LAB.
Digital sampling and aliasing
Introduction
Digital signals and images are often provided with standard sampling rates (audio) or resolutions (images). For example, high quality
music is usually sampled at 44 kHz while for telephone quality speech it is sufficient to sample between 5-8 kHz. Low resolution
computer images are often digitized to VGA resolution (640 x 480) while digital camera images for an 8 Megapixel camera are 3264
x 2448.
Moving from one sampling rate to another in audio signals or changing the resolution of an image is called digital resampling and a
very useful tool in DSP. This lab will investigate the task of resampling, including up-sampling, down-sampling and the role of anti-
aliasing filters. During this assignment you will see that the challenges of digital resampling in images are very similar to those of
analogue sampling and reconstruction.
Assignment
Up-sampling
1) Write a Matlab function to upsample a 1D digital signal by a factor of P. This should first interleave P zeros between the
samples and then use a linear interpolation filter (c.f. lab session 2) to interpolate between the nonzero values. Your report
should describe the keys steps in your code.
a.kik (
①
) ②③
FaThos Bd
.
@ 7148191 Matlab
213 Ifscode .
I 37 Bm¥#FgmotelKEI
'IzaakKim samplingYE-KG88.
I
cosenx> .
Mr C
m ffins#aTB
PGEE11108 2
2) Using your solution from part 1 write a new Matlab function to up sample an image by a factor P in each direction. Your report
should identify how this is equivalent to filtering with a separable, approximate low pass 2D filter.
3) Use your Matlab function from part 2 to up sample the lighthouse image provided in the resources by a factor of 5.
Comment on the ability of the function to preserve detail and edges in the image and explain your observations in terms of
frequency.
Down-sampling and aliasing
4) Next load in the star_chart image from the resources and down sample by factors of 2 and 4 in each direction. Describe
how the aliasing appears visually and explain your observations in terms of spatial frequencies.
5) Aliasing can be reduced by using an anti-aliasing filter to first remove the high frequency content of an image prior to down
sampling. Explain how you can use the 2D filters from part (2), with an appropriate cut-off frequency, to down sample images
with reduced aliasing. Hence generate alias-free 2x and 4x down sampled versions of the star_chart image.
Demosaicing
Most digital cameras acquire images using a single image sensor overlaid with a color filter array so that each pixel only records a
single color. The most common filter array is the Bayer filter, illustrated in figure 2. This has alternating red (R) and green (G) filters
for odd rows and alternating green (G) and blue (B) filters for even rows. Note there are twice as many green filters as red or blue
ones, catering to the human eye's higher sensitivity to green light.
In order to reconstruct a full color image from the pixel information at the same resolution it is therefore necessary to perform some
form of interpolation. This is called demosaicing.
6) Explain how you can use your solution from part 2 to demosaic an image acquired using a Bayer filter. Hence generate a full
color version of the image Bayer_peppers image provided in the resources. What are the issues with this method?