When determining that the above determination is not made for all the lines (No in S148), determination unit 32 proceeds to step S144 to continue the determination processing. In the example of the part (b) in FIG. 13, determination unit 32 makes the negative determination in step S148 because the pixels after pixel row 9 that are not subjected to the determination processing exist below pixel row 8, and the processing in step S144 is performed. Specifically, determination unit 32 determines whether pixel row 9 that is the pixel row immediately below pixel row 8 that is the reference line has the correlation with pixel row 8 that is the reference line set in step S147 (S144). Thereafter, the pieces of processing in steps S144 to S147 are repeatedly performed until the affirmative determination is made in step S148.
The part (b) of FIG. 13 illustrates the case where pixel rows 9 to 12 have the correlation with pixel row 8 that is the reference line selected in step S147. At this point, the correlation lines for pixel row 8 that is the reference line are pixel rows 9 to 12 (see the correlation line for the eighth line in the part (b) of FIG. 13). In this case, pixel row 8 is an example of the second comparison reference line, and the pixel rows (for example, pixel rows 9 to N) located below pixel row 8 including pixel row 9 are an example of the third pixel row.