Abstract

Cone beam computed tomography (CBCT) is a new detection method for 3D nondestructive testing of printed circuit boards (PCBs). However, the obtained 3D image of PCBs exhibits low contrast because of several factors, such as the occurrence of metal artifacts and beam hardening, during the process of CBCT imaging. Histogram equalization (HE) algorithms cannot effectively extend the gray difference between a substrate and a metal in 3D CT images of PCBs, and the reinforcing effects are insignificant. To address this shortcoming, this study proposes an image enhancement algorithm based on gray and its distance double-weighting HE. Considering the characteristics of 3D CT images of PCBs, the proposed algorithm uses gray and its distance double-weighting strategy to change the form of the original image histogram distribution, suppresses the grayscale of a nonmetallic substrate, and expands the grayscale of wires and other metals. The proposed algorithm also enhances the gray difference between a substrate and a metal and highlights metallic materials. The proposed algorithm can enhance the gray value of wires and other metals in 3D CT images of PCBs. It applies enhancement strategies of changing gray and its distance double-weighting mechanism to adapt to this particular purpose. The flexibility and advantages of the proposed algorithm are confirmed by analyses and experimental results.

1. Introduction

A printed circuit board (PCB) is an important part of electronic products. PCBs have played crucial roles in nearly every electronic product, such as electronic watches, cell phones, personal computers, digital machine tools, aerospace equipment, and medical instruments. Defects during the production process, as well as aging and wear during usage, will damage the entire board, thereby leading to abnormal operation, malfunction, and function invalidation in the circuit. These situations may eventually paralyze the entire working system. Therefore, monitoring the condition of PCBs is important. 3D imaging of PCBs via cone beam computed tomography (CBCT) can isotropically show the internal structure of PCBs in 3D space at micron-level resolution [1]. All information on internal defects, including cracks, incomplete welds, and welding faults, can be tested in a nondestructive manner [2].

PCBs consist of a nonmetallic substrate and metallic materials, such as wires, vias, pads, and copper. The metallic materials in PCBs provide the information of circuit connectivity. Therefore, we are concerned more about the metallic materials than about the nonmetallic materials. However, given the considerable amounts of metallic materials in PCBs, numerous factors, including the occurrence of metal artifacts and beam hardening, affect image quality in the CBCT imaging process [3, 4]. These harmful factors will result in low-contrast 3D CT images of PCBs. Thus, an image enhancement technology should be applied to highlight metallic materials. Histogram enhancement technology is the most basic image contrast enhancement method [5]. A histogram is the statistic probabilistic distribution of each gray level in a digital image. It can provide a general overview of the characteristics of an image, such as grayscale, gray level distribution and its density, the average luminance of an image, and image contrast [6]. Histogram enhancement can improve the gray dynamic distribution of an image by changing the gray mapping relationship [7]. Histogram equalization (HE) is one of the most significant and commonly used histogram enhancement methods [8].

HE changes the input image into a new image with a uniform distribution of pixel gray values. It enhances the contrast of an image by increasing and adjusting the dynamic distribution range of gray. Given its simplicity and comparatively good performance in nearly all types of images, HE has become a popular image contrast enhancement technique [9]. However, HE also has several disadvantages. First, the HE algorithm uses global histogram information, which limits the intensity of image contrast stretching in some local areas. Consequently, this algorithm cannot effectively enhance the contrast between the background and a number of interesting details and has difficulty controlling the reinforcing effect. Second, saturation artifacts may occur in the result. Third, the grayscale of the output image may be overcombined, which may lead to the loss or discontinuity of the gray level; consequently, some detailed information of the image is lost.

