function myline(f,percent) figure(1) imshow(f); ff=double(f); w = [2 -1 -1; -1 2 -1; -1 -1 2]; g=imfilter(ff, w); figure(2), imshow(g, [ ]); gtop=g(1:126, 1:126); gtop=pixeldup(gtop, 4); figure(3); imshow(gtop, [ ]); gbot=g(end-125:end, end-125:end); gbot=pixeldup(gbot, 4); figure(4); imshow(gbot, [ ]); g=abs(g); figure(5), imshow(g, [ ]); T=max(g(:)); g = g>=percent*T; figure(6), imshow(g)