1. An image processing apparatus comprising: a binary image generating unit configured to generate a binary image from a multi-value image; a ruled line candidate extracting unit configured to extract ruled line candidate pixels that constitute a ruled line from the binary image; an edge detecting unit configured to determine, from the multi-value image, a target pixel that is positioned near a ruled line candidate pixel from among the ruled line candidate pixels, detect edge information indicative of whether the target pixel constitutes an edge, and repeat determination of the target pixel and detection of the edge information for a plurality of pixels from among the ruled line candidate pixels; and a ruled line obtaining unit configured to obtain a ruled line from the multi-value image based on the edge information detected by the edge detecting unit, wherein the edge detecting unit is configured to perform spatial filtering on an area that includes the target pixel and pixels around the target pixel, and when an output obtained from the spatial filtering is larger than a threshold, the edge detecting unit is configured to detect information on the target pixel as the edge information.