Abstract:A pin defect online detection algorithm is proposed to address the issues of pin loss, misalignment, and disconnection in complex electrical control demand scenarios caused by miniaturization of circuit boards and dense pin arrangement. The color image is preprocessed into a grayscale image using weighted average method to improve processing speed. The maximum entropy global threshold segmentation and multiple morphological processing are used to accurately obtain the middle row pin area, which excellently preserves parameters such as pin length and area. Compare the measured parameters with the standard long and short pin parameters to achieve pin missing and disconnection detection. The results show that in the tested image samples, the system can locate the power supply pins in real time and accurately identify pin defects, with the characteristics of easy operation and high automation.