function BW = myCanny(Img, t1,t2,sigma)
	[m,n] = size(Img);
	Img_blur = imgaussfilt(Img, sigma);
	
	[Gx, Gy] = imgradientxy(Img_blur);
	[Gmag, Gdir] = imgradient(Gx, Gy);
	gN  = nonMaxSupp( Gmag,Gdir );
	gNL = gN>=t1;
	gNH = gN>=t2;
	
	BW = zeros(m,n);
	for i = 2:m-1
		for j = 2:n-1
			if gNH(i,j)
				BW(i,j)=1;
			elseif gNL(i,j)
				if sum(sum(gNH(i-1:i+1,j-1:j+1)))>1
					BW(i,j)=1;
				end
			end             
		end
	end 
end		