Abstract: A method to solve the problem of a technique generally used to detect a defect of a semiconductor by calculating the differential image based on pattern matching, which requires that a reference image must be picked up to pick up an image of the inspection position in an area with the semiconductor pattern having no periodicity, resulting in a low throughput. The image of the inspection position is divided into local areas, each local area is matched with the local area of the image already stored and the difference between the local areas thus matched is determined to extract area.