The invention relates to the technical field of
visual detection, in particular to a packaging piece detection method and
system, and the method comprises the steps: obtaining edge contour points of a packaging piece, dividing a direction continuous
point cluster, extracting a
direction vector, judging a crack region, determining a crack through combining gray gradient and density, counting the repetition frequency of a closed structure, and recognizing a crack and pattern repetition coexistence region. According to the method, continuous segmentation extraction is carried out on the edge contour
point set of the packaging piece,
direction vector calculation is combined, accurate recognition of the structural form
mutation area is achieved, the double screening standards of the direction included angle and the
gravity center distance are introduced in the crack area recognition stage, the judgment capacity of the
edge structure fracture characteristics is effectively enhanced, and the recognition accuracy of the
edge structure fracture characteristics is improved. And meanwhile, a composite analysis means of gray gradient change and
direction vector distribution density is introduced, secondary confirmation is performed on the crack position, the reliability of
anomaly detection is improved, and in addition, joint identification of crack anomaly in a structure repetition area is realized by identifying a closed contour structure and analyzing pattern repetition frequency.