1. A method, comprising: providing a design layout; transferring the design layout onto a first semiconductor substrate using a mask; determining a scanning parameter based on the design layout; generating an image contour including at least one closed curve from the first semiconductor substrate using the determined scanning parameter; and performing a defect inspection by comparing a first number of closed curves in a region of the image contour and a second number of polygons in a corresponding region of the design layout.