An embodiment of the invention provides a method for training a system to inspect
a spatially distorted pattern. A digitized image of an object, including a region
of interest, is received. The region of interest is further divided in to a plurality
of sub-regions. A size of each of the sub-regions is small enough such that a conventional
inspecting method can reliably inspect each of the sub-regions. A search tool and
an inspecting tool are trained for a respective model for each of the sub-regions.
A search tree is built for determining an order for inspecting the sub-regions.
A coarse alignment tool is trained for the region of interest. Another embodiment
of the invention provides a method for inspecting a spatially distorted pattern.
A coarse alignment tool is run to approximately locate a pattern. Search tree information
and an approximate location of a root image, found by the coarse alignment tool,
is used to locate sub-regions sequentially in an order according to the search
tree information. Each of the sub-regions is inspected, the sub regions being small
enough such that a conventional inspecting method can reliably inspect each of
the sub-regions.