1. A skew detection apparatus, the apparatus comprising: an input to receive an image of a document; and a processor to, for each of a plurality of sides of the image: determine locations of a set of foreground pixels or a set of edge pixels of the document that are nearest to the side of the image; generate from said set of pixels an estimate of a probability distribution of values of an angle of a line joining two pixels of a subset of pairs of pixels chosen from among all possible pairs of pixels from the set, wherein a distance between the pixels in each pair of the chosen subset of pairs of pixels is predefined; and determine the angle corresponding to a maximum value of a plurality of values in the estimated probability distribution, produce a first estimated skew angle by combining said angles determined for each of the plurality of sides of the image, and estimate a first confidence value for the first estimated skew angle.