1. A method for detecting a position of a sheet of light in an image, the method comprising: receiving an image of the sheet of light as projected onto an object, the image comprising a line of pixels with an associated intensity profile; setting a size S of a derivative filter to be at least as large as a width W of a widest peak to be detected in the intensity profile; determining a region of interest for detection by locating intensity differences in the intensity profile that are at least as large as a threshold value; applying the derivative filter of size S to the intensity profile to obtain a slope of the intensity profile; detecting one or more zero-crossings in the slope of the intensity profile inside the region of interest, each one of the one or more detected zero-crossings having a corresponding pixel position in the intensity profile; selecting a zero-crossing from the one or more detected zero-crossings; and outputting the corresponding pixel position of the selected zero-crossing as the detected position of the sheet of light for the line of pixels.