A ranging apparatus comprising: an imaging optical system arranged to form an image of a subject; an imaging unit including a pixel group arranged to acquire a first image and a second image, the first and second images being formed by luminous fluxes having passed mainly through a first pupil area and a second pupil area, respectively, of an emitting pupil of the imaging optical system; and a calculation unit, wherein the calculation unit is configured to create a third image by performing convolution integral on the first image with a first image modification filter as well as to create a fourth image by performing convolution integral on the second image with a second image modification filter, and to calculate a distance up to the subject by comparison of the third and fourth images, wherein the first image modification filter and the second image modification filter are based on a first image modification function and a second image modification function, respectively, and the calculation unit is configured to form each of the first and second image modification filters by: discretizing a respective image modification function to form a respective discrete function at respective sampling points, wherein the sampling points correspond to a pixel arrangement of the pixel group; characterized in that the calculation unit is further configured to form each of the first and second image modification filters by: calculating a respective centroid position of a centroid of the respective discrete function; determining a sampling point of the respective discrete function being closest to the respective centroid position as a respective reference point; and forming the respective one of the first and second image modification filters by correcting the respective discrete function such that a centroid of the respective corrected discrete function coincides with the respective reference point, wherein the first and second image modification functions are based on line spread functions corresponding to the first or second image, or point spread functions corresponding to the first or second image. an imaging optical system arranged to form an image of a subject; an imaging unit including a pixel group arranged to acquire a first image and a second image, the first and second images being formed by luminous fluxes having passed mainly through a first pupil area and a second pupil area, respectively, of an emitting pupil of the imaging optical system; and a calculation unit, wherein the calculation unit is configured to create a third image by performing convolution integral on the first image with a first image modification filter as well as to create a fourth image by performing convolution integral on the second image with a second image modification filter, and to calculate a distance up to the subject by comparison of the third and fourth images, wherein the first image modification filter and the second image modification filter are based on a first image modification function and a second image modification function, respectively, and the calculation unit is configured to form each of the first and second image modification filters by: discretizing a respective image modification function to form a respective discrete function at respective sampling points, wherein the sampling points correspond to a pixel arrangement of the pixel group; discretizing a respective image modification function to form a respective discrete function at respective sampling points, wherein the sampling points correspond to a pixel arrangement of the pixel group; characterized in that the calculation unit is further configured to form each of the first and second image modification filters by: calculating a respective centroid position of a centroid of the respective discrete function; determining a sampling point of the respective discrete function being closest to the respective centroid position as a respective reference point; and forming the respective one of the first and second image modification filters by correcting the respective discrete function such that a centroid of the respective corrected discrete function coincides with the respective reference point, wherein calculating a respective centroid position of a centroid of the respective discrete function; determining a sampling point of the respective discrete function being closest to the respective centroid position as a respective reference point; and forming the respective one of the first and second image modification filters by correcting the respective discrete function such that a centroid of the respective corrected discrete function coincides with the respective reference point, wherein the first and second image modification functions are based on line spread functions corresponding to the first or second image, or point spread functions corresponding to the first or second image.