Home > matlab, probability > Genrating Gaussian Mask

Genrating Gaussian Mask

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;

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

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: