Machine vision systems are used in industrial production areas to produce products with fast, perfect and high precision. These systems allow users to make highly accurate and non-contact measurements and can detect deficiencies in the production process. In this work, a machine vision based non-contact defect detection algorithm for printed circuit boards (PCBs) has been developed. In this approach, which detects and controls the holes on the PCB, first a reference image is taken from the system and feature extraction process is applied to this image. In this real-time working approach, the reference image is matched with the incoming test images and the missing holes on the PCB are precisely detected. Furthermore, it has been determined that the error amount is less than 2 μM in experimental studies. This approach, which works independently of color, position and direction, enables the defect detection process to be done very quickly and precisely.