A defect inspection apparatus which includes a pattern image obtaining
unit obtaining a pattern image of a predetermined part by causing
focusing control to be performed in order to achieve focus on the
predetermined part within an observation object according to set focusing
control parameters, a pattern image storing unit storing the pattern
image, and a detecting unit detecting the presence/absence of an abnormal
condition of a part to be inspected by making a comparison between the
pattern image of a reference part within the observation object, and the
pattern image of the part to be inspected within the observation object.
The focusing control parameters, set when the pattern image of the part
to be inspected is obtained, are determined based on sample information
obtained when the pattern image of the reference part is obtained.