To address these problems, several researchers [1012] have enhanced images in subgray space. This strategy partially relieves the issues encountered in traditional HE and retains the details of an image as much as possible. These methods first separate the original global gray histogram into several subspaces. Then, the original image is divided into several subimages, and HE enhancement is performed on each subimage. Finally, all subimages are merged into a single image on the global grayscale histogram. The improved algorithms include brightness-preserving bi-HE (BBHE) [13, 14], recursive mean-separate HE (RMSHE) [1517], dualistic subimage HE (DSIHE) [18, 19], minimum mean brightness error bi-HE (MMBEBHE) [20, 21], and weighting mean-separated sub-HE (WMSHE) [22, 23].

In BBHE, the input image histogram is divided into two subimages according to the mean value of the input. Then, both parts are merged again after the histogram is equalized. The result maintains the mean of the original image. The idea of preserving brightness is also adopted in the literature [2427].

RMSHE follows the principle of BBHE. It iteratively divides the original image histogram into two parts at mean points. Then, subspaces are obtained after partition times. HE is applied on each part. Evidently, as the number of partition times for the image histogram increases, the obtained result becomes increasingly closer to the original image. RMSHE is the same as BBHE if .

DSIHE selects the partition points of an image histogram, in which both parts have equal proportion. That is, both subimages have the same number of pixels after DSIHE partition.

MMBEBHE follows the basic principle of BBHE and DSIHE in decomposing an image and then applies HE to equalize the resulting subimages independently. However, MMBEBHE searches for a threshold that decomposes the image into two subimages, and Consequently, minimum brightness difference is achieved between the mean of the input image and that of the output image. This threshold is essentially selected through enumeration.

WMSHE is similar to RMSHE. The only difference is that the former uses the gray-weighted mean as a partition rather than the original subimage. Compared with RMSHE, WMSHE can maintain more details of the image and reduce overenhancement.

Compared with the traditional HE algorithm, all the aforementioned algorithms can maintain more detailed information and can partially solve the overenhancement problem. However, these algorithms are not free from side effects [28].

Only two types of information are available in 3D CT images of PCBs. The first is nonmetallic materials, such as substrates, and the second is metallic materials, such as tracks, vias, and pads. However, various factors in the imaging process easily lead to the characteristic of a single peak in the image histogram. The gray of nonmetallic materials is smaller than that of metallic materials; thus, the gray of nonmetallic materials typically appears on the left side of the peak, whereas the gray of metallic materials appears on the opposite side. Metallic materials that provide electrical and signal connections for PCBs are of utmost concern. Hence, a good strategy should compress the grayscale of nonmetallic materials on the left side of the peak and extend the grayscale of the metallic materials on the right side. Such strategy enhances PCB images. However, traditional HE and its improved algorithms cannot change the gray probability density function (PDF) of the original image. They can only enhance an image by using the cumulative density function (CDF) of its gray probability density. Gray PDF or histogram determines the final enhancement directly. To solve this problem, several researchers have proposed to change the gray histogram of an original image before enhancing it. The representative algorithms include recursively separated and weighted HE (RSWHE) [29] and weighted thresholded HE (WTHE) [30, 31]. RSWHE achieves weighted HE by applying the strategy that considers the mean value or a value of equal volume as the partition point. It changes the original histogram based on the power of the sum of gray probabilities in each subsection. This strategy increases the gray of low probability in the new histogram. However, because of the insignificant capability of the algorithm to change the amplitude of the original histogram, the enhancement effect is only slightly improved. WTHE defines an upper limit of the maximum probability of gray and weakens the probability of the gray with high probability in the original histogram. By using a power function, WTHE also increases the probability of the gray that has low probability in the original histogram. The main aim is to maintain the low probability gray and reduce the high probability gray, thereby avoiding overenhancement. However, this algorithm is slightly flexible. For all image histograms, the algorithm only blindly reduces “high probability” and increases “low probability.” By contrast, maintaining the grayscale range with high probability is necessary to enhance PCB images because of the existence of PCB metals in this zone. Accordingly, this study presents an algorithm called image enhancement based on gray and its distance double-weighting HE (GDDWHE). As the name suggests, GDDWHE introduces gray and its distance double-weighting mechanism to change the original gray distribution of the histogram, thereby satisfying the strategies and objectives of specific enhancements, as well as improving target enhancement.

