# Contrast Enhancement Method Based on Gray and Its Distance Double-Weighting Histogram Equalization for 3D CT Images of PCBs

Authors: Lei Zeng; Bin Yan; Weidong Wang
Journal: Mathematical Problems in Engineering
 (2016)

---

## 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.


---

## Body

## 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 [10–12] 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) [15–17], 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 [24–27].RMSHE follows the principle of BBHE. It iteratively divides the original image histogram into two parts at mean points. Then,2
r subspaces are obtained after r 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 r
=
1.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 thresholdT that decomposes the image I into two subimages, I
[
0
,
T
] and I
[
T
+
1
,
L
-
1
]
. 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 imageI
(
x
,
y
,
z
) has N voxels and L gray levels {
I
0
,
I
1
,
…
,
I
L
-
1
}. The number n
k represents the number of voxels with a gray level of I
k. The occurrence probability of the gray level I
k is(1)
p
I
k
=
n
k
N
,where k
=
0,1
,
…
,
L
-
1. p
(
I
k
) is also known as the PDF, which defines the CDF(2)
C
I
k
=
∑
i
=
0
k
p
I
i
,where k
=
0,1
,
…
,
L
-
1. And C
(
I
L
-
1
)
=
1 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:(3)
f
I
k
=
I
0
+
I
L
-
1
-
I
0
C
I
k
.IfI
~
=
{
I
~
(
x
,
y
,
z
)
} is defined as the image after HE, then(4)
I
~
=
f
I
=
f
I
x
,
y
,
z
∣
∀
I
x
,
y
,
z
∈
I
.


