1. An apparatus comprising: a memory storing a program; and a processor which executes the program stored in the memory to perform operations including: calculating a similarity between a pixel value of a target pixel and a pixel value of a reference pixel located in a vicinity of the target pixel and a similarity between the pixel value of the target pixel and an average value of pixel values of reference pixels located in the vicinity of the target pixel, in an input image; calculating a weighting factor respectively for the pixel value of the reference pixel and the average value of the pixel values of the reference pixels having such a similarity that a ratio or a difference with respect to a multiplication result of multiplying a highest similarity among the calculated similarities by a coefficient equal to or more than a first predetermined threshold is equal to or more than a second predetermined threshold, the weighting factor being higher when the ratio is lower or the difference is smaller; calculating a weighted average value of the pixel value of the reference pixel and the average value of the pixel values of the reference pixels by use of the calculated weighting factors; calculating a difference value between the pixel value of the target pixel and the weighted average value; calculating an isolation degree to judge whether the target pixel is a pixel to be corrected on the basis of the calculated difference value; and correcting the target pixel on the basis of the calculated isolation degree.