function mypoint(f,percent) figure(1) imshow(f); ff=double(f); w = [-1 -1 -1; -1 8 -1; -1 -1 -1]; g=abs(imfilter(ff, w)); %g=abs(imfilter(double(f), w)); T=max(g(:)); g = g>=percent*T; figure(2); imshow(g) m=3; n=3; h=imsubtract(ordfilt2(ff,m*n,ones(m,n)), ordfilt2(ff,1,ones(m.n))); % ordfilt2(ff,m*n-1,ones(,m.n))); h=h>=percent*T; figure(3); imshow(h)