function [H,x] = createStretchFilter(filterHalfSize, u, w1, w2, sigmaConst);
% The stretch filter
%
% Author: 
% Konstantinos Bitsakos
% Department of Computer Science 
% University of Maryland, College Park
% kbits@cs.umd.edu
%
% References: "Measuring 1st order stretch with a single filter", K. Bitsakos, J. Domke, C. Fermuller, Y. Aloimonos, ICASSP 2008.
%
% January 2008

argc=nargin;

if argc<6 figureNo=0; end; % 0 for no display
if argc<5 sigmaConst=1; end;
if argc<4 w2=-1; end;
if argc<3 w1=-3.5; end;
if argc<2 u=0.25; end;
if argc<1 filterHalfSize=50; end;


xAR = -filterHalfSize:filterHalfSize;
for n=1:length(xAR)
    x=xAR(n);
    G = @(alpha) 1/sqrt(2*pi)/sigmaConst*exp(alpha).*exp(-x^2/2/sigmaConst^2*exp(alpha).^2).*exp(2*pi*i*exp(alpha)*x).*exp(-2*pi*i*alpha*u);
    H(n)=quad(G,w1,w2);
end
