1. An image processing apparatus comprising: a preprocessor that determines, based on an input image, a calculation range of a calculation which detects an edge direction in the input image; and an edge direction detection unit that performs the calculation within the calculation range determined based on the input image to detect the edge direction, wherein the preprocessor determines the calculation range based on a result of a first determination that determines whether the edge direction is closer to a horizontal direction of the input image or closer to a vertical direction of the input image, and a result of a second determination that determines a quadrant to which the edge direction belongs.