z-nexx

Blur kernel generator

Nov 3rd, 2020 (edited)
1,006
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %NOTE: the package octave-image (in debian and AUR) is needed
  2. pkg load image
  3.  
  4. width = 23; %anything above 16 here is big and might cause slow rendering
  5. height = 23;
  6. sigma = 2*pi; %sigma is the standard deviation (i.e. the "width" or sharpness of the blur)
  7.  
  8. h = fspecial('gaussian', [width height], sigma)(:); %generates the gaussian matrix
  9. [scale, index] = max(h);
  10. h = h / scale; %scales the matrix so that the max element = 1
  11. h([index]) = []; %removes the max element (the center one)
  12.  
  13. fprintf('blur-kern = "%d,%d,', width, height)
  14. for n=1:size(h,1)
  15.     fprintf('%.8f,', h(n))
  16. end
  17. fprintf('";\n')
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×