## 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 C
(
I
k
) is defined as follows: (5)
C
I
k
=
∑
i
=
0
k
I
i
α
×
∑
j
=
0
i
p
I
j
×
d
I
i
,
I
j
CONT
,where CONT
=
∑
i
=
0
L
-
1
(
I
i
α
×
∑
j
=
0
i
(
p
(
I
j
)
×
d
(
I
i
,
I
j
)
)
) and is a constant for normalization to calculate the probability. C
(
I
L
-
1
)
=
1 is obtained by the upper definition. α is a parameter that controls the degree of the gray value I
i involved in the weighting process. d
(
I
i
,
I
j
) represents the distance between grayscales I
i and I
j. The subscripts i and j satisfy the following requirement: 0
≤
j
≤
i
≤
L
-
1. I
j satisfies the following requirement: I
0
≤
I
j
≤
I
i. If I
i
=
I
j, then d
(
I
i
,
I
j
)
=
1. In other cases, 0
<
d
(
I
i
,
I
j
)
<
1. A great distance between I
i and I
j corresponds to small d
(
I
i
,
I
j
). 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:(6)
p
^
I
i
=
∑
j
=
0
i
p
I
j
×
d
I
i
,
I
j
.Thus, (5) is transformed into(7)
C
I
k
=
∑
i
=
0
k
I
i
α
×
p
^
I
i
CONT
.In fact, (5) uses (
I
i
α
×
p
^
(
I
i
)
)
/
CONT to replace p
(
I
i
) in (2). The functions of p
^
(
I
i
) and I
i
α are analyzed as follows: CONT is a constant. Thus, it is set aside temporarily in the following analyses.In (2), p
(
I
i
) can be denoted by the following expressions:(8)
p
I
i
=
0
×
p
I
0
+
0
×
p
I
1
+
⋯
+
0
×
p
I
i
-
1
+
1
×
p
I
i
=
∑
j
=
0
i
w
i
j
×
p
I
j
,where the weight w
i
j is denoted by the following expression:(9)
w
i
j
=
0
,
j
<
i
,
1
,
j
=
i
.The upper analysis indicates thatp
(
I
i
) includes only the probability of gray level I
i and it does not consider the probability of gray level I
j when j
<
i because the weight w
i
j equals zero under this circumstance.In (6), p
^
(
I
i
) can be denoted by the following expressions:(10)
p
^
I
i
=
∑
j
=
0
i
p
I
j
×
d
I
i
,
I
j
=
d
I
i
,
I
0
×
p
I
0
+
d
I
i
,
I
1
×
p
I
1
+
⋯
+
d
I
i
,
I
i
-
1
×
p
I
i
-
1
+
d
I
i
,
I
i
×
p
I
i
=
∑
j
=
0
i
w
i
j
×
p
I
j
,where the weight w
i
j is denoted by the following expression:(11)
w
i
j
=
d
I
i
,
I
j
,
j
<
i
,
d
I
i
,
I
j
=
d
I
i
,
I
i
=
1
,
j
=
i
.The distanced
(
I
i
,
I
j
) is used as the weight in the summation. The definition in (5) indicates that d
(
I
i
,
I
j
) is larger than zero. Unlike p
(
I
i
) in (2), p
^
(
I
i
) in (6) uses weight d
(
I
i
,
I
j
) to replace zero when the subscript j is smaller than i
. Thus, the summation in p
^
(
I
i
) takes into account all the probabilities of the grayscale that is smaller than or equal to grayscale I
i. p
^
(
I
i
) includes not only the probability of gray level I
i but also that of gray level I
j, which is smaller than I
i. In general, the weight will be small if the distance is far. Accordingly, the probability of the gray level close to I
i will have a larger contribution to p
^
(
I
i
). 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 p
(
I
j
) is smaller than p
(
I
i
) when I
j is smaller than I
i. After being weighted by d
(
I
i
,
I
j
), which is smaller than 1, the contribution of p
(
I
j
) will decrease in the function p
^
(
x
) compared with that in the function p
(
x
). 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 p
(
I
j
) is larger than p
(
I
i
) when I
j is larger than I
i. All the weighted cumulative probabilities of the gray before I
i improve the final enhancement performance of the gray I
i in the function p
^
(
x
) compared with that in the function p
(
x
). 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 p
^
(
x
) can attain this goal through the preceding analysis of (6). Figure 1 shows the above analysis.Figure 1
Modifications of the original histogram with different values ofσ (α
=
0).Whenα
>
0, I
i
α is a monotonically increasing function defined by I
i. When I
i increases, the product I
i
α
×
p
^
(
I
i
) will enlarge p
^
(
I
i
) in gray value I
i. That is, I
i
α
×
p
^
(
I
i
) 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 I
i
α 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 histogramp
(
I
) is calculated.Step 2.
The original histogram is weighted according toI
i
α
×
∑
j
=
0
i
(
p
(
I
j
)
×
d
(
I
i
,
I
j
)
), and a new histogram and a new CDF are obtained.Step 3.
The new gray histogram is mapped according tof
(
I
k
)
=
I
0
+
(
I
L
-
1
-
I
0
)
C
(
I
k
), 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 functionsd
(
I
i
,
I
j
) will obtain different enhancement effects. This study selects the squared Euclidean distance deformation form as follows:(12)
d
I
i
,
I
j
=
e
-
I
i
-
I
j
2
/
2
σ
2
,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 σ
=
5 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 (δ
2), contrast (C), EME, Michelson law-based EME (EME_Michelson), EME using entropy (EME_entropy), and AME [32–34].Figure 2
Modifications of the CDF of the original histogram with different values ofσ (α
=
0).Figure 3
Two slice images of the original 3D CT image of the PCB.
(a)
6th slice image
(b)
43rd slice imageFigure 4
6th slice images of the different enhancement results of the original 3D CT image of the PCB with different values ofσ (α
=
0).
(a)
σ
=
5
(b)
σ
=
10
(c)
σ
=
15
(d)
σ
=
20
(e)
σ
=
25
(f)
σ
=
30Figure 5
Modifications of the original histogram with different values ofα (σ
=
5).
(a)
Modifications of the original histogram with different values ofα
(b)
Local enlargement of the left side of (a)
(c)
Local enlargement of the right side of (a)The size of a 3D imageI
(
x
,
y
,
z
) is L
×
W
×
H and the image is broken up into k
1
×
k
2
×
k
3 nonoverlapped subblocks. I
m
a
x
;
l
,
m
,
n
w and I
m
i
n
;
l
,
m
,
n
w are the maximum and minimum of every subblock, respectively. In this paper, we set the subblock size to 3
×
3
×
3 voxels. These aforementioned indicators are calculated by the following equations:(13)
δ
2
=
1
L
W
H
∑
x
=
1
L
∑
y
=
1
W
∑
z
=
1
H
I
x
,
y
,
z
-
μ
2
,where μ
=
(
1
/
L
W
H
)
∑
x
=
1
L
∑
y
=
1
W
∑
z
=
1
H
I
(
x
,
y
,
z
), which is the gray mean of the image;(14)
C
=
∑
x
=
1
L
∑
y
=
1
W
∑
z
=
1
H
∑
δ
=
0
255
δ
x
,
y
,
z
2
P
δ
x
,
y
,
z
,where δ
(
x
,
y
,
z
)
=
I
(
x
,
y
,
z
)
-
I
(
m
,
n
,
k
), I
(
m
,
n
,
k
) is one of the six neighborhoods of I
(
x
,
y
,
z
) in 3D space, and P
δ
(
x
,
y
,
z
) is the probability of δ
(
x
,
y
,
z
);(15)
EME
=
1
k
1
k
2
k
3
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
20
ln
⁡
I
m
a
x
;
l
,
m
,
n
w
I
m
i
n
;
l
,
m
,
n
w
+
c
,where c is a small constant equal to 0.000001 to avoid dividing by 0;(16)
EME_Michelson
=
1
k
1
k
2
k
3
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
20
ln
⁡
I
m
a
x
;
l
,
m
,
n
w
-
I
m
i
n
;
l
,
m
,
n
w
I
m
a
x
;
l
,
m
,
n
w
+
I
m
i
n
;
l
,
m
,
n
w
+
c
,
(17)
EME_entropy
=
max
⁡
︸
α
EME
k
1
,
k
2
,
k
3
α
,where E
M
E
k
1
,
k
2
,
k
3
(
α
)
=
(
1
/
k
1
k
2
k
3
)
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
α
(
I
m
a
x
;
l
,
m
,
n
w/(
I
m
i
n
;
l
,
m
,
n
w
+
c
)
)
α
l
n
(
I
m
a
x
;
l
,
m
,
n
w
/
(
I
m
i
n
;
l
,
m
,
n
w
+
c
)
);(18)
A
M
E
=
max
⁡
︸
α
A
M
E
k
1
,
k
2
,
k
3
α
,where A
M
E
k
1
,
k
2
,
k
3
(
α
)
=
(
1
/
k
1
k
2
k
3
)
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
α
(
(
I
m
a
x
;
l
,
m
,
n
w
-
I
m
i
n
;
l
,
m
,
n
w
)/(
I
m
a
x
;
l
,
m
,
n
w
+
I
m
i
n
;
l
,
m
,
n
w
+
c
)
)
α
l
n
(
(
I
m
a
x
;
l
,
m
,
n
w
-
I
m
i
n
;
l
,
m
,
n
w
)
/
(
I
m
a
x
;
l
,
m
,
n
w
+
I
m
i
n
;
l
,
m
,
n
w
+
c
)
)
.In (17) and (18), α is set from 0.1 to 1 at intervals of 0.1.The intensity distribution varianceδ
2 and contrast C 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 δ
2 and C 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 σ
=
5.Table 1
Results of the enhancement indicators with different values ofσ (α
=
0).
δ
2
C
EME
EME_Michelson
EME_entropy
AME
σ
=
5
5301.4
113.3032
48.6657
−182.0618
1.6361
−1.1349
σ
=
10
4476.2
78.8758
50.7792
−171.4402
1.8711
−1.1121
σ
=
15
3707.7
60.0761
52.3497
−165.7646
2.0425
−1.0985
σ
=
20
3060.1
47.6518
54.3363
−161.2780
2.2999
−1.0839
σ
=
25
2532.7
38.5262
56.0590
−159.5976
2.6441
−1.0795
σ
=
30
2114.4
31.7885
57.3516
−157.5428
2.8432
−1.0694


