function result = mythreshold(grayimg, t)
    % grayimg is the grayscale image
    % t is the threshold value 
    % each pixel value that are greather than t in the input picture will be   
    % changed to 1, while the other are changing to 0
    
    
	result = grayimg;
	img_size = size(grayimg);
	h = img_size(1);
	w = img_size(2);
	for i = 1:h; 
		for j = 1:w; 
			if ( grayimg(i,j) > t) 
				result(i,j) = 1;
			else
				result(i,j) = 0;
			end;
		end;
	end;
end