Accuracy in solder balls and joint void detection is very important. If voids are incorrectly identified, board yield will be affected by incorrect scrapping and rework. Voids are difficult to detect using manual inspection alone. One current solution to make voids visible involves the use of a 2D x-ray system to image the boards. Some existing x-ray inspection systems have void detection algorithms that require the use of intensive, time consuming, fine tuning operations. These algorithms typically use two different global thresholds to segment the balls or joints and the voids using operator trial and error. However, using global thresholding over the entire image is invalidated due to varying image brightness. Existing methods also eliminate balls or joints that are partially occluded by other components due to difficulties in segmentation. The results are that many voids that can be easily observed by the human eye are missed by the existing automated methods. In this paper, a robust, accurate, and automatic void detection algorithm is proposed. The method is applicable to either Pre SMT solder balls or post SMT solder joints. For simplicity, the term balls will be used throughout the document. The proposed method is able to detect voids with different sizes inside the solder balls, including the ones that are occluded by board components and under different brightness conditions. The proposed method consists of segmenting individual balls, extracting occluded balls, and segmenting voids inside the solder balls. The segmentation of the individual balls is achieved by using the proposed histogram and morphological based segmentation method. A voting procedure is used to segment the occluded balls where the pixels inside the occluded area are checked to obtain candidate pixels representing the occluded joint's or ball's centroids. An independent edge detection procedure is used to get candidate voids inside individual balls. Mathematical morphology operations are used to locate all possible valid voids and remove non-void areas. The proposed algorithm was applied to 3 different Intel products. The results of the proposed method were compared to the results obtained by an automated algorithm in an existing state-of-the-art 2D x-ray inspection system, the results obtained by trained operators from 2D x-ray images, and the results obtained by trained operators from 3D CT scan images. The results (pre SMT solder balls) show that the proposed method is capable of successfully locating all possible visible voids inside the solder ball even the ones that were missed by using other methods as well as those that are hard to see by the human eye. The results also show a high correlation with ground-truth data obtained from 3D CT scan and experienced operators. The algorithm is fully automated, benefits the manufacturing process by reducing operator effort and provides a cost effective solution to improve output quality.