Advertisement
makispaiktis

Tutorial - Blur Lena Image with fspecial

Aug 10th, 2021 (edited)
1,923
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.56 KB | None | 0 0
  1. clc
  2. clear all
  3.  
  4. % MAIN FUNCTION
  5. A = imread('lena.png');
  6. filter = fspecial('gaussian', 25, 5);     % I need a filter that has smaller dimensions than the photo
  7. figure();
  8. % I need a 2D signal-channel
  9. redChannel = A(:, :, 1);
  10. denominatorList = [10, 50, 100, 500, 1000];
  11. for i = 1:length(denominatorList)
  12.     denominator = denominatorList(i)
  13.     newImage = conv2(double(redChannel), filter / denominator);             % Typecast: uint8 ----> double
  14.     imshow(newImage);
  15.     caption = strcat('Filter divided by:', num2str(denominator));
  16.     title(caption);
  17. end
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement