1. An image processing apparatus comprising: an edge pixel extractor for extracting edge pixels from an input image; a line extractor for extracting a plurality of lines from said extracted edge pixels; a rectangle candidate extractor for extracting a plurality of rectangle candidates each of which is comprised of four lines, in which two lines each are substantially perpendicular, from said plurality of lines; and a rectangle selector for, for each of said plurality of rectangle candidates, finding a number of edge pixels within a predetermined distance of each side of said rectangle candidate, using a distribution of edge pixels near each corner of said rectangle candidate as the basis to find a corner likeness of each corner, and using said number of edge pixels and degree of corner likeness as the basis to select a rectangle from said plurality of rectangle candidates.