1. An image processing apparatus comprising: a first edge pixel detector for detecting a plurality of first edge pixels from an input image; a straight line detector for detecting a straight line from the plurality of first edge pixels; a classifying module for classifying the plurality of first edge pixels into on-line edge pixels which are located within a predetermined distance from the straight line and non-on-line edge pixels which are not located within the predetermined distance; a second edge pixel detector for detecting second edge pixels located between two of the on-line edge pixels, when any one of the non-on-line edge pixels is between two of the on-line edge pixels; and a determining module for determining whether a non-on-line edge pixel represents a document edge or not, based on whether or not the two on-line edge pixels are connected by the second edge pixels via the non-on-line edge pixel.