Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.06 KB | None | 0 0
  1. clear all;
  2. lena = imread('lena.tiff');
  3. lena_gray = rgb2gray(lena);
  4. lena_gray_downsampled = imresize(lena_gray, 0.25, 'bilinear');
  5. lena_gray_upsampled_nearest = imresize(lena_gray_downsampled, 4, 'nearest');
  6. lena_gray_upsampled_bilinear = imresize(lena_gray_downsampled, 4, 'bilinear');
  7. lena_gray_upsampled_bicubic = imresize(lena_gray_downsampled, 4, 'bicubic');
  8.  
  9. cameraman = imread('cameraman.tiff');
  10.  
  11. imshow(lena)
  12. title('Lena')
  13. figure
  14.  
  15. imshow(lena_gray)
  16. title('Lena Gray')
  17. figure
  18.  
  19. imshow(lena_gray_downsampled)
  20. title('Lena Gray Downsampled 4x Bilinear')
  21. figure
  22.  
  23. imshow(lena_gray_upsampled_nearest)
  24. title('Lena Gray Upsampled 4x Nearest')
  25. lena_gray_psnr_nearest = calculate_psnr(lena_gray, lena_gray_upsampled_nearest)
  26. figure
  27.  
  28. imshow(lena_gray_upsampled_bilinear)
  29. title('Lena Gray Upsampled 4x Bilinear')
  30. lena_gray_psnr_bilinear = calculate_psnr(lena_gray, lena_gray_upsampled_bilinear)
  31. figure
  32.  
  33. imshow(lena_gray_upsampled_bicubic)
  34. title('Lena Gray Upsampled 4x Bicubic')
  35.  
  36. lena_gray_psnr_bicubic = calculate_psnr(lena_gray, lena_gray_upsampled_bicubic)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement