Voids are one of the major defects in ball grid array (BGA) solder joints due to a large amount of outgassing flux that gets entrapped during reflow. X-ray nondestructive machines are used to make voids visible as lighter areas inside the solder joints in X-ray images for detection However, it has always been difficult to analyze this problem automatically because of some challenges such as noise, inconsistent lighting and void-like artifacts. This study realized accurate extraction and automatic a-nalysis of void defects in solder joints by adopting a technical proposal, in which Otsu algorithm was used to segment solder balls and void defects were extracted through opening and closing operations and top-hat transformation in mathematical mor-phology. Experimental results show that the technical proposal mentioned here has good robustness and can be applied in the detection of voids in BGA solder joints.