SHARE
TWEET

Untitled

a guest Jan 28th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function [ wynik ] = filtrowanie( obraz )
  2.  
  3. if (size(obraz,3)>1)
  4.     obraz = im2bw(obraz);
  5. end
  6.  
  7. maska = [0.5 1 0.5;1 0.5 1;0.5 1 0.5];
  8. rozm = 1;
  9.  
  10. maska = maska/1;
  11.  
  12. maska
  13.  
  14. [x, y] = size(obraz);
  15. wynik = zeros(x,y);
  16.  
  17. for i = (1 + rozm):(x - rozm)
  18.     for j = (1 + rozm):(y - rozm)
  19.         fragment = obraz(i - rozm:i + rozm, j - rozm:j + rozm);
  20.         wynik(i,j) = sum(sum(fragment.*maska));
  21.     end
  22. end
  23.  
  24. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top