1. An image processing apparatus comprising: a candidate pixel detection circuit for detecting candidate pixels that are candidates for pixels constituting a boundary line of a side of a document region from image data; a classifier circuit for classifying coordinates of the candidate pixels into a plurality of coordinate groups; an approximate line calculation circuit 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 circuit for selecting any one of the approximate lines based on the number of candidate pixels that are within a first predetermined distance from the respective approximate lines and determining a provisional line of the boundary line based on the selected approximate line; a shadow detection circuit for detecting a shadow image of an edge of the document within a second predetermined distance from the provisional line; and a boundary line determination circuit for determining that the boundary line is within the second predetermined distance from the provisional line when the shadow image is detected within the second predetermined distance.