1. An image rectification method comprising: detecting edges in an image by using a Canny filter; performing Hough transform on the edges to detect lines in the image; selecting a candidate quadrangle from quadrangles formed by the detected lines; obtaining a transform matrix for transforming the candidate quadrangle to a rectangle by homographic transform; rectifying the image by using the transform matrix; and enhancing the rectified image, wherein the step of enhancing the rectified image comprises: building a luminance histogram of the image, wherein the luminance histogram has a low region, a middle region, and a high region; and extending the range of the middle region, wherein the percentage of the low region in the image and the percentage of the high region in the image are larger than a threshold value.