1. An image processing apparatus comprising: a determination unit configured to determine a target pixel and a pixel used as a reference pixel among pixels of a pixel array included in a predetermined area within a predetermined distance from the target pixel in RAW image data, the RAW image data having arrayed pixel values of different color components; and a generation unit configured to generate corrected image data by correcting a pixel value of the target pixel in the RAW image data, based on a similarity between the target pixel and each reference pixel, wherein the target pixel and each reference pixel have pixel values corresponding to one color component, and the pixel determined as the reference pixel by the determination unit has a pixel value of the same color component as the target pixel and the pixel array within a predetermined distance from the pixel determined as the reference pixel by the determination unit is the same pixel array within a predetermined distance from the target pixel.