The invention aims to provide a method for extracting a contour of an image of a
printed circuit board (PCB). By the method, the defect of inaccuracy in extraction of the contour of the image of the PCB in the conventional contour extraction method is overcome, the accuracy and stability of contour detection are improved, and working efficiency is improved. The method comprises the following steps of: 1) acquisition of an original image of the PCB; 2)
Gaussian Laplacian operator
processing:
processing the original image by using a
Gaussian Laplacian operator to obtain a processed
Gaussian Laplacian image; 3) gradient operator
mutant processing: processing the original image by using a gradient operator to obtain a gradient image which is subjected to
mutant processing through the gradientoperator; 4) processing the original image by using high and low threshold values to obtain a
binary image; 5) establishing coordinate graphs of sub-pixel contour points, determining the pixel position of the contour according to the boundary of the
binary image, and thus obtaining the coordinates of the sub-pixel contour points according to a Gaussian Laplacian value, a pixel value and a gradient value in the corresponding direction of the contour; and 6) connecting the sub-pixel contour points to form the contour, and connecting the sub-pixel contour points into a set in a certain sequence according to the coordinates of the sub-pixel contour points, wherein the coordinates are obtained in the step 5).