#### 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 (σ
=
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 α
=
0.5 for the experimental 3D image when σ
=
5.Table 2
Results of the enhancement indicators with different values ofα (σ
=
5).
δ
2
C
EME
EME_Michelson
EME_entropy
AME
α
=
0.1
5300.1
113.1104
50.2641
−180.2698
1.8186
−1.1266
α
=
0.2
5261.7
111.3227
50.8808
−179.5898
1.9254
−1.1247
α
=
0.3
5238.4
110.4491
51.7547
−178.4670
2.0297
−1.1203
α
=
0.5
5190.0
108.5125
53.8177
−176.2185
2.3154
−1.1113
α
=
0.6
5165.7
107.6472
55.1504
−174.9075
2.4976
−1.1057
α
=
0.7
5126.3
106.3441
55.2525
−174.3375
2.4789
−1.1041Figure 6
43rd slice images of the different enhancement results of the original 3D CT image of the PCB with different values ofα (σ
=
5).
(a)
α
=
0.1
(b)
α
=
0.2
(c)
α
=
0.3
(d)
α
=
0.5
(e)
α
=
0.6
(f)
α
=
0.7


### 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. Figure7 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, σ
=
5, α
=
0.5; in WTHE, α
=
0.5; in RSWHE and RMSHE, r
=
2; in WMSHE, r
=
1. As shown in Table 3, the proposed method achieves the best performance among all the indicators. However, the indicators C 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.Table 3
Results of the enhancement indicators of different algorithms.
δ
2
C
EME
EME_Michelson
EME_entropy
AME
BBHE
4099.3
78.3485
44.5323
−177.4295
0.5607
−1.1293
HE
5186.8
159.0364
37.5031
−215.8138
0.4681
−1.2302
DSIHE
4992.2
107.1096
46.3229
−175.5208
0.5863
−1.1136
MMBEBHE
1178.6
35.4638
36.9988
−211.7172
0.4566
−1.2245
RMSHE
1581.6
44.8693
29.8655
−253.1355
0.3690
−1.2820
WMSHE
2002.2
61.5583
37.1405
−214.1648
0.4613
−1.2254
RSWHE
227.1
3.8843
8.0991
−341.4916
0.0864
−1.6056
WTHE
2587.0
49.9144
30.1331
−235.8318
2.2706
−1.3675
GDDWHE
5190.0
108.5125
53.8177
−176.2185
2.3154
−1.1113Figure 7
Gray transformation curves of different algorithms.
(a)
Gray transformation curves of different algorithms
(b)
Local enlargement of (a)Figure 8
6th slice images of the enhancement results of different algorithms for the original 3D CT image of the PCB.
(a)
Original slice image
(b)
HE
(c)
BBHE
(d)
DSIHE
(e)
MMBEBHE
(f)
RMSHE
(g)
RSWHE
(h)
WTHE
(i)
WMSHE
(j)
GDDWHE (σ
=
5
,
α
=
0.5)Figure 9
43rd slice images of the enhancement results of different algorithms for the original 3D CT image of the PCB.
(a)
Original slice image
(b)
HE
(c)
BBHE
(d)
DSIHE
(e)
MMBEBHE
(f)
RMSHE
(g)
RSWHE
(h)
WTHE
(i)
WMSHE
(j)
GDDWHE (σ
=
5
,
α
=
0.5)


