An image processing apparatus comprising: an image acquiring unit configured to acquire a first image, which is an image including an eye of a person; an image generating unit configured to generate a second image, which is a binary image representing an edge of the first image, by performing edge extraction and binarization to the first image; a classifying unit configured to classify the pixels included in the second image; and a pupil-region generating unit configured to generate a pupil region, which is a region including a pupil and an iris of the person in the first image, on the basis of a result of the classification, wherein the classifying unit includes: a first classifying unit configured to classify, among the pixels included in the second image, the pixels not corresponding to the edge into a first pixel type and the pixels corresponding to the edge into a second pixel type; and a second classifying unit configured to reclassify, when the pixels not corresponding to the edge are present separately in a plurality of blocks and when there is a block having an area which is smaller than a first threshold, or a block in which an average luminance of the pixels in a corresponding region of the first image is higher than a second threshold, the pixels included in the block into the second pixel type, wherein the first threshold value is 5 % or more and 30 % or less of the largest area among the plurality of blocks, wherein, when a lateral direction of the first image is taken as an X axis and a longitudinal direction of the first image is taken as a Y axis and a region formed by the pixels classified into the first pixel type is set as a provisional pupil region, the pupil-region generating unit sets, as a Y coordinate of a center of the pupil region, an intermediate value between a maximum value and a minimum value of a Y coordinate of the provisional pupil region, calculates X coordinates, each of which is a center point on the X axis of the provisional pupil region, for respective Y coordinates, and determines an X coordinate of the center of the pupil region on the basis of a distribution of the obtained X coordinates, and, as a diameter of the pupil region, a diameter of the provisional pupil region on an axis passing through the center of the pupil region and parallel to the X axis. an image acquiring unit configured to acquire a first image, which is an image including an eye of a person; an image generating unit configured to generate a second image, which is a binary image representing an edge of the first image, by performing edge extraction and binarization to the first image; a classifying unit configured to classify the pixels included in the second image; and a pupil-region generating unit configured to generate a pupil region, which is a region including a pupil and an iris of the person in the first image, on the basis of a result of the classification, wherein the classifying unit includes: a first classifying unit configured to classify, among the pixels included in the second image, the pixels not corresponding to the edge into a first pixel type and the pixels corresponding to the edge into a second pixel type; and a second classifying unit configured to reclassify, when the pixels not corresponding to the edge are present separately in a plurality of blocks and when there is a block having an area which is smaller than a first threshold, or a block in which an average luminance of the pixels in a corresponding region of the first image is higher than a second threshold, the pixels included in the block into the second pixel type, a first classifying unit configured to classify, among the pixels included in the second image, the pixels not corresponding to the edge into a first pixel type and the pixels corresponding to the edge into a second pixel type; and a second classifying unit configured to reclassify, when the pixels not corresponding to the edge are present separately in a plurality of blocks and when there is a block having an area which is smaller than a first threshold, or a block in which an average luminance of the pixels in a corresponding region of the first image is higher than a second threshold, the pixels included in the block into the second pixel type, wherein the first threshold value is 5 % or more and 30 % or less of the largest area among the plurality of blocks, wherein, when a lateral direction of the first image is taken as an X axis and a longitudinal direction of the first image is taken as a Y axis and a region formed by the pixels classified into the first pixel type is set as a provisional pupil region, the pupil-region generating unit sets, as a Y coordinate of a center of the pupil region, an intermediate value between a maximum value and a minimum value of a Y coordinate of the provisional pupil region, calculates X coordinates, each of which is a center point on the X axis of the provisional pupil region, for respective Y coordinates, and determines an X coordinate of the center of the pupil region on the basis of a distribution of the obtained X coordinates, and, as a diameter of the pupil region, a diameter of the provisional pupil region on an axis passing through the center of the pupil region and parallel to the X axis.