Patent ID: 8681402

Claim:
An image processing apparatus, comprising: a document conveying unit that conveys a document in a predetermined conveying direction; an image reading unit that repeatedly scans the document conveyed by the document conveying unit in a main scanning direction substantially orthogonal to the conveying direction and detects pixel values of a plurality of color components of each pixel; a gradient calculating unit that calculates a gradient in the conveying direction for each pixel and for each of the plurality of color components based on the pixel values of the plurality of color components of each pixel detected by the image reading unit; a gradient comparing unit that compares, for each pixel, a difference of the gradient among the plurality of color components and extracts the pixel, of which the difference of the gradient is below a predetermined threshold value, as a specific pixel; and a document discriminating unit that discriminates whether each pixel is color or black-and-white based on the pixel values of the plurality of color components of each pixel detected by the image reading unit using pixel discrimination criteria different for the specific pixels extracted by the gradient comparing unit and other pixels, wherein a pixel for which a gradient is to be calculated is a target pixel, and the gradient calculating unit calculates, without using the pixel value of the target pixel, a difference between the pixel value of a first adjacent pixel that is adjacent to the target pixel at an upstream side in the conveying direction and the pixel value of a second adjacent pixel that is adjacent to the target pixel at a downstream side in the conveying direction as the gradient in the conveying direction of the target pixel.