1. An image processing apparatus comprising: an edge pixel extractor for extracting edge pixels from an input image which includes a document; a grouping unit for forming mutually adjoining edge pixels in said extracted edge pixels into a group; and an approximated line detector for detecting a line which connects edge pixels which are positioned at the two ends in a horizontal direction or vertical direction among edge pixels which are included in said group as a line which approximates an end of said document.