## 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 C
(
I
k
) is defined as follows: (5)
C
I
k
=
∑
i
=
0
k
I
i
α
×
∑
j
=
0
i
p
I
j
×
d
I
i
,
I
j
CONT
,where CONT
=
∑
i
=
0
L
-
1
(
I
i
α
×
∑
j
=
0
i
(
p
(
I
j
)
×
d
(
I
i
,
I
j
)
)
) and is a constant for normalization to calculate the probability. C
(
I
L
-
1
)
=
1 is obtained by the upper definition. α is a parameter that controls the degree of the gray value I
i involved in the weighting process. d
(
I
i
,
I
j
) represents the distance between grayscales I
i and I
j. The subscripts i and j satisfy the following requirement: 0
≤
j
≤
i
≤
L
-
1. I
j satisfies the following requirement: I
0
≤
I
j
≤
I
i. If I
i
=
I
j, then d
(
I
i
,
I
j
)
=
1. In other cases, 0
<
d
(
I
i
,
I
j
)
<
1. A great distance between I
i and I
j corresponds to small d
(
I
i
,
I
j
). 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:(6)
p
^
I
i
=
∑
j
=
0
i
p
I
j
×
d
I
i
,
I
j
.Thus, (5) is transformed into(7)
C
I
k
=
∑
i
=
0
k
I
i
α
×
p
^
I
i
CONT
.In fact, (5) uses (
I
i
α
×
p
^
(
I
i
)
)
/
CONT to replace p
(
I
i
) in (2). The functions of p
^
(
I
i
) and I
i
α are analyzed as follows: CONT is a constant. Thus, it is set aside temporarily in the following analyses.In (2), p
(
I
i
) can be denoted by the following expressions:(8)
p
I
i
=
0
×
p
I
0
+
0
×
p
I
1
+
⋯
+
0
×
p
I
i
-
1
+
1
×
p
I
i
=
∑
j
=
0
i
w
i
j
×
p
I
j
,where the weight w
i
j is denoted by the following expression:(9)
w
i
j
=
0
,
j
<
i
,
1
,
j
=
i
.The upper analysis indicates thatp
(
I
i
) includes only the probability of gray level I
i and it does not consider the probability of gray level I
j when j
<
i because the weight w
i
j equals zero under this circumstance.In (6), p
^
(
I
i
) can be denoted by the following expressions:(10)
p
^
I
i
=
∑
j
=
0
i
p
I
j
×
d
I
i
,
I
j
=
d
I
i
,
I
0
×
p
I
0
+
d
I
i
,
I
1
×
p
I
1
+
⋯
+
d
I
i
,
I
i
-
1
×
p
I
i
-
1
+
d
I
i
,
I
i
×
p
I
i
=
∑
j
=
0
i
w
i
j
×
p
I
j
,where the weight w
i
j is denoted by the following expression:(11)
w
i
j
=
d
I
i
,
I
j
,
j
<
i
,
d
I
i
,
I
j
=
d
I
i
,
I
i
=
1
,
j
=
i
.The distanced
(
I
i
,
I
j
) is used as the weight in the summation. The definition in (5) indicates that d
(
I
i
,
I
j
) is larger than zero. Unlike p
(
I
i
) in (2), p
^
(
I
i
) in (6) uses weight d
(
I
i
,
I
j
) to replace zero when the subscript j is smaller than i
. Thus, the summation in p
^
(
I
i
) takes into account all the probabilities of the grayscale that is smaller than or equal to grayscale I
i. p
^
(
I
i
) includes not only the probability of gray level I
i but also that of gray level I
j, which is smaller than I
i. In general, the weight will be small if the distance is far. Accordingly, the probability of the gray level close to I
i will have a larger contribution to p
^
(
I
i
). 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 p
(
I
j
) is smaller than p
(
I
i
) when I
j is smaller than I
i. After being weighted by d
(
I
i
,
I
j
), which is smaller than 1, the contribution of p
(
I
j
) will decrease in the function p
^
(
x
) compared with that in the function p
(
x
). 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 p
(
I
j
) is larger than p
(
I
i
) when I
j is larger than I
i. All the weighted cumulative probabilities of the gray before I
i improve the final enhancement performance of the gray I
i in the function p
^
(
x
) compared with that in the function p
(
x
). 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 p
^
(
x
) can attain this goal through the preceding analysis of (6). Figure 1 shows the above analysis.Figure 1
Modifications of the original histogram with different values ofσ (α
=
0).Whenα
>
0, I
i
α is a monotonically increasing function defined by I
i. When I
i increases, the product I
i
α
×
p
^
(
I
i
) will enlarge p
^
(
I
i
) in gray value I
i. That is, I
i
α
×
p
^
(
I
i
) 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 I
i
α 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 histogramp
(
I
) is calculated.Step 2.
The original histogram is weighted according toI
i
α
×
∑
j
=
0
i
(
p
(
I
j
)
×
d
(
I
i
,
I
j
)
), and a new histogram and a new CDF are obtained.Step 3.
The new gray histogram is mapped according tof
(
I
k
)
=
I
0
+
(
I
L
-
1
-
I
0
)
C
(
I
k
), 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 functionsd
(
I
i
,
I
j
) will obtain different enhancement effects. This study selects the squared Euclidean distance deformation form as follows:(12)
d
I
i
,
I
j
=
e
-
I
i
-
I
j
2
/
2
σ
2
,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 σ
=
5 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 (δ
2), contrast (C), EME, Michelson law-based EME (EME_Michelson), EME using entropy (EME_entropy), and AME [32–34].Figure 2
Modifications of the CDF of the original histogram with different values ofσ (α
=
0).Figure 3
Two slice images of the original 3D CT image of the PCB.
(a)
6th slice image
(b)
43rd slice imageFigure 4
6th slice images of the different enhancement results of the original 3D CT image of the PCB with different values ofσ (α
=
0).
(a)
σ
=
5
(b)
σ
=
10
(c)
σ
=
15
(d)
σ
=
20
(e)
σ
=
25
(f)
σ
=
30Figure 5
Modifications of the original histogram with different values ofα (σ
=
5).
(a)
Modifications of the original histogram with different values ofα
(b)
Local enlargement of the left side of (a)
(c)
Local enlargement of the right side of (a)The size of a 3D imageI
(
x
,
y
,
z
) is L
×
W
×
H and the image is broken up into k
1
×
k
2
×
k
3 nonoverlapped subblocks. I
m
a
x
;
l
,
m
,
n
w and I
m
i
n
;
l
,
m
,
n
w are the maximum and minimum of every subblock, respectively. In this paper, we set the subblock size to 3
×
3
×
3 voxels. These aforementioned indicators are calculated by the following equations:(13)
δ
2
=
1
L
W
H
∑
x
=
1
L
∑
y
=
1
W
∑
z
=
1
H
I
x
,
y
,
z
-
μ
2
,where μ
=
(
1
/
L
W
H
)
∑
x
=
1
L
∑
y
=
1
W
∑
z
=
1
H
I
(
x
,
y
,
z
), which is the gray mean of the image;(14)
C
=
∑
x
=
1
L
∑
y
=
1
W
∑
z
=
1
H
∑
δ
=
0
255
δ
x
,
y
,
z
2
P
δ
x
,
y
,
z
,where δ
(
x
,
y
,
z
)
=
I
(
x
,
y
,
z
)
-
I
(
m
,
n
,
k
), I
(
m
,
n
,
k
) is one of the six neighborhoods of I
(
x
,
y
,
z
) in 3D space, and P
δ
(
x
,
y
,
z
) is the probability of δ
(
x
,
y
,
z
);(15)
EME
=
1
k
1
k
2
k
3
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
20
ln
⁡
I
m
a
x
;
l
,
m
,
n
w
I
m
i
n
;
l
,
m
,
n
w
+
c
,where c is a small constant equal to 0.000001 to avoid dividing by 0;(16)
EME_Michelson
=
1
k
1
k
2
k
3
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
20
ln
⁡
I
m
a
x
;
l
,
m
,
n
w
-
I
m
i
n
;
l
,
m
,
n
w
I
m
a
x
;
l
,
m
,
n
w
+
I
m
i
n
;
l
,
m
,
n
w
+
c
,
(17)
EME_entropy
=
max
⁡
︸
α
EME
k
1
,
k
2
,
k
3
α
,where E
M
E
k
1
,
k
2
,
k
3
(
α
)
=
(
1
/
k
1
k
2
k
3
)
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
α
(
I
m
a
x
;
l
,
m
,
n
w/(
I
m
i
n
;
l
,
m
,
n
w
+
c
)
)
α
l
n
(
I
m
a
x
;
l
,
m
,
n
w
/
(
I
m
i
n
;
l
,
m
,
n
w
+
c
)
);(18)
A
M
E
=
max
⁡
︸
α
A
M
E
k
1
,
k
2
,
k
3
α
,where A
M
E
k
1
,
k
2
,
k
3
(
α
)
=
(
1
/
k
1
k
2
k
3
)
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
α
(
(
I
m
a
x
;
l
,
m
,
n
w
-
I
m
i
n
;
l
,
m
,
n
w
)/(
I
m
a
x
;
l
,
m
,
n
w
+
I
m
i
n
;
l
,
m
,
n
w
+
c
)
)
α
l
n
(
(
I
m
a
x
;
l
,
m
,
n
w
-
I
m
i
n
;
l
,
m
,
n
w
)
/
(
I
m
a
x
;
l
,
m
,
n
w
+
I
m
i
n
;
l
,
m
,
n
w
+
c
)
)
.In (17) and (18), α is set from 0.1 to 1 at intervals of 0.1.The intensity distribution varianceδ
2 and contrast C 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 δ
2 and C 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 σ
=
5.Table 1
Results of the enhancement indicators with different values ofσ (α
=
0).
δ
2
C
EME
EME_Michelson
EME_entropy
AME
σ
=
5
5301.4
113.3032
48.6657
−182.0618
1.6361
−1.1349
σ
=
10
4476.2
78.8758
50.7792
−171.4402
1.8711
−1.1121
σ
=
15
3707.7
60.0761
52.3497
−165.7646
2.0425
−1.0985
σ
=
20
3060.1
47.6518
54.3363
−161.2780
2.2999
−1.0839
σ
=
25
2532.7
38.5262
56.0590
−159.5976
2.6441
−1.0795
σ
=
30
2114.4
31.7885
57.3516
−157.5428
2.8432
−1.0694


