1. An image processing apparatus comprising: an edge pixel extractor circuit for extracting edge pixels from an input image; a line extractor circuit for extracting a plurality of lines from said extracted edge pixels; a rectangle candidate extractor circuit for extracting a plurality of rectangle candidates each of which is comprised of four lines, in which two lines each are substantially perpendicular to each other, from said plurality of lines; and a rectangle selector circuit for calculating, for each of said plurality of rectangle candidates, a first evaluation score calculated based on the number of edge pixels in a predetermined distance from each side of said rectangle candidate; a second evaluation score which increases as the number of edge pixels distributed along each side near each corner of said rectangle candidate increases, and decreases as the number of edge pixels distributed along an extension of each side near each corner of said rectangle candidate increases; and to use a total of said first evaluation score and said second evaluation score as the basis to select a rectangle from said plurality of rectangle candidates.