The invention relates to the technical field of
image detection, in particular to a PCBA board defect detection method and
system based on
image processing, and the method comprises the following steps: carrying out the meshing calculation of a gray scale deviation after a gray scale image is subjected to
Gaussian filtering denoising, generating change rate data, carrying out the statistics of a frequency number, constructing a
histogram, combining with an Otsu
algorithm, and generating a candidate
mask; extracting pixels based on a
mask, calculating a gradient modulus, screening edge candidate points, carrying out
gradient direction connection and
morphological processing to generate a complete
edge structure, expanding a connected domain through a
region growing algorithm, aligning the connected domain with a template contour, and outputting defect coordinates. According to the method, the defect identification sensitivity is improved through combination of
gray level image gridding
processing and dynamic threshold calculation, a candidate
mask is generated through grid
gray level change rate statistics and an Otsu
algorithm to avoid over-segmentation missing detection, and the contour precision is improved through combination of gradient modulus difference screening and morphological closed operation optimization. The
region growing algorithm and template dynamic alignment reduce deformation misjudgment, and staged dimension reduction and feature enhancement reduce calculation complexity and solve resource waste.