2. HE Algorithm

The HE algorithm has been extensively used because it provides simple and fast calculation. This algorithm processes an input image to ensure that the gray histogram of the output image follows a uniform distribution. It increases and adjusts the distribution of the gray dynamic range to enhance the contrast of the image, thereby achieving image enhancement.

Assume that a 3D image has voxels and gray levels . The number represents the number of voxels with a gray level of . The occurrence probability of the gray level iswhere . is also known as the PDF, which defines the CDFwhere . And is obtained by definition.

The main objective of the HE algorithm is to change the original image histogram from a concentrated distribution to a uniform distribution over the entire grayscale range. The HE algorithm uses CDF as a transfer mapping function. The grayscale of the original image is mapped in the entire grayscale dynamic range to achieve a uniform distribution. The transfer mapping function is achieved as follows:

If is defined as the image after HE, then

3. GDDWHE Algorithm

3.1. Design and Analysis of the Algorithm

In accordance with the characteristic of 3D CT images of PCBs, this paper proposes an image enhancement algorithm based on GDDWHE. The proposed algorithm focuses on the feature of a 3D image, modifies the probability distribution of the grayscale in the histogram that has a single peak, and obtains an advantageous enhancement effect. In the HE algorithm, the CDF is defined by (2). In this paper, however, a new cumulative density function is defined as follows: where and is a constant for normalization to calculate the probability. is obtained by the upper definition. is a parameter that controls the degree of the gray value involved in the weighting process. represents the distance between grayscales and . The subscripts and satisfy the following requirement: . satisfies the following requirement: . If , then . In other cases, . A great distance between and corresponds to small . Similar to the summation in (2), the role of the first summation in (5) is to calculate the cumulative density function. As for the second summation in (5), we define the following expression:Thus, (5) is transformed into

In fact, (5) uses to replace in (2). The functions of and are analyzed as follows: CONT is a constant. Thus, it is set aside temporarily in the following analyses.

In (2), can be denoted by the following expressions:where the weight is denoted by the following expression:

The upper analysis indicates that includes only the probability of gray level and it does not consider the probability of gray level when because the weight equals zero under this circumstance.

In (6), can be denoted by the following expressions:where the weight is denoted by the following expression:

The distance is used as the weight in the summation. The definition in (5) indicates that is larger than zero. Unlike in (2), in (6) uses weight to replace zero when the subscript is smaller than Thus, the summation in takes into account all the probabilities of the grayscale that is smaller than or equal to grayscale . includes not only the probability of gray level but also that of gray level , which is smaller than . In general, the weight will be small if the distance is far. Accordingly, the probability of the gray level close to will have a larger contribution to . The gray histogram of 3D CT images of PCBs usually has a single peak, and the histogram exhibits an increasing trend on the left side of the peak. The probability of the latter gray in particular will be higher than that of the former. The probability is smaller than when is smaller than . After being weighted by , which is smaller than 1, the contribution of will decrease in the function compared with that in the function . Thus, (6) can compress the gray located on the left side of the peak. The gray histogram exhibits a decreasing trend on the right side of the peak. The probability of the latter gray is lower than that of the former. The probability is larger than when is larger than . All the weighted cumulative probabilities of the gray before improve the final enhancement performance of the gray in the function compared with that in the function . Thus, (6) can upgrade the gray located on the right side of the peak. The previous analysis indicates a low value of the gray on the left side of the peak in the histogram of the 3D image of a PCB; this low value corresponds to nonmetallic materials that should be suppressed in the enhancement result. The gray on the right side of the peak has a high value, which corresponds to metallic materials that should be enhanced in the enhancement result. The function can attain this goal through the preceding analysis of (6). Figure 1 shows the above analysis.

