1. An image processing apparatus comprising: a gradient calculator configured to calculate a direction and a magnitude of a gradient of each pixel in an input image using neighboring pixel values; a histogram calculator configured to calculate a Histogram of Oriented Gradients, which contains a plurality of sampled directions, from the directions and the magnitudes of the gradients calculated for the pixels in a region including the pixel being processed of the input image; a storing unit configured to store a plurality of smoothing filters and a template of Histogram of Oriented Gradients in association with each other; a search unit configured to calculate errors between the Histogram of Oriented Gradients calculated for the pixel being processed and the Histograms of Oriented Gradients stored in the storing unit and search the Histograms of Oriented Gradients stored in the storing unit for the Histogram of Oriented Gradients that has a minimum error; and a filter processing unit configured to acquire one of the smoothing filters that is stored in association with the Histogram of Oriented Gradients having the minimum error from the storing unit and determine a corrected pixel value of the pixel being processed by filter processing with the acquired smoothing filter.