Advertisement
makispaiktis

Tutorial - Gaussian Image

Aug 10th, 2021 (edited)
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.51 KB | None | 0 0
  1. clc
  2. clear all
  3.  
  4. % MAIN FUNCTION
  5. n = 500;
  6. sigmaList = 0:10:100;
  7. for i = 1:length(sigmaList)
  8.     sigma = sigmaList(i)
  9.     H = myGaussian(n, sigma);
  10.     imshow(H);
  11.     caption = strcat('Sigma=', num2str(sigma));
  12.     title(caption);
  13. end
  14.  
  15.  
  16. % Auxiliary Function
  17. function H = myGaussian(n, sigma)
  18.     twoSigmaSquared = 2*sigma*sigma;
  19.     for i =1:n
  20.         for j=1:n
  21.             x = i - n/2;
  22.             y = j - n/2;
  23.             H(i, j) = exp(-(x^2+y^2) / twoSigmaSquared);
  24.         end
  25.     end
  26.     H;
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement