1. An image processing apparatus comprising: an image input unit for taking image data including a document region as input; a candidate pixel detector for detecting candidate pixels which are candidates of pixels constituting boundary lines of sides of said document region; a classifier for classifying, for each side of said document region, coordinates of said candidate pixels respectively detected in plural portions of the boundary line 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 said plurality of coordinate groups; a provisional line determination unit for determining a provisional line for the boundary line of said side based on the approximate line having the largest number of candidate pixels within a prescribed distance from the approximate line among said plurality of approximate lines; and an image cropper for cropping an image of said document region based on said provisional line.