function crop = imagecrop(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,1) < 100 | img(x,y,2) < 100 | img(x,y,3) < 100) tlx = x; tly = y; tl = 1 end end end tlx tly