1. An image processing apparatus comprising: a processor; a memory storing instructions executable by the processor, wherein the instructions, when executed by the processor, causes the processor to function as: an obtaining unit configured to obtain an image, wherein the image is obtained with an image sensor in which a plurality of pixels, each of which corresponds to one of a plurality of colors, are arranged in a predetermined arrangement, and a plurality of focus detection pixels are also arranged at consecutive positions for pixels corresponding to a particular color of the plurality of colors in a predetermined pixel line; a first setting unit configured to set a first area of the image, the first area including a position of a correction target pixel in the predetermined pixel line, wherein the correction target pixel is a focus detection pixel; a second setting unit configured to set a plurality of second areas of the image, the plurality of the second areas are respectively set based on positions of a plurality of pixels existing in a first reference line, wherein the first reference line is different from the predetermined pixel line and does not include a focus detection pixel; a correlation computing unit configured to compute amounts of correlation between the respective second areas and the first area; and a correction unit configured to compute a correction value by using a value of a pixel in the first reference line, the pixel being determined based on the amounts of correlation, and to correct a value of a pixel at the position of the correction target pixel by using the correction value, wherein the correlation computing unit computes the amounts of correlation while applying a larger weight to a correlation in a portion that is closer to the correction target pixel.