When , is a monotonically increasing function defined by . When increases, the product will enlarge in gray value . That is, magnifies the large gray value more clearly than the small gray value. The preceding analysis indicates that, for 3D CT images of PCB histograms with a single peak, the controls of can suppress the nonmetallic materials on the left side of the peak and enhance the metallic materials, such as wires, on its right side. Figure 5 shows the above analysis.

The proposed GDDWHE algorithm introduces a new cumulative density function using gray and its distance double-weighting strategy. The algorithm can flexibly change the original gray histogram or gray probability distribution into different forms by using different weighting mechanisms, such as selecting a different gray distance function and altering the value of . For the gray histogram with a single peak, the algorithm can depress the histogram on the left side of the peak and raise the histogram on the right side of the peak. It is especially effective in enhancing the 3D CT images of PCBs that usually have a single peak in gray histograms. For the 3D CT images of PCBs, the proposed algorithm can compress the gray of nonmetallic substrates whose grays are located on the left side of the peak and upgrade the gray of wires and metallic materials whose grays are located on the right side of the peak. The experimental results prove the advantage of the proposed algorithm.

The proposed algorithm proceeds as follows.

Step 1. The original image histogram is calculated.

Step 2. The original histogram is weighted according to , and a new histogram and a new CDF are obtained.

Step 3. The new gray histogram is mapped according to , and the final image enhancement results are obtained.

3.2. Discussion and Analysis of Parameter Selection

This section discusses the selection of different parameters of GDDWHE, including the distance function, the value of , and their influences on the transformation of the gray histogram in a 3D CT image of a PCB with a single peak. Accordingly, we can select the optimum combination of parameters to enhance overall performance and achieve an improved enhancement result for 3D CT images of PCBs.

3.2.1. Selecting the Distance Function

Different distance functions will obtain different enhancement effects. This study selects the squared Euclidean distance deformation form as follows:where is used to control the range of gray levels that participate in the operations.

3.2.2. Effects of Different Gray Variances on the Algorithm

The following analysis discusses the influence of different control parameters of the gray variance value on the enhancement effect. Figure 1 shows the modifications in the original histogram caused by different gray variances . To avoid the effect of the weighting of gray on the results, is set to zero. The figure also shows that the single peak of the original histogram is widened and its amplitude decreases with the increase in . The decreasing trend on the right side of the peak and the increasing trend on the left side of the peak both slow down. Large values of indicate that the transformed peak is far from the original peak. Figure 2 shows the CDF generated by the changed gray histogram. This figure also indicates that the repression of the gray in the low gray value zone is highly evident with increasing , but the stretch of magnitude in the high gray value zone is weakened. This result is not conducive to the enhancement of metal PCBs. According to the preceding analysis, the gray values that correspond to wires and other metals will appear after the peak of the original histogram. Therefore, for 3D CT images of PCBs, large values of do not necessarily indicate good results. The stretching capability within the range of a large gray value should be considered. Evidently, small will improve the enhancement result. We choose on the basis of the actual gray value distribution feature of the image and the preceding comprehensive analysis. The selected experimental PCB image has two circuit layers, and the center position of each circuit layer is located on the 6th slice and the 43rd slice. Figure 3 shows the original images of both slices. Figure 4 shows the image of the 6th slice enhanced by different values of . We apply some statistical measurement indicators to assess the performance of the enhancement method. These indicators include the intensity distribution variance (), contrast (), EME, Michelson law-based EME (EME_Michelson), EME using entropy (EME_entropy), and AME [3234].

The size of a 3D image is and the image is broken up into nonoverlapped subblocks. and are the maximum and minimum of every subblock, respectively. In this paper, we set the subblock size to voxels. These aforementioned indicators are calculated by the following equations:where , which is the gray mean of the image;where , is one of the six neighborhoods of in 3D space, and is the probability of ;where is a small constant equal to 0.000001 to avoid dividing by 0;where /;where /

