function out=ff(sigma)
global img t

tt=((filter2(fspecial('gaussian',[21 21],sigma),img)-t)).^2;
out=sum(tt(:));
