%the 'other' gradient function out = o_grad(img) img = rgb2gray(img); img = medfilt2(img,[7,7]); out = gradient(img); % out = mat2gray(out); thres = prctile(out(:), 99.78); %out = dialate(out, thres); se = strel('disk',30); out = imdilate(out, se); out = out .* (out >= thres);