function crop = imagecropg(img) % Gets rid of the white border around a Matlab created surface image. s = size(img) s(1) s(2) tl = 0; tlx = 0; tly = 0; for x = 1:s(1) if(tl == 1) break; end for y = 1:s(2) if(tl == 1) break; end if (img(x,y) < 100) tlx = x; tly = y; tl = 1 end end end tlx tly