1. An edge detection method for detecting a substantially linear edge in a digital image, the method comprising the steps of: calculating a pixel gradient value for each of a plurality of pixels of a digital image, the pixel gradient value representing the difference of a pixel value with respect to at least one neighbouring pixel; for each of a plurality of binarization threshold values, determining a corresponding edge map representing the location of pixel gradient values exceeding the binarization threshold value with respect to a side of the digital image; for each edge map, computing a measure of linearity; determining an optimal binarization threshold value based on the computed measures of linearity; and selecting the edge map corresponding to the optimal binarization threshold value.