% Description:
%
%       weight.m returns a hat function for pixels 0 to 255
%       
% Input:
%
%       NONE
%
% Output:
%
%       w - array of the hat function for pixels 0 to 255
%

function [w] = weight()

Zmin = 0;
Zmax = 255;
w = ones(Zmax-Zmin+1,1);

for z = Zmin:1:Zmax,
    if z <= floor((Zmin+Zmax)/2)
        w(z+1,1) = z-Zmin;
    else
        w(z+1,1) = Zmax-z;
    end
end