### 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 (σ
=
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 α
=
0.5 for the experimental 3D image when σ
=
5.Table 2
Results of the enhancement indicators with different values ofα (σ
=
5).
δ
2
C
EME
EME_Michelson
EME_entropy
AME
α
=
0.1
5300.1
113.1104
50.2641
−180.2698
1.8186
−1.1266
α
=
0.2
5261.7
111.3227
50.8808
−179.5898
1.9254
−1.1247
α
=
0.3
5238.4
110.4491
51.7547
−178.4670
2.0297
−1.1203
α
=
0.5
5190.0
108.5125
53.8177
−176.2185
2.3154
−1.1113
α
=
0.6
5165.7
107.6472
55.1504
−174.9075
2.4976
−1.1057
α
=
0.7
5126.3
106.3441
55.2525
−174.3375
2.4789
−1.1041Figure 6
43rd slice images of the different enhancement results of the original 3D CT image of the PCB with different values ofα (σ
=
5).
(a)
α
=
0.1
(b)
α
=
0.2
(c)
α
=
0.3
(d)
α
=
0.5
(e)
α
=
0.6
(f)
α
=
0.7


## 3.2.1. Selecting the Distance Function

Different distance functionsd
(
I
i
,
I
j
) will obtain different enhancement effects. This study selects the squared Euclidean distance deformation form as follows:(12)
d
I
i
,
I
j
=
e
-
I
i
-
I
j
2
/
2
σ
2
,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 σ
=
5 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 (δ
2), contrast (C), EME, Michelson law-based EME (EME_Michelson), EME using entropy (EME_entropy), and AME [32–34].Figure 2
Modifications of the CDF of the original histogram with different values ofσ (α
=
0).Figure 3
Two slice images of the original 3D CT image of the PCB.
(a)
6th slice image
(b)
43rd slice imageFigure 4
6th slice images of the different enhancement results of the original 3D CT image of the PCB with different values ofσ (α
=
0).
(a)
σ
=
5
(b)
σ
=
10
(c)
σ
=
15
(d)
σ
=
20
(e)
σ
=
25
(f)
σ
=
30Figure 5
Modifications of the original histogram with different values ofα (σ
=
5).
(a)
Modifications of the original histogram with different values ofα
(b)
Local enlargement of the left side of (a)
(c)
Local enlargement of the right side of (a)The size of a 3D imageI
(
x
,
y
,
z
) is L
×
W
×
H and the image is broken up into k
1
×
k
2
×
k
3 nonoverlapped subblocks. I
m
a
x
;
l
,
m
,
n
w and I
m
i
n
;
l
,
m
,
n
w are the maximum and minimum of every subblock, respectively. In this paper, we set the subblock size to 3
×
3
×
3 voxels. These aforementioned indicators are calculated by the following equations:(13)
δ
2
=
1
L
W
H
∑
x
=
1
L
∑
y
=
1
W
∑
z
=
1
H
I
x
,
y
,
z
-
μ
2
,where μ
=
(
1
/
L
W
H
)
∑
x
=
1
L
∑
y
=
1
W
∑
z
=
1
H
I
(
x
,
y
,
z
), which is the gray mean of the image;(14)
C
=
∑
x
=
1
L
∑
y
=
1
W
∑
z
=
1
H
∑
δ
=
0
255
δ
x
,
y
,
z
2
P
δ
x
,
y
,
z
,where δ
(
x
,
y
,
z
)
=
I
(
x
,
y
,
z
)
-
I
(
m
,
n
,
k
), I
(
m
,
n
,
k
) is one of the six neighborhoods of I
(
x
,
y
,
z
) in 3D space, and P
δ
(
x
,
y
,
z
) is the probability of δ
(
x
,
y
,
z
);(15)
EME
=
1
k
1
k
2
k
3
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
20
ln
⁡
I
m
a
x
;
l
,
m
,
n
w
I
m
i
n
;
l
,
m
,
n
w
+
c
,where c is a small constant equal to 0.000001 to avoid dividing by 0;(16)
EME_Michelson
=
1
k
1
k
2
k
3
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
20
ln
⁡
I
m
a
x
;
l
,
m
,
n
w
-
I
m
i
n
;
l
,
m
,
n
w
I
m
a
x
;
l
,
m
,
n
w
+
I
m
i
n
;
l
,
m
,
n
w
+
c
,
(17)
EME_entropy
=
max
⁡
︸
α
EME
k
1
,
k
2
,
k
3
α
,where E
M
E
k
1
,
k
2
,
k
3
(
α
)
=
(
1
/
k
1
k
2
k
3
)
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
α
(
I
m
a
x
;
l
,
m
,
n
w/(
I
m
i
n
;
l
,
m
,
n
w
+
c
)
)
α
l
n
(
I
m
a
x
;
l
,
m
,
n
w
/
(
I
m
i
n
;
l
,
m
,
n
w
+
c
)
);(18)
A
M
E
=
max
⁡
︸
α
A
M
E
k
1
,
k
2
,
k
3
α
,where A
M
E
k
1
,
k
2
,
k
3
(
α
)
=
(
1
/
k
1
k
2
k
3
)
∑
l
=
1
k
1
∑
m
=
1
k
2
∑
n
=
1
k
3
α
(
(
I
m
a
x
;
l
,
m
,
n
w
-
I
m
i
n
;
l
,
m
,
n
w
)/(
I
m
a
x
;
l
,
m
,
n
w
+
I
m
i
n
;
l
,
m
,
n
w
+
c
)
)
α
l
n
(
(
I
m
a
x
;
l
,
m
,
n
w
-
I
m
i
n
;
l
,
m
,
n
w
)
/
(
I
m
a
x
;
l
,
m
,
n
w
+
I
m
i
n
;
l
,
m
,
n
w
+
c
)
)
.In (17) and (18), α is set from 0.1 to 1 at intervals of 0.1.The intensity distribution varianceδ
2 and contrast C 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 δ
2 and C 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 σ
=
5.Table 1
Results of the enhancement indicators with different values ofσ (α
=
0).
δ
2
C
EME
EME_Michelson
EME_entropy
AME
σ
=
5
5301.4
113.3032
48.6657
−182.0618
1.6361
−1.1349
σ
=
10
4476.2
78.8758
50.7792
−171.4402
1.8711
−1.1121
σ
=
15
3707.7
60.0761
52.3497
−165.7646
2.0425
−1.0985
σ
=
20
3060.1
47.6518
54.3363
−161.2780
2.2999
−1.0839
σ
=
25
2532.7
38.5262
56.0590
−159.5976
2.6441
−1.0795
σ
=
30
2114.4
31.7885
57.3516
−157.5428
2.8432
−1.0694


