Lab #2
University of Lahore
Digital Image Processing
Digital Image Sampling
Marks:- 10
Objective:
By the end of this lab students will be able to know the basics of digital images
sampling by different techniques.
Pre-Lab Tasks:
MATLAB Commands
Downsample:- Downsample input signal
Upsample
fir1:- FIR filter design using the window method.
Imresize
Interp
In-Lab Tasks:
Task-1a):
i. Read an image file rice.png in a variable x by using
x=imread(rice.png)
ii. Display the image.
iii. Downsample image x by a factor 2.
iv. Display fourier transforms of both original and downsampled images and try to
find differences in both images.
Task-1b):
i. Read image file cameraman.tif.
ii. Downsample it by factor 8 and upsample it and observe the result.
iii. Again downsample the image to get 32x32 image.
iv. Upsamle the image by factor 2 and observe the result.
Task-2:
Read image file cameraman.tif.
Perform Nearest Neighbor interpolation by using imresize matlab function.
Perform Bilinear interpolation by using imresize matlab function.
Lab #2
Perform Bicubic interpolation by using imresize matlab function.
Task-3:
Read image file cameraman.tif
i. Make a horizontally flipped version of the image by reversing the order of each
column. Similarly, create a vertically flipped image. Print your results.
ii. Now, create a "negative" of the image by subtracting each pixel from 255 (here's
an example of where conversion to double is necessary.) Print the result.
iii. Finally, multiply each pixel of the original image by 1.5, and print the result.
Task-4:
Repeat Task-1 but now implement it by using interp function of matlab.
Task-5:
Perform Nearest Neighbor interpolation without using any matlab built-in
function.