For mechanical dimension detection of Printed Circuit Board (PCB), an image feature recognition method based on location relationship was proposed. Select a standard PCB standard graph as the standard graph, establish a template for image matching in the standard graph, and determine the measurement area, measurement type, standard size and tolerance. Through template matching of test points in PCB test, comparing different types of test characteristics, selecting appropriate image feature extraction and identification, comparing standard size and tolerance, so as to determine the quality of PCB. This paper introduces a fast and efficient automatic test technology based on PCB test requirement.