1. An image processing apparatus configured to generate, based on a plurality of images photographed from a plurality of different viewpoints, an image viewed from a virtual viewpoint that is located outside the plurality of different viewpoints, the image processing apparatus comprising: a calculation unit configured to calculate a near image distance, which corresponds to a distance from the virtual viewpoint to a first viewpoint among the viewpoints of the plurality of images, and a far image distance, which corresponds to a distance from the virtual viewpoint to a second viewpoint among the viewpoints of the plurality of images, which is relatively distant from the virtual viewpoint compared with the first viewpoint; a search range setting unit configured to set a search range; a determination unit configured to determine parallax vectors corresponding to search reference block coordinates by executing block matching processing within the search range and by using a first block image, which is included in a near image corresponding to the first viewpoint and which corresponds to the search reference block coordinates and the near image distance, and a second block image, which is included in a far image corresponding to the second viewpoint and which corresponds to the search reference block coordinates and the far image distance; and a generation unit configured to generate the image from viewed from the virtual viewpoint by using the parallax vectors.