1. In a system for automatic inspection of two dimensional periodic patterns on printed circuit boards, photolithographic masks, pattern semiconductor wafers and the like wherein said pattern is scanned by image producing means such that digital images of the same optical image pattern is acquired some predetermined number of times, N, and greyscale value is assigned to said pixels so that greyscale values of the pixels in one pattern can be compared to the greyscale values of the respective pixels a repetition period away, the improvement to said inspection system comprising; (a) establishing three neighborhoods of pixel greyscale values a repetition period away in either direction from a center designated neigborhood; (b) comparing said neighborhoods to said center designated neighborhood to test said respective pixels as being blacker than or whiter than said center pixels by comparing selected predetermined pixels of the neighborhoods to selected predetermined pixels of said center neighborhood by a high sensitivity comparision test, a horizontal row test, a vertical row test and missing pattern test wherein the high sensitivity comparison test comprises: (i) a difference test wherein one of the neighboring pixel groups to the central pixel are compared to said central pixel and a first preset threshold, and (ii) a gradient test wherein the center pixel of the neighbor is compared to its connected neighbors and a second preset threshold; (c) labelling by binary code to identify a neighbor as being blacker than or whiter that its respective center neighbor whereby a suspected defect pixel is a center pixel either blacker than or whiter than both of its respective said neighborhoods, and (d) accumulating said labelled by binary code neighbors.