## 3 Three-Dimensional (3D) Shadow Modeling
Figure 7 shows the shadow map of a 3D crack image under the lateral and longitudinal projection. To obtain the final integrated shadow map, the shadow maps under lateral and longitudinal projection are arranged by:  
\[I_{c}(i,j)=\left\{ \begin{array}{ll}1,&\text{if }B_{c}(i,j)=0\text{ or }\overline{B_{c}}(i,j)=0\\ 0,&\text{otherwise}\end{array} \right. \tag{2}\]  
Figure 5: Lateral and longitudinal projections. Figure 6: Illustration of tracing a single light projection. where \(I_{c}(i,j)\) is the integrated shadow map; \(B(i,j)_{c}\) is the binary value of the point \((i,j)\) in the horizontal shadow map; \(\overline{B_{c}}(i,j)\) is the binary value of the point \((i,j)\) in the vertical shadow map; and \((i,j)\) is the binary value of the integrated shadow map. The integrated shadow map is noise corrupted. Therefore, the next step of the 3D-SM is noise elimination using the connected domain analysis [44]. The connected domain analysis makes use of the continuity and geometry properties of corrosion cracks. In general, a concerned crack has a continuous linear shape, and its length is much greater than its width. Hence, interconnected shadow points in the integrated shadow map are classified into groups for crack inspection and scattered shadow points are considered as noise to be eliminated. After the noise elimination, crack extraction from shadow groups based on that crack characteristics is carried out. For the corrosion cracks on the pipeline's surface, with which we are presently concerned, they are in a slender linear shape, in which their which height is much less than that of the pipeline's surface. Moreover, their width is relatively uniform in a small range. According to these crack characteristics, the linear pattern analysis technique is used to filter shadow groups. If a shadow group does not fulfill the any of the following three criteria, it will be considered as noise to be eliminated. First, to ensure that the shadow group has a slender linear pattern, a shape aspect ratio is defined:  
\[P_{i}=\sum_{j=1}^{N_{i}-1}\frac{\left|W_{i,j+1}-W_{i,j}\right|}{W_{i,j}(N_{i}- 1)}\ \leq R_{P} \tag{3}\]  
where \(W  
\[T_{i}\leq R_{t} \tag{7}\]  
where \(P_{t_{i,j}}\) is the center point of the section of shadow group \(i\); \(V_{i,j}\) is the current direction of the third section of shadow group \(i\); \(\widetilde{V}_{i,j}\) is the next direction of the \(j\)th section of shadow group \(i\); \(N_{i}\) is the total number of profiles of shadow group \(i\); and \(R_{t}\) is the average direction difference threshold, \(R_{t}=\pi/12\). To ensure that an extracted crack has slender linear patterns, we use the thresholds given in Equations (3), (4) and (7) to control each quantified index. When a shadow group does not fulfill the above criteria, it is considered as a noise group to be eliminated. In this study, the threshold values are assigned to be noise. Figure 8 demonstrates an example for noise shadow groups cleaning. Several shadow groups were considered as noise groups because they did not fulfill the criteria. It is obvious that the resultant shadow map shown in Figure 8c filtered unnecessary scatter shadow groups and depicted a clearer crack pattern.