1. An image processing apparatus comprising: a candidate pixel detector for detecting candidate pixels that are candidates for pixels constituting boundary lines of sides of a document region from image data; a classifier for classifying coordinates of the candidate pixels into a plurality of coordinate groups; an approximate line calculator for calculating a plurality of approximate lines for the boundary line based on the coordinates belonging to each of the plurality of coordinate groups; a provisional line determination unit for selecting any one of the approximate lines based on the number of candidate pixels that are within a predetermined distance from the respective approximate lines and determining a provisional line of the boundary line based on the selected approximate line; a shadow detector for detecting a shadow image of an edge of the document within a predetermined distance from the provisional line; and a boundary line determination unit for determining whether the boundary line is within the predetermined distance from the provisional line based on a detection result of the shadow image.