DOC PREVIEW
UT Arlington EE 5355 - Avik_Pal_Project4

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

AVIK PAL UTA_ID:1001113861 Project 4b DCT2DAssignment 2.1. Apply 2D dct on the input imageProgramming:clcclear allclose all%Read the image%M_Size = 8;X_Img = imread('lena512.bmp');[r,c] = size(Img);%creating an array with r and c to calculate 2*2 matrix,X_image%OutputObservation:I got 512*512 matrix after reading the image using imread command and applying 2d DCT on it.2.Apply zonal filter of 2:1,4:1,8:1,16:1 for sample reductionProgramming;Img_8_8 = zeros(Size,Size);%initializing the filters%Img_8_8_mask_2_1 = zeros(Size,Size);Img_8_8_mask_4_1 = zeros(Size,Size);Img_8_8_mask_8_1 = zeros(Size,Size);Img_8_8_mask_16_1 = zeros(Size,Size);%initilizing 4 matrix which will contain idct values%Mask_2_1_IDCT = zeros(r,c);Mask_4_1_IDCT = zeros(r,c);AVIK PAL UTA_ID:1001113861 Project 4b DCT2DMask_8_1_IDCT = zeros(r,c);Mask_16_1_IDCT = zeros(r,c); for i = 1:Size:r for j = 1:Size:c Img_8_8 = dct2(Img(i:i+Size-1,j:j+Size-1)); for m = 1 : Size for n = 1 : Size-m+1 Img_8_8_mask_2_1(m,n) = Img_8_8(m,n); end end for m = 1 : Size/2 for n = 1 : Size/2 Img_8_8_mask_4_1(m,n) = Img_8_8(m,n); end end for m = 1 : 3 for n = 1 : 3 if(m == n == 3) n = 2; end Img_8_8_mask_8_1(m,n) = Img_8_8(m,n); end end for m = 1 : Size/4 for n = 1 : Size/4 Img_8_8_mask_16_1(m,n) = Img_8_8(m,n); end endOutput:Filter for 2:1AVIK PAL UTA_ID:1001113861 Project 4b DCT2DFilter for 4:1Filter for 8:1Filter for 16:1AVIK PAL UTA_ID:1001113861 Project 4b DCT2DObservation:I created 4 filters based on the project statement and all are 8*8 matrix3.Apply block based 2D IDCT on result of 2Programming:%calculating 2 D IDCT% Mask_2_1_IDCT(i:i+Size-1,j:j+Size-1) = idct2(Img_8_8_mask_2_1); Mask_4_1_IDCT(i:i+Size-1,j:j+Size-1) = idct2(Img_8_8_mask_4_1); Mask_8_1_IDCT(i:i+Size-1,j:j+Size-1) = idct2(Img_8_8_mask_8_1); Mask_16_1_IDCT(i:i+Size-1,j:j+Size-1) = idct2(Img_8_8_mask_16_1);Output:IDCT for 2:1 filterAVIK PAL UTA_ID:1001113861 Project 4b DCT2DIdct for 4:1IDCT for 8:1AVIK PAL UTA_ID:1001113861 Project 4b DCT2DIDCT for 16:1Observation:I applied 2d IDCt on the result set and resultant matrix are of 512*512 size which are of the same dimension of the original image.4.Calculate MSE for the reconstructed Programming:%Calculating MSE as given by the problem%AVIK PAL UTA_ID:1001113861 Project 4b DCT2DMSE_Mask_2_1_IDCT = (1/(r*c)) * sum(sum((double(Img) - Mask_2_1_IDCT).^2));MSE_Mask_4_1_IDCT = (1/(r*c)) * sum(sum((double(Img) - Mask_4_1_IDCT).^2));MSE_Mask_8_1_IDCT = (1/(r*c)) * sum(sum((double(Img) - Mask_8_1_IDCT).^2));MSE_Mask_16_1_IDCT = (1/(r*c)) * sum(sum((double(Img) - Mask_16_1_IDCT).^2));Output:>> disp (MSE_Mask_2_1_IDCT) 5.5198>> disp (MSE_Mask_4_1_IDCT) 21.9303>> disp (MSE_Mask_8_1_IDCT) 44.2367>> disp (MSE_Mask_16_1_IDCT) 98.73435.Calculate PSNRProgramming: %Calculating PSNR as given by the problem%PSNR_Mask_2_1_IDCT = 10 * log10((255*255)/MSE_Mask_2_1_IDCT);PSNR_Mask_4_1_IDCT = 10 * log10((255*255)/MSE_Mask_4_1_IDCT);PSNR_Mask_8_1_IDCT = 10 * log10((255*255)/MSE_Mask_8_1_IDCT);PSNR_Mask_16_1_IDCT = 10 * log10((255*255)/MSE_Mask_16_1_IDCT);%reconstructed signal%imshow(uint8(Mask_8_1_IDCT));Output:>> disp (PSNR_Mask_2_1_IDCT) 40.7116>> disp (PSNR_Mask_4_1_IDCT) 34.7204>> disp (PSNR_Mask_8_1_IDCT) 31.6730>> disp (PSNR_Mask_16_1_IDCT) 28.1861AVIK PAL UTA_ID:1001113861 Project 4b DCT2DShow the reconstructed SignalConclusion:I use DCT to use image compression and the reconstructed signal is almost similar to the original one.DCT expresses a finite sequence of data points in terms of a sum of cosine functions oscillating at different frequencies.In this project I can see the PSNR is higher than the first one. But the reconstructed image is similar to the original


View Full Document
Download Avik_Pal_Project4
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Avik_Pal_Project4 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Avik_Pal_Project4 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?