Archive

Posts Tagged ‘mask’

Genrating Gaussian Mask

March 24, 2008 Leave a comment

Matlab file for the Gaussian Mask

For some of the masks already generated you can go to https://whatevericode.wordpress.com/2008/04/08/gaussian-masks/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function mask =gaussMask(stdIn)
varIn = stdIn*stdIn;
T = 0.1;
halfSize = round(sqrt(-2*log(T)*varIn))
[x y] = meshgrid(-halfSize:halfSize, -halfSize:halfSize);

mask = (1/(2*pi*varIn))*exp(-0.5*(x.^2 + y.^2)/varIn);
weight = sum(sum(mask));

mask = mask./weight;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%