To accurately detect the position of the edge of a pattern even when the pattern is formed of lines arranged at narrow intervals or narrow lines.
By scanning patterns with a light beam in the crossing direction along the line L1-L2 as shown in Fig. (b), the then obtained photoelectrically converted signals of scattered light from odd-numbered edges (with peaks P1, P3,...) and from even-number edges (with peaks P2, P4,...) from the scan starting position are separately fetched. The positions of the odd-numbered edges (E1, E3,...) are detected based on the peaks P1, P3,... (c) of the photoelectrically converted signals of the scattered light from the odd-numbered edges and, at the same time, the positions of the even-numbered edges (E2, E4,...) are detected based on the peaks P2, P4,... (d) of the photoelectrically converted signals of the scattered light from the even-numbered edges.