## 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 (σ
=
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 α
=
0.5 for the experimental 3D image when σ
=
5.Table 2
Results of the enhancement indicators with different values ofα (σ
=
5).
δ
2
C
EME
EME_Michelson
EME_entropy
AME
α
=
0.1
5300.1
113.1104
50.2641
−180.2698
1.8186
−1.1266
α
=
0.2
5261.7
111.3227
50.8808
−179.5898
1.9254
−1.1247
α
=
0.3
5238.4
110.4491
51.7547
−178.4670
2.0297
−1.1203
α
=
0.5
5190.0
108.5125
53.8177
−176.2185
2.3154
−1.1113
α
=
0.6
5165.7
107.6472
55.1504
−174.9075
2.4976
−1.1057
α
=
0.7
5126.3
106.3441
55.2525
−174.3375
2.4789
−1.1041Figure 6
43rd slice images of the different enhancement results of the original 3D CT image of the PCB with different values ofα (σ
=
5).
(a)
α
=
0.1
(b)
α
=
0.2
(c)
α
=
0.3
(d)
α
=
0.5
(e)
α
=
0.6
(f)
α
=
0.7


## 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. Figure7 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, σ
=
5, α
=
0.5; in WTHE, α
=
0.5; in RSWHE and RMSHE, r
=
2; in WMSHE, r
=
1. As shown in Table 3, the proposed method achieves the best performance among all the indicators. However, the indicators C 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.Table 3
Results of the enhancement indicators of different algorithms.
δ
2
C
EME
EME_Michelson
EME_entropy
AME
BBHE
4099.3
78.3485
44.5323
−177.4295
0.5607
−1.1293
HE
5186.8
159.0364
37.5031
−215.8138
0.4681
−1.2302
DSIHE
4992.2
107.1096
46.3229
−175.5208
0.5863
−1.1136
MMBEBHE
1178.6
35.4638
36.9988
−211.7172
0.4566
−1.2245
RMSHE
1581.6
44.8693
29.8655
−253.1355
0.3690
−1.2820
WMSHE
2002.2
61.5583
37.1405
−214.1648
0.4613
−1.2254
RSWHE
227.1
3.8843
8.0991
−341.4916
0.0864
−1.6056
WTHE
2587.0
49.9144
30.1331
−235.8318
2.2706
−1.3675
GDDWHE
5190.0
108.5125
53.8177
−176.2185
2.3154
−1.1113Figure 7
Gray transformation curves of different algorithms.
(a)
Gray transformation curves of different algorithms
(b)
Local enlargement of (a)Figure 8
6th slice images of the enhancement results of different algorithms for the original 3D CT image of the PCB.
(a)
Original slice image
(b)
HE
(c)
BBHE
(d)
DSIHE
(e)
MMBEBHE
(f)
RMSHE
(g)
RSWHE
(h)
WTHE
(i)
WMSHE
(j)
GDDWHE (σ
=
5
,
α
=
0.5)Figure 9
43rd slice images of the enhancement results of different algorithms for the original 3D CT image of the PCB.
(a)
Original slice image
(b)
HE
(c)
BBHE
(d)
DSIHE
(e)
MMBEBHE
(f)
RMSHE
(g)
RSWHE
(h)
WTHE
(i)
WMSHE
(j)
GDDWHE (σ
=
5
,
α
=
0.5)


## 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.



---

*Source: 1529782-2016-05-04.xml*