Detecting the edges of a sheet