1. An image processing method, which is implemented by a computer, comprising: acquiring multiple parallax images of an object captured using an image capturing optical system, the parallax images having a parallax to one another; acquiring, by using the respective parallax images as mutually different base images, relative difference information for each of the mutually different base images on a relative difference between that base image and at least one other parallax image in the multiple parallax images; detecting an unwanted component contained in each of the parallax images by using the relative difference information acquired for the mutually different base images, the unwanted component corresponding to light reflected inside the image capturing optical system; and outputting an output image generated based on the detected unwanted component and at least one of the parallax images.