In (17) and (18), is set from 0.1 to 1 at intervals of 0.1.

The intensity distribution variance and contrast reflect the overall enhancement result of the image. Notably, large values indicate good overall enhancement. The other indicators, namely, EME, EME_Michelson, EME_entropy, and AME, reflect the enhancement effect on the local area of the image [32] or the capability to preserve local details. Large values indicate good capability to maintain local details. The indicators and have an order of priority that should be considered for their representations in the overall enhancement performance. The capability to stretch the gray in the local area is also considered. Table 1 presents the measurement indicators of the enhancement performance using different values of . We will select the appropriate parameter from Table 1. As shown in Table 1, improved enhancement is achieved when .

3.2.3. Effects of the Different Weights of the Gray Value on the Algorithm

In the following analysis, we discuss the influence of the different values of the weight control parameter on the enhancement result. On the basis of the preceding analysis, the parameter of the gray value variance is set to 5 (). Figure 5 shows the modifications of the original histogram with different values of . As shown in Figure 5(a), the results of different values of are nearly the same. Figures 5(b) and 5(c) present the enlarged local histograms of the image in Figure 5(a). These enlarged histograms show that the results of different values of are not highly evident. However, Figure 5(b) illustrates that the capability to depress the gray histogram increases within a small gray value range with the increase in . Figure 5(c) shows that the capability to upgrade the gray histogram increases within a large gray value range with the increase in . Consequently, the overall effect will still improve. These results verify the previous analysis of the algorithm. Given the slight differences among the gray histogram results obtained using different values of , we do not present the corresponding gray CDFs. Figure 6 presents the different enhancement results of the 43rd slice image obtained using different values of . Table 2 provides the enhanced performance results of different values of . We will select the appropriate parameter from Table 2. On the basis of Figure 6 and Table 2, we select for the experimental 3D image when .

3.3. Experimental Results and Analysis

In this section, the results of different enhancement algorithms for the selected 3D CT image of a PCB are tested and compared. The single peak of the gray histogram is located at the gray value equal to 59. The gray transformation curve reflects the ability to extend the contrast. Figure 7 shows the gray transformation curves of the different algorithms. Figure 7(b) demonstrates the local enlargement of the image in Figure 7(a). Figure 7(b) indicates that the proposed method stretches the gray rapidly when the gray value is larger than the peak in the histogram, and thus metals are enhanced more clearly. Figures 8 and 9 present the enhancement results of the 6th and 43rd slice images using different algorithms. Table 3 provides the enhancement performance results of different algorithms. Some parameters in the algorithms are set as follows: in GDDWHE, , ; in WTHE, ; in RSWHE and RMSHE, ; in WMSHE, . As shown in Table 3, the proposed method achieves the best performance among all the indicators. However, the indicators and EME_Michelson are slightly smaller than those for HE and DSIHE, respectively. This finding indicates that the proposed method exhibits a strong advantage in enhancement and can achieve better enhancement results for 3D CT images of PCBs.

4. Summary

This study proposes an image enhancement algorithm based on GDDWHE according to the characteristics of 3D CT images of PCBs. The method changes the distribution form of the original histogram by using the gray and its distance double-weighting strategy. The gray of nonmetallic substrates is compressed in the histogram of 3D CT images of PCBs, whereas the gray of wires and metallic materials is elevated. This approach further enhances the appearance of wires and other metals in 3D CT images of PCBs. Results of the algorithm analysis and the experiment indicate the effectiveness of the proposed method. Compared with other existing image enhancement algorithms, the proposed algorithm can more effectively extend the gray difference between substrates and metals in 3D CT images of PCBs and achieve better enhancement performance.

Competing Interests

The authors declare that they have no competing interests.

Acknowledgments

This study is supported by the National Natural Science Foundation of China under Grant no. 61372172 and the National High Technology Research and Development Program of China under Grant no. 2012AA011603. The authors express their sincere thanks.