function[FilterArray]=ImgFilter(ImgSize,BW)

%Filter function
%Arguments ImageSize, Bandwidth of Filter


FilterArray=zeros(ImgSize,ImgSize);
Filter=ones(BW,BW);

Middle=ImgSize/2;
FilterWidth=(BW-1)/2;

FilterStart=Middle-FilterWidth;
FilterEnd=Middle+FilterWidth;

FilterArray(FilterStart:FilterEnd,FilterStart:FilterEnd)=Filter(1:BW,1:BW);
