Starting from:

$25

CSE4084 -MultimediaHW1 -Solved

Problem 1
 

In this problem and the next, you will implement spatial-domain low-pass filtering using MATLAB, and evaluate the difference between the filtered image and the original image using two quantitative metrics called the Mean Squared Error (MSE) and Peak Signal-toNoise Ratio (PSNR). Given 𝑁" × 𝑁$ images 𝑥(𝑛", 𝑛$) and 𝑦(𝑛", 𝑛$), the MSE is computed as:

 

 𝑀𝑆𝐸 = 𝑁"1𝑁$ 604878"604575"[𝑥(𝑛", 𝑛$) − 𝑦(𝑛", 𝑛$)]$

 

The PSNR is defined as 𝑃𝑆𝑁𝑅 = 10   𝑙𝑜𝑔      "@ ABCD BFGE5H, where 𝑀𝐴𝑋K is the maximum possible pixel value of the images. For the 8-bit gray-scale images considered in this problem,

𝑀𝐴𝑋K = 255.

 

Follow the instructions below to finish this problem.  

(1)   Download the original image for this question (Lena.gif). The original image is a 256 × 256 8-bit gray-scale image.  

 

(2)   Convert the original image from type ‘uint8’ (8-bit integer) to ‘double’ (real number).  

 

(3)   Create a 3        ×         3 low-pass filter with all the coefficients equal to 1/9, i.e., create a

                3  × 3 MATLAB array with all elements equal to 1/9.  

 

(4)   Low-pass filter the original image (converted to type ‘double’) with the filter created in step (3). This can be done using the built-in MATLAB function “imfilter”. The function “imfilter” takes three arguments and returns one output. The first argument is the original image (converted to type ‘double’); the second argument is the lowpass filter created in step (3); and the third argument is a string specifying the boundary filtering option. For this problem, use ‘replicate’ (including the single quotes) for the third argument. The output of the function “imfilter” is the filtered image.  

 

(5)   Compute the PSNR value between the original image (converted to type ‘double’) and the filtered image by using the formulae given above.  

 

 

 

 

 

Problem 2
 

Repeat steps (3) through (5) in the previous question, this time using a 5   ×         5 low-pass filter with all the coefficients equal to 1/25. Compute the PSNR value up to two decimal points.  

 

 

Problem 3  
 

In this problem you will get hands-on experience with changing the resolution of an image, i.e., down-sampling and up-sampling. Follow the instructions below to finish this problem.  

 

(1)   Download the original image for this question (original.jpg). The original image is an 8-bit gray-scale image of width 479 and height 359 pixels. Convert the original image from type ‘uint8’ (8-bit integer) to ‘double’ (real number).  

 

(2)   In order to avoid aliasing (e.g. jagged edges) when downsampling an image, you will need to first perform low-pass filtering of the original image. For this step create a 3 × 3 low pass filter with all coefficients 1/9. Perform low-pass filtering with this filter using the MATLAB function “imfilter” with ‘replicate’ as third argument.  

 

(3)   Obtain the down-sampled image by removing every other row and column from the filtered image, that is, removing the 2nd, 4th, all the way to the 358th row, and then removing the 2nd, 4th, all the way to the 478th column. The resulting image should be of width 240 and height 180 pixels. This completes the procedure for image downsampling. In the next steps, you will up-sample this low resolution image to the original resolution via spatial domain processing.  

 

(4)   Create an all-zero MATLAB array of width 479 and height 359. For every odd-valued 𝑖 ∈ [1,359] and odd valued 𝑗 ∈ [1,479], set the value of the newly created array at (𝑖, 𝑗) equal to the value of the low-resolution image at A WX$" , YX$"H. After this step you have inserted zeros into the low-resolution image.  

 

(5)   Convolve the result obtained from step (4) with a filter with coefficients  

[0.25, 0.5,0.25;  

 0.5,    1,    0.5;   0.25,  0.5, 0.25]  

using the MATLAB function “imfilter”. In this step you should only provide “imfilter” with two arguments instead of three, that was the case in step (1). The two arguments are the results from step (4) and the filter specified in this step. This step essentially performs bilinear interpolation to obtain the up-sampled image.  

 

(6)   Compute the PSNR between the upsampled image obtained from step (5) and the original image.   

  

 

 

 

More products