1. An image processing apparatus, comprising: an image photographing unit configured to photograph a document; and a control unit including a document image acquiring unit configured to acquire a document image including at least an image of the document photographed by the image photographing unit, a contour extracting unit configured to extract, based on luminance of the document image, a contour of the document from the document image acquired by the document image acquiring unit, a distortion position detecting unit configured to detect a contour straight line located at a location where a distance between the contour extracted by the contour extracting unit and a center point of a rectangle having the minimum area surrounding the contour is shortest, the contour straight line being detected as a distortion position of a distortion in the document image, the contour straight line being located on the contour, the distance being on a diagonal line of the rectangle, and a corrected image generating unit configured to perform geometric correction on the document image to extend the contour to a correction reference line determined from the distortion position detected by the distortion position detecting unit, and generate a corrected image having the distortion in the document image corrected.