Keywords: Halcon; single-pixel skeleton; deburring; skeleton branch; machine vision detection; image processing
In machine vision inspection, the detection of strip targets such as PCB traces is often designed, and skeleton extraction is a very useful detection idea. However, since the boundary of the target object is difficult to be absolutely smooth, the extracted skeleton usually has tiny burrs and branches, which affects subsequent detection and measurement. After years of practical experience in visual inspection projects, I sorted out the code of the single-pixel skeleton deburring branch algorithm written by myself to realize the removal of the skeleton burr branch, and the length of the burr branch to be removed can be set. As shown in the figure below, Figure 1 is the intercepted binary image of PCB traces, Figure 2 is the obtained skeleton, and Figure 3 is the skeleton after deburring. Through joint programming, the code can be embedded in projects such as C++, C# and Python, and due to the morphological method mainly used in the algorithm, the operation efficiency is high, and it can be applied to machine vision online inspection projects.
Figure 1 The intercepted binary image of the PCB trace
Figure 2 The original skeleton
Figure 3 The skeleton after deburring
The source code of the program can be downloaded from the network disk link on the WeChat public account [Dongguan Scientific Research].