# Automated Visual Inspection of Ship Hull Surfaces Using the Wavelet Transform

Authors: Carlos Fernández-Isla; Pedro J. Navarro; Pedro María Alcover
Journal: Mathematical Problems in Engineering
 (2013)

---

## Abstract

A new online visual inspection technique is proposed, based on a wavelet reconstruction scheme over images obtained from the hull. This type of visual inspection to detect defects in hull surfaces is commonly carried out at shipyards by human inspectors before the hull repair task starts. We propose the use of Shannon entropy for automatic selection of the band for image reconstruction which provides a low decomposition level, thus avoiding excessive degradation of the image, allowing more precise defect segmentation. The proposed method here is capable of on-line  assisting  to a robotic system to perform grit blasting operations over damage areas of ship hulls. This solution allows a reliable and cost-effective operation for hull grit spot blasting. A prototype of the automated blasting system has been developed and tested in the Spanish NAVANTIA shipyards.


---

## Body

## 1. Introduction

Main ships’ maintenance care consists of periodical (every 4-5 years) hull treatment which includes blasting works; blasting consists in projecting a high-pressure jet of abrasive matter (typically water or grit) onto a surface to remove adherences or rust traces. The object of this task is to maintain hull integrity, guarantee navigational safety conditions, and assure that the surface offers little resistance to the water in order to reduce fuel consumption. That object can be achieved by grit blasting [1] or ultra-high pressure water jetting [2]. In most cases these techniques are applied using manual or semiautomated procedures with the help of robotized devices [3]. In either case defects are detected by means of human operators; this is therefore a subjective task and hence vulnerable to cumulative operator fatigue and highly dependent on the experience of the personnel performing the task. Figure 1 shows a view of ship’s hulls under repair at NAVANTIA’s shipyards.Ship’s hulls at a repair yard.
(a)
Shaped hull
(b)
Flat hull
(c)
Damaged portions
(d)
Detail visual appearanceFrom an operational point of view, there are two working modes: full blasting and spot blasting. Full blasting consists of blasting the entire hull of the ship, while spot blasting consists of blasting numerous isolated areas where corrosion has been observed. Spot blasting is the most demanded operation due to cost saving reasons. This second working mode demands very precise information about position, size, and shape of damaged portions of the hull to make robotic devices [3–5] to achieve maximum efficiency.This paper proposes a computer vision algorithm which equips a machine vision system (see Figure2), capable for precisely detecting defects in ship hulls which is simple enough to be implemented in such a way as to meet the real-time requirements for the application.Figure 2
Machine vision system for hull blasting.Because of the textured appearance of the hull’s surface under inspection (see Figures1(c) and 1(d)), we have used the wavelet transform, and the developed computer vision algorithm includes an image reconstruction approach based on automatic selection of the optimal wavelet transform resolution level, using Shannon entropy.


## 2. Defect Detection in Textured Surfaces

Texture is a very important characteristic when identifying defects or flaws, as it provides important information for defect detection. In fact, the task of detecting defects has been largely seen as a texture analysis problem. Figure3 shows several texture images from ship hull surfaces.Figure 3
Texture images from ships’ hull surface.In his review Xie [6] classified texture analysis techniques for defect detection in four categories: statistical approaches, structural approaches, filter based approaches, and model based approaches. In his review of fabric defect detection similarly Kumar [7] classified the proposed solutions into three categories: statistical, spectral, and model based. In his review of automated defect detection in fabric, Ngan et al. [8] classified defect detection techniques in textured fabric into nonmotif-based and motif-based approaches. The motif-based approach [9] uses the symmetry property of motifs to calculate the energy of moving subtraction and its variance among different motifs. Many defect detection methods usually use clustering techniques which are mainly based on texture feature extraction and texture classifications. These features are collated using methods such as cooccurrence matrix [10], Fourier transform [11], Gabor transform [12], or the wavelet transform [13].Spectral-approach methods for texture analysis characterize the frequency contents of a texture image—Fourier transform—or provide spatial-frequency analysis—Gabor filters, wavelets. A two-dimensional spectrum of a visual texture frequently contains information about the periodicity and directionality of the texture pattern. For example, a texture with a coarse appearance analysed from the spectral point of view shows high-frequency components, while a texture with a fine appearance shows low-frequency components. The analytical methods based on Fourier transform show good results in texture patterns with high regularity and/or directionality, but they are limited by a lack of spatial localization. In this field, Gabor filters provide better spatial localization, although their utility in natural textures is limited because there is no single filter resolution that can localize a structure. The wavelet transform has some advantages over the Gabor transform, such as the fact that the variation of the spatial resolution makes it possible to represent the textures in the appropriate scale, as well as to choose from a wide range of wavelet functions.


## 3. The Wavelet Transform for Defect Detection

The suitability of wavelet transforms for use in image analysis is well established: a representation in terms of the frequency content of local regions over a range of scales provides an ideal framework for the analysis of image features, which in general are of different size and can often be characterised by their frequency domain properties [14]. This makes the wavelet transform an attractive option when attempting defect detection in textured products, as reported by Truchetet and Laligant [15] in his review of industrial applications of wavelet-based image processing. He reported different uses of wavelet analysis in successful machine vision applications: detecting defects for manufacturing applications for the production of furniture, textiles, integrated circuits, and so forth, from their wavelet transformation and vector quantization-related properties of the associated wavelet coefficients; printing defect identification and classification (applied to printed decoration and tampon printed images) by analysing the fractal properties of a textured image; online inspection of the loom under construction using a specific class of the 2D discrete wavelet transform (DWT) called the multiscale wavelet representation with the objectives of attenuating the background texture and accentuating the defects; online fabric inspection device performing an independent component analysis on a subband decomposition provided by a 2-level DWT in order to increase the defect detection rate.The review of the literature shows two categories of defect detection methods based on wavelet transform. The first category includes direct thresholding methods [10, 11], whose design is based on the fact that texture background can be attenuated by the wavelet decomposition. If we remove the texture pattern from real texture, it is feasible to use existing defect detecting techniques for nontexture images, such as thresholding techniques [16]. Textural features extracted from wavelet-decomposed images are another category which is widely used for defect detection [17, 18]. Features extracted from the texture patterns are used as feature vectors to feed a classifier (Bayer, Euclidean distance, Neural Networks, or Support Vector Machines), which has unavoidable drawbacks when dealing with the vast image data obtained during inspection tasks. For instance, proximity-based methods tend to be computationally expensive and there is no straightforward way of defining a meaningful stopping criterion for data fusion (or division). Often, the learning-based classifiers need to be trained by the nondefect features, which is a troublesome and usually time consuming procedure, thus limiting its real-time applications [10]. For this reason we have focused on direct thresholding methods. The use of direct thresholding presents a main challenge: how to select the decomposition level. On the other hand, direct thresholding presents two main drawbacks: (1) an excessive wavelet decomposition level produces a fusion of defects with the texture pattern and (2) a wrong reconstruction scheme produces false positives when defects are detected.The work presented here is based on the authors’ research on previous works [10, 19] and addresses abovementioned drawbacks by a new approach based on Shannon Entropy calculation. Its main contribution is the formulation of a novel use of the normalized Shannon Entropy, calculated on the different detail subimages, to determine the optimal decomposition level in textures with low directionality. For this purpose we propose to calculate the optimal decomposition level as the maximum of the ratio between the entropy of the approximation subimage and the total entropy, as the sum of entropies calculated for every subimage.


### 3.1. Wavelet Decomposition

For an imagef(x,y) of size M×N pixels, each level of wavelet decomposition is obtained by applying two filters: a low-pass filter (L) and a high-pass filter (H). The different combinations of these filters produce four images that are here denoted with the subscripts LL, LH, HL, and HH. In the first decomposition level four subimages or bands are produced: one smooth image, also called approximation, fLL(1)(x,y), that represents an approximation of the original image f(x,y) and three detail subimages fLH(1)(x,y), fHL(1)(x,y), and fHH(1)(x,y), which represent the horizontal, vertical and diagonal details, respectively. With this notation, fLL(0)(x,y) represents the original image, f(x,y), and fLL(j)(x,y) represent the approximation image in the decomposition level j. From each decomposition level fLL(j)(x,y) we obtain four subimages, designated here as fLL(j+1)(x,y),fLH(j+1)(x,y),fHL(j+1)(x,y), and fHH(j+1)(x,y), which together form the decomposition level j+1. The pyramid algorithm to obtain fLL(j)(x,y),fLH(j)(x,y),fHL(j)(x,y), and fHH(j)(x,y), as well as the calculation of the inverse transform, can be found in [20]. We will designate F(x,y)=W-1[fLL(j)] as the inverse wavelet transform of a subimage fLL(j)from the resolution level j to level 0.Figure4 shows the wavelet decomposition for three conveniently scaled levels (j=3) of a statistical texture pattern—painted surface—with corrosion defects; the different subimages or bands are shown (named LL, LH, HL, and HH). These were obtained after applying the different coefficients of the wavelet filters. More specifically, the image in Figure 4(a) was decomposed through the application of the Haar wavelet with two coefficients. At level j, images of size (N/2j)×(M/2j) pixels are obtained by iterative application of the pyramid algorithm. Note also that the subimages corresponding to the different decomposition levels are produced by successively applying the low-pass and high-pass filters and reducing the rows and columns by a factor of two.Decomposition of an image from a damaged hull, using Haar wavelet with two coefficients, at three decomposition levels: (a) original image, (b) first decomposition level, (c) second decomposition level, and (d) third decomposition level.
(a)
(b)
(c)
(d)


## 3.1. Wavelet Decomposition

For an imagef(x,y) of size M×N pixels, each level of wavelet decomposition is obtained by applying two filters: a low-pass filter (L) and a high-pass filter (H). The different combinations of these filters produce four images that are here denoted with the subscripts LL, LH, HL, and HH. In the first decomposition level four subimages or bands are produced: one smooth image, also called approximation, fLL(1)(x,y), that represents an approximation of the original image f(x,y) and three detail subimages fLH(1)(x,y), fHL(1)(x,y), and fHH(1)(x,y), which represent the horizontal, vertical and diagonal details, respectively. With this notation, fLL(0)(x,y) represents the original image, f(x,y), and fLL(j)(x,y) represent the approximation image in the decomposition level j. From each decomposition level fLL(j)(x,y) we obtain four subimages, designated here as fLL(j+1)(x,y),fLH(j+1)(x,y),fHL(j+1)(x,y), and fHH(j+1)(x,y), which together form the decomposition level j+1. The pyramid algorithm to obtain fLL(j)(x,y),fLH(j)(x,y),fHL(j)(x,y), and fHH(j)(x,y), as well as the calculation of the inverse transform, can be found in [20]. We will designate F(x,y)=W-1[fLL(j)] as the inverse wavelet transform of a subimage fLL(j)from the resolution level j to level 0.Figure4 shows the wavelet decomposition for three conveniently scaled levels (j=3) of a statistical texture pattern—painted surface—with corrosion defects; the different subimages or bands are shown (named LL, LH, HL, and HH). These were obtained after applying the different coefficients of the wavelet filters. More specifically, the image in Figure 4(a) was decomposed through the application of the Haar wavelet with two coefficients. At level j, images of size (N/2j)×(M/2j) pixels are obtained by iterative application of the pyramid algorithm. Note also that the subimages corresponding to the different decomposition levels are produced by successively applying the low-pass and high-pass filters and reducing the rows and columns by a factor of two.Decomposition of an image from a damaged hull, using Haar wavelet with two coefficients, at three decomposition levels: (a) original image, (b) first decomposition level, (c) second decomposition level, and (d) third decomposition level.
(a)
(b)
(c)
(d)


## 4. Entropy-Based Method for the Automatic Selection of the Wavelet Decomposition Level

In image processing, entropy has been used by many authors as part of the algorithmic development procedure. There are examples of the use of entropy in the programming of thresholding algorithms [21] and image segmenting [22] as a descriptor for texture classification [23]; as one of the parameters selected by Haralick et al. for application to gray level concurrence matrixes and used for texture characterization [24]; as an element in characteristic vector groups used for classification by Bayesian techniques [25], neuronal networks [26], compact support vectors [27], and so forth.


### 4.1. Automatic Selection of the Appropriate Decomposition Level

In this work we propose a novel approach for the automatic selection of the appropriate decomposition level by means of Shannon entropy. The entropy function was used to identify the resolution level that provides the most information about defects in real textures. For this purpose, the intensity levels of the subimages of the wavelet transform were considered as random samples. The concept of information entropy—Shannon entropy—describes how much randomness (or uncertainty) there is in a signal or an image; in other words, how much information is provided by the signal or image. In terms of physics, the greater the information entropy of the image is, the higher its quality will be [28].Figure5 shows how the texture pattern degrades as the decomposition level increases. This degradation is distributed among the different decomposition levels depending on the texture nature and can be quantified by means of the Shannon entropy.Approximation subimages(fLL(j)) of four wavelet decomposition levels for different images ((a) H225, (b) H34, (c) H241, (d) H137, and (e) H10) from portions of ship’s hulls.
(a)
(b)
(c)
(d)
(e)The Shannon entropy function [28, 29] is calculated according to the expression
(1)s(X)=-∑i=1Tp(xi)logp(xi),
where X={x1,x2,…,xT} is a set of random variables with T outcomes and p(xi) is the probability of occurrence associated with xi.For a 256-gray-level image of sizeNt pixels, we define a set of random variables X={x1,x2,…,xi,…,x256} as the number of pixels in the image that have gray level i. The probability of this random variable xi is calculated as the number of occurrences, hist[xi], divided by the total number of pixels, Nt(2)p(xi)=hist[xi]Nt.To calculate the value of the Shannon entropy on the approximation subimage (fLL(j)(x,y)) and on the horizontal, vertical and diagonal detail subimages (fLH(j)(x,y),fHL(j)(x,y), and fHH(j)(x,y)) in each decomposition level j, we obtain first the inverse wavelet transform of every subimage and then we apply (3)
(3)sLLj=s[W-1[fLL(j)(x,y)]],sLHj=s[W-1[fLH(j)(x,y)]],sHLj=s[W-1[fHL(j)(x,y)]],sHHj=s[W-1[fHH(j)(x,y)]].The normalized entropy of each subimage, for a decomposition levelj, has been calculated as
(4)Ssj=1Npixelsj∑x∑ysLLj(x,y),Shj=1Npixelsj∑x∑ysLHj(x,y),Svj=1Npixelsj∑x∑ysHLj(x,y),Sdj=1Npixelsj∑x∑ysHHj(x,y),
where Npixelsj is the number of pixels at each decomposition level j. Table 1 shows the values for Shannon entropy calculated for images of Figure 5.Table 1
Normalized entropies of four decomposition levels for textures of Figure5.
Decomposition level,j
S
s
j
S
h
j
S
v
j
S
d
j
H225
j
=
1
0.00011
0.00008
0.00007
0.00004
j
=
2
0.00048
0.00042
0.00042
0.00037
j
=
3
0.00200
0.00172
0.00168
0.00179
j
=
4
0.00796
0.00750
0.00681
0.00716
H34
j
=
1
0.00011
0.00007
0.00008
0.00006
j
=
2
0.00046
0.00038
0.00039
0.00038
j
=
3
0.00185
0.00179
0.00169
0.00186
j
=
4
0.00732
0.00750
0.00662
0.00698
H241
j
=
1
0.00011
0.00007
0.00007
0.00005
j
=
2
0.00046
0.00038
0.00037
0.00036
j
=
3
0.00194
0.00159
0.00151
0.00164
j
=
4
0.00763
0.00669
0.00640
0.00643
H137
j
=
1
0.00011
0.00007
0.00006
0.00004
j
=
2
0.00047
0.00028
0.00027
0.00031
j
=
3
0.00191
0.00127
0.00132
0.00118
j
=
4
0.00726
0.00593
0.00581
0.00524
H10
j
=
1
0.00013
0.00004
0.00004
0.00002
j
=
2
0.00057
0.00035
0.00037
0.00025
j
=
3
0.00214
0.00190
0.00182
0.00140
j
=
4
0.00841
0.00711
0.00737
0.00665Shannon entropy brings us information about the amount of texture pattern that remains after every decomposition level. Considering (2), entropy provides a measurement of the histogram distribution; the higher the entropy the greater the histogram uniformity; that is, a greater amount of texture pattern is contained in the image. As the decomposition level increases, the texture pattern is being removed; that is, the information content decreases; so the histogram distribution gains uniformity. An optimal reconstruction scheme would eliminate the texture pattern, without loss of defect information. To determine this optimal decomposition level we use a ratio Rj (see (5)) between the entropy of the approximation subimage and the sum of the entropies for all detail subimages, so Rj indicates how much information about the texture pattern is contained in decomposition level j. Variations in this ratio allow detecting changes in the amount of information about the texture pattern between two consecutive decomposition levels
(5)Rj=SsjSsj+Shj+Svj+Sdj,j=1,2,….The goal is to find the optimal decomposition level which provides the maximum variation among two consecutiveRj values because this indicates that, in decomposition level j, the texture pattern still present in level j-1 has been removed, keeping useful information (defects).For this purpose we defineADRj as the difference between two consecutive Rj values (see (6)). The optimal decomposition level  J* is calculated as the value of j for which ADRj takes a maximum value. This maximum value points out the greatest variation of information content among two consecutive decomposition levels, which means that both decomposition levels are sufficiently separated in terms of texture pattern information content, and the decomposition process should end. For decomposition levels j<J*,  ADRj indicates that significant texture pattern information still remains in the approximation subimage, and the decomposition process should continue. For decomposition levels j>J*; ADRj indicates that the approximation subimage is oversmoothed, and the reconstruction result from such smooth approximation subimage will cause defect loss
(6)ADRj={0j=1Rj-Rj-1j=2,…},J*=arg{maxj(|ADRj|)}.Table2 shows values for Rj coefficients at every image decomposition level (j) for the different textures shown in Figure 5, together with the ADRj values.Table 2
R
j, ADRj, and optimal decomposition level obtained for texture images of Figure 5.
Image
Level (j)
1
2
3
4
J
*
H225
R
j
0.3785
0.2812
0.2778
0.2704
2
ADR
j
0
0.0973
0.0035
0.0074
H34
R
j
0.3460
0.2852
0.2576
0.2575
2
ADR
j
0
0.0608
0.0276
0.0002
H241
R
j
0.3626
0.2931
0.2899
0.2811
2
ADR
j
0
0.0695
0.0032
0.0088
H137
R
j
0.388067
0.353254
0.336133
0.299523
4
ADR
j
0
0.034813
0.017121
0.036610
H10
R
j
0.545018
0.369480
0.294868
0.284585
2
ADR
j
0
0.175538
0.074612
0.010283Once the optimal decomposition level is obtained, the process ends with the production of the reconstructed image using (7)
(7)F(x,y)=W-1[fLL(j)(x,y)].


### 4.2. Smoothing Mask

To remove the noise running through the successive decomposition levels, we applied average-based smoothing over imageF(x,y) to obtain F′(x,y) as shown in (8)
(8)F′(x,y)=1k2∑i=0k-1∑j=0k-1F(x-⌊k2⌋+i,y-⌊k2⌋+j),
where k is the size of the smoothing mask (see Figure 6).Figure 6
Smoothing mask (k=3) for the wavelet coefficients.


## 4.1. Automatic Selection of the Appropriate Decomposition Level

In this work we propose a novel approach for the automatic selection of the appropriate decomposition level by means of Shannon entropy. The entropy function was used to identify the resolution level that provides the most information about defects in real textures. For this purpose, the intensity levels of the subimages of the wavelet transform were considered as random samples. The concept of information entropy—Shannon entropy—describes how much randomness (or uncertainty) there is in a signal or an image; in other words, how much information is provided by the signal or image. In terms of physics, the greater the information entropy of the image is, the higher its quality will be [28].Figure5 shows how the texture pattern degrades as the decomposition level increases. This degradation is distributed among the different decomposition levels depending on the texture nature and can be quantified by means of the Shannon entropy.Approximation subimages(fLL(j)) of four wavelet decomposition levels for different images ((a) H225, (b) H34, (c) H241, (d) H137, and (e) H10) from portions of ship’s hulls.
(a)
(b)
(c)
(d)
(e)The Shannon entropy function [28, 29] is calculated according to the expression
(1)s(X)=-∑i=1Tp(xi)logp(xi),
where X={x1,x2,…,xT} is a set of random variables with T outcomes and p(xi) is the probability of occurrence associated with xi.For a 256-gray-level image of sizeNt pixels, we define a set of random variables X={x1,x2,…,xi,…,x256} as the number of pixels in the image that have gray level i. The probability of this random variable xi is calculated as the number of occurrences, hist[xi], divided by the total number of pixels, Nt(2)p(xi)=hist[xi]Nt.To calculate the value of the Shannon entropy on the approximation subimage (fLL(j)(x,y)) and on the horizontal, vertical and diagonal detail subimages (fLH(j)(x,y),fHL(j)(x,y), and fHH(j)(x,y)) in each decomposition level j, we obtain first the inverse wavelet transform of every subimage and then we apply (3)
(3)sLLj=s[W-1[fLL(j)(x,y)]],sLHj=s[W-1[fLH(j)(x,y)]],sHLj=s[W-1[fHL(j)(x,y)]],sHHj=s[W-1[fHH(j)(x,y)]].The normalized entropy of each subimage, for a decomposition levelj, has been calculated as
(4)Ssj=1Npixelsj∑x∑ysLLj(x,y),Shj=1Npixelsj∑x∑ysLHj(x,y),Svj=1Npixelsj∑x∑ysHLj(x,y),Sdj=1Npixelsj∑x∑ysHHj(x,y),
where Npixelsj is the number of pixels at each decomposition level j. Table 1 shows the values for Shannon entropy calculated for images of Figure 5.Table 1
Normalized entropies of four decomposition levels for textures of Figure5.
Decomposition level,j
S
s
j
S
h
j
S
v
j
S
d
j
H225
j
=
1
0.00011
0.00008
0.00007
0.00004
j
=
2
0.00048
0.00042
0.00042
0.00037
j
=
3
0.00200
0.00172
0.00168
0.00179
j
=
4
0.00796
0.00750
0.00681
0.00716
H34
j
=
1
0.00011
0.00007
0.00008
0.00006
j
=
2
0.00046
0.00038
0.00039
0.00038
j
=
3
0.00185
0.00179
0.00169
0.00186
j
=
4
0.00732
0.00750
0.00662
0.00698
H241
j
=
1
0.00011
0.00007
0.00007
0.00005
j
=
2
0.00046
0.00038
0.00037
0.00036
j
=
3
0.00194
0.00159
0.00151
0.00164
j
=
4
0.00763
0.00669
0.00640
0.00643
H137
j
=
1
0.00011
0.00007
0.00006
0.00004
j
=
2
0.00047
0.00028
0.00027
0.00031
j
=
3
0.00191
0.00127
0.00132
0.00118
j
=
4
0.00726
0.00593
0.00581
0.00524
H10
j
=
1
0.00013
0.00004
0.00004
0.00002
j
=
2
0.00057
0.00035
0.00037
0.00025
j
=
3
0.00214
0.00190
0.00182
0.00140
j
=
4
0.00841
0.00711
0.00737
0.00665Shannon entropy brings us information about the amount of texture pattern that remains after every decomposition level. Considering (2), entropy provides a measurement of the histogram distribution; the higher the entropy the greater the histogram uniformity; that is, a greater amount of texture pattern is contained in the image. As the decomposition level increases, the texture pattern is being removed; that is, the information content decreases; so the histogram distribution gains uniformity. An optimal reconstruction scheme would eliminate the texture pattern, without loss of defect information. To determine this optimal decomposition level we use a ratio Rj (see (5)) between the entropy of the approximation subimage and the sum of the entropies for all detail subimages, so Rj indicates how much information about the texture pattern is contained in decomposition level j. Variations in this ratio allow detecting changes in the amount of information about the texture pattern between two consecutive decomposition levels
(5)Rj=SsjSsj+Shj+Svj+Sdj,j=1,2,….The goal is to find the optimal decomposition level which provides the maximum variation among two consecutiveRj values because this indicates that, in decomposition level j, the texture pattern still present in level j-1 has been removed, keeping useful information (defects).For this purpose we defineADRj as the difference between two consecutive Rj values (see (6)). The optimal decomposition level  J* is calculated as the value of j for which ADRj takes a maximum value. This maximum value points out the greatest variation of information content among two consecutive decomposition levels, which means that both decomposition levels are sufficiently separated in terms of texture pattern information content, and the decomposition process should end. For decomposition levels j<J*,  ADRj indicates that significant texture pattern information still remains in the approximation subimage, and the decomposition process should continue. For decomposition levels j>J*; ADRj indicates that the approximation subimage is oversmoothed, and the reconstruction result from such smooth approximation subimage will cause defect loss
(6)ADRj={0j=1Rj-Rj-1j=2,…},J*=arg{maxj(|ADRj|)}.Table2 shows values for Rj coefficients at every image decomposition level (j) for the different textures shown in Figure 5, together with the ADRj values.Table 2
R
j, ADRj, and optimal decomposition level obtained for texture images of Figure 5.
Image
Level (j)
1
2
3
4
J
*
H225
R
j
0.3785
0.2812
0.2778
0.2704
2
ADR
j
0
0.0973
0.0035
0.0074
H34
R
j
0.3460
0.2852
0.2576
0.2575
2
ADR
j
0
0.0608
0.0276
0.0002
H241
R
j
0.3626
0.2931
0.2899
0.2811
2
ADR
j
0
0.0695
0.0032
0.0088
H137
R
j
0.388067
0.353254
0.336133
0.299523
4
ADR
j
0
0.034813
0.017121
0.036610
H10
R
j
0.545018
0.369480
0.294868
0.284585
2
ADR
j
0
0.175538
0.074612
0.010283Once the optimal decomposition level is obtained, the process ends with the production of the reconstructed image using (7)
(7)F(x,y)=W-1[fLL(j)(x,y)].


## 4.2. Smoothing Mask

To remove the noise running through the successive decomposition levels, we applied average-based smoothing over imageF(x,y) to obtain F′(x,y) as shown in (8)
(8)F′(x,y)=1k2∑i=0k-1∑j=0k-1F(x-⌊k2⌋+i,y-⌊k2⌋+j),
where k is the size of the smoothing mask (see Figure 6).Figure 6
Smoothing mask (k=3) for the wavelet coefficients.


## 5. Results

### 5.1. Algorithm Implementation

The proposed computer vision algorithm was implemented as shown in the Pseudocode1, using the C++ programming language. The mother wavelet used for decomposition was the Haar base function with two coefficients, applied up to a fourth decomposition level. A decomposition level higher than four produced the fusion between defects and background, thus reducing the probability of defect detection.Pseudocode 1:Pseudocode to implement the developed algorithm.
Step  1. Compute Shannon Entropy:SSj, Shj, Svj and Sdj
Step  2. ComputeRj=SSj/(SSj+Shj+Svj+Sdj) for j=1,2,3,…,J
Step  3. Compute optimal decomposition level:
J*=arg{maxj{ADRj}}, j=1,2,3,…,J
Step  4. ComputeF=W-1[fLL(J*)]
Step  5. ComputeF′=mk×k[F]
Step  6. BinarizeF′


### 5.2. Implementation of the Computer Vision System

The computer vision system for visual inspection of ship hull surfaces (Figure2) has been implemented on a Pentium computer with a Meteor II/1394 card. This card is connected to the microprocessor via a PCI bus and is used as a frame-grabber. For that purpose the card had a processing node based on the TMS320C80 DSP from Texas Instruments and the Matrox NOA ASIC. In addition, the card had a firewire input/output bus (IEEE 1394) which enables it to control a half-inch digital colour camera (15 fps, 1024 × 768 square pixel) equipped with a wide-angle lens (f 4,2 mm).The software development environment used to implement the system software modules was the Visual C++ programming language powered by the Matrox Imaging Library v9.0. The system also had a Siemens CP5611 card which acted as a PROFIBUS-DP interface for connection with the corresponding robotized blasting system. A Honeywell sensor was used to measure the distance to the ship by ultrasound, with a range of 200–2000 mm and an output of 4–20 mA. User access to the computer vision system was by means of an industrial PDS (Mobic T8 from Siemens) and a wireless access point. Among other functions, the software that has been developed allows the operator to (1) enter the system configuration parameters, (2) visualize the detected areas to blast for validation by the operator before blasting commences, and (3) calibrate the computer vision system.


### 5.3. Validation Environment

The proposed computer vision algorithm was assessed at the NAVANTIA shipyard in Ferrol (Spain) on a robotized system used for automatic spot blasting. This operation accounts for 70% of all cleaning work carried out at that shipyard. The robotized system (Figure7) consists of a mechanical structure divided into two parts: primary and secondary. The primary structure holds the secondary structure (XYZ table), which supports the cleaning head and the computer vision system. More information regarding this system can be found in [5].Figure 7
Robotized blasting system.With the help of this platform, 260 images of ship hulls’ surfaces (with and without defects) were taken, similar to those shown in Figure3. In this way a catalogue was compiled of typical surface defects as they appear before grit blasting.


### 5.4. Metrics

To conduct a quantitative analysis of the quality of the proposed segmentation method, we need to use the best suited metrics to that purpose. The performance of image segmentation methods has been assessed by such authors as Zhang [30] and  Sezgin and Sankur [16]. They proposed various different metrics for measurement of the quality of the segmentation in a given method, using parameters like position of the pixels, area, edges, and so forth. Out of these, one of the quantitative appraisal methods proposed by Sezgin was selected and examined: Misclassification Error (ME).ME represents the percentage of the background pixels that are incorrectly allocated to the object (i.e., to the foreground) or vice versa(9)ME=1-|BP∩BT|+|OP∩OT||BP|+|OP|.The error can be calculated by means of (9), where BP (background pattern) and OP (object pattern) represent the pattern image of the background and of the object taken as reference, and BT (background test) and OT (object test) represent the image to be assessed. In the event that the test image coincides with the pattern image, the classification error will be zero and therefore the performance of the segmentation will be the maximum.The performance of the implemented algorithms is assessed according to the equation:(10)η=100·(1-ME).


### 5.5. Algorithm Appraisal

The proposed visual inspection algorithm (see Pseudocode1) was applied to the above mentioned catalogue that had been taken at the shipyard (some samples are shown in column (a) of Figure 8). The Shannon entropy was calculated and normalized for four wavelet decomposition levels and the optimal J* level was calculated (6). Images were also processed applying algorithms proposed by Han and Shi [10] and Tsai and Chiang [19]. The result was 3 sets of 260 reconstructed images in which the defects have been isolated from texture. To check the quality of the defect detection algorithms we have concluded with a binarization stage. For that purpose we have selected Kapur’s method [21] which belongs to the group of entropy-based methods, as classified by Sezgin and Sankur [16] in his review of thresholding methods; this has resulted in 3 sets of 260 images (column (b) of Figure 8 shows some results obtained with the proposed algorithm; column (c) of Figure 8 shows some results obtained with the Tsai algorithm and column (d) of Figure 8 shows some results obtained with Han algorithm).Columns: column (i) shows texture images of portions of hulls; column (ii) shows reconstructed images resulting from the proposed reconstruction scheme; column (iii) shows reconstructed images resulting from Tsai algorithm; column (iv) shows reconstructed images resulting from Han algorithm; column (v) shows defects segmented by hand, the “ground truth.” Image Rows: (a) H225, (b) H34, (c) H241, (d) H1, (e) H120, (f) H121, (g) H99, (h) H137, (i) H48, (j) H9, (k) H10, and (l) H11.
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)
(k)
(l)To apply the metrics described above, human inspectors were needed to segment each of the catalogue images manually (samples of these are shown in column (v) of Figure8). Table 3 shows the performance (η) when sample texture images of Figure 8 were segmented using the three algorithms.Table 3
η in defect segmentation of texture images of Figure 8.
Entropy based
J
*
Tsai
J
*
Han
J
*
Defect samples
H225
97.09
2
94.51
4
2.14
4
H34
97.41
2
74.52
2
3.43
4
H241
96.04
2
95.17
4
97.41
2
H1
86.50
3
82.63
4
84.69
4
H20
91.40
3
89.22
4
90.08
4
H121
89.36
4
89.91
4
90.23
4
H99
89.30
4
73.76
4
91.46
3
H137
93.94
4
82.87
4
94.26
3
H48
93.06
4
93.97
4
64.23
4
Average on defect samples
92.68
3.11
86.28
3.78
68.66
3.56
Nondefect samples
H9
98.30
2
74.04
3
99.61
4
H10
98.33
2
80.85
4
48.05
4
H11
98.22
2
89.06
4
48.65
4
Average on nondefect samples
98.28
2.00
81.32
3.67
65.44
4.00
Total Average
95.48
2.56
83.80
3.72
67.05
3.78As can be observed from above results, the proposed entropy-based algorithm achieved better results than Tsai algorithm and significantly better results than Han algorithm. In both cases the proposed algorithm obtains higher performance with low decomposition level.We have also analysed the behaviour of the proposed algorithm as misclassification rates. A set of 120 images were processed by the proposed algorithm and also by Han and Tsai algorithms. Results were then analysed by a skilled blasting operator, who assessed what portions of the shown hull surface would be blasted in real conditions at the repair yard. Table4 shows the average number of defect points classified as Type I and Type II errors for 120 samples of the 260-image set indicated above.Table 4
Automated inspection examined by a skilled blasting operator.
Entropy-basedalgorithm
Hanalgorithm
Tsaialgorithm
Type I error
6.8%
9.2%
11.1%
Type II error
0.9%
1.1%
0.7%As we can see, the proposed algorithm produced better results as regards false positives—that is, points marked as defective when they are not (Type I error). This is essentially because the operator tends to blast larger areas than necessary, and moreover he is less able to control the cut-off of the grit jet. On the other hand, the proposed algorithm identified similar false negatives (Type II error). This difference was not very significant and is quite acceptable in view of the clear advantage offered by the computer vision system equipped with the proposed inspection algorithm as regards Type I errors.


## 5.1. Algorithm Implementation

The proposed computer vision algorithm was implemented as shown in the Pseudocode1, using the C++ programming language. The mother wavelet used for decomposition was the Haar base function with two coefficients, applied up to a fourth decomposition level. A decomposition level higher than four produced the fusion between defects and background, thus reducing the probability of defect detection.Pseudocode 1:Pseudocode to implement the developed algorithm.
Step  1. Compute Shannon Entropy:SSj, Shj, Svj and Sdj
Step  2. ComputeRj=SSj/(SSj+Shj+Svj+Sdj) for j=1,2,3,…,J
Step  3. Compute optimal decomposition level:
J*=arg{maxj{ADRj}}, j=1,2,3,…,J
Step  4. ComputeF=W-1[fLL(J*)]
Step  5. ComputeF′=mk×k[F]
Step  6. BinarizeF′


## 5.2. Implementation of the Computer Vision System

The computer vision system for visual inspection of ship hull surfaces (Figure2) has been implemented on a Pentium computer with a Meteor II/1394 card. This card is connected to the microprocessor via a PCI bus and is used as a frame-grabber. For that purpose the card had a processing node based on the TMS320C80 DSP from Texas Instruments and the Matrox NOA ASIC. In addition, the card had a firewire input/output bus (IEEE 1394) which enables it to control a half-inch digital colour camera (15 fps, 1024 × 768 square pixel) equipped with a wide-angle lens (f 4,2 mm).The software development environment used to implement the system software modules was the Visual C++ programming language powered by the Matrox Imaging Library v9.0. The system also had a Siemens CP5611 card which acted as a PROFIBUS-DP interface for connection with the corresponding robotized blasting system. A Honeywell sensor was used to measure the distance to the ship by ultrasound, with a range of 200–2000 mm and an output of 4–20 mA. User access to the computer vision system was by means of an industrial PDS (Mobic T8 from Siemens) and a wireless access point. Among other functions, the software that has been developed allows the operator to (1) enter the system configuration parameters, (2) visualize the detected areas to blast for validation by the operator before blasting commences, and (3) calibrate the computer vision system.


## 5.3. Validation Environment

The proposed computer vision algorithm was assessed at the NAVANTIA shipyard in Ferrol (Spain) on a robotized system used for automatic spot blasting. This operation accounts for 70% of all cleaning work carried out at that shipyard. The robotized system (Figure7) consists of a mechanical structure divided into two parts: primary and secondary. The primary structure holds the secondary structure (XYZ table), which supports the cleaning head and the computer vision system. More information regarding this system can be found in [5].Figure 7
Robotized blasting system.With the help of this platform, 260 images of ship hulls’ surfaces (with and without defects) were taken, similar to those shown in Figure3. In this way a catalogue was compiled of typical surface defects as they appear before grit blasting.


## 5.4. Metrics

To conduct a quantitative analysis of the quality of the proposed segmentation method, we need to use the best suited metrics to that purpose. The performance of image segmentation methods has been assessed by such authors as Zhang [30] and  Sezgin and Sankur [16]. They proposed various different metrics for measurement of the quality of the segmentation in a given method, using parameters like position of the pixels, area, edges, and so forth. Out of these, one of the quantitative appraisal methods proposed by Sezgin was selected and examined: Misclassification Error (ME).ME represents the percentage of the background pixels that are incorrectly allocated to the object (i.e., to the foreground) or vice versa(9)ME=1-|BP∩BT|+|OP∩OT||BP|+|OP|.The error can be calculated by means of (9), where BP (background pattern) and OP (object pattern) represent the pattern image of the background and of the object taken as reference, and BT (background test) and OT (object test) represent the image to be assessed. In the event that the test image coincides with the pattern image, the classification error will be zero and therefore the performance of the segmentation will be the maximum.The performance of the implemented algorithms is assessed according to the equation:(10)η=100·(1-ME).


## 5.5. Algorithm Appraisal

The proposed visual inspection algorithm (see Pseudocode1) was applied to the above mentioned catalogue that had been taken at the shipyard (some samples are shown in column (a) of Figure 8). The Shannon entropy was calculated and normalized for four wavelet decomposition levels and the optimal J* level was calculated (6). Images were also processed applying algorithms proposed by Han and Shi [10] and Tsai and Chiang [19]. The result was 3 sets of 260 reconstructed images in which the defects have been isolated from texture. To check the quality of the defect detection algorithms we have concluded with a binarization stage. For that purpose we have selected Kapur’s method [21] which belongs to the group of entropy-based methods, as classified by Sezgin and Sankur [16] in his review of thresholding methods; this has resulted in 3 sets of 260 images (column (b) of Figure 8 shows some results obtained with the proposed algorithm; column (c) of Figure 8 shows some results obtained with the Tsai algorithm and column (d) of Figure 8 shows some results obtained with Han algorithm).Columns: column (i) shows texture images of portions of hulls; column (ii) shows reconstructed images resulting from the proposed reconstruction scheme; column (iii) shows reconstructed images resulting from Tsai algorithm; column (iv) shows reconstructed images resulting from Han algorithm; column (v) shows defects segmented by hand, the “ground truth.” Image Rows: (a) H225, (b) H34, (c) H241, (d) H1, (e) H120, (f) H121, (g) H99, (h) H137, (i) H48, (j) H9, (k) H10, and (l) H11.
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)
(k)
(l)To apply the metrics described above, human inspectors were needed to segment each of the catalogue images manually (samples of these are shown in column (v) of Figure8). Table 3 shows the performance (η) when sample texture images of Figure 8 were segmented using the three algorithms.Table 3
η in defect segmentation of texture images of Figure 8.
Entropy based
J
*
Tsai
J
*
Han
J
*
Defect samples
H225
97.09
2
94.51
4
2.14
4
H34
97.41
2
74.52
2
3.43
4
H241
96.04
2
95.17
4
97.41
2
H1
86.50
3
82.63
4
84.69
4
H20
91.40
3
89.22
4
90.08
4
H121
89.36
4
89.91
4
90.23
4
H99
89.30
4
73.76
4
91.46
3
H137
93.94
4
82.87
4
94.26
3
H48
93.06
4
93.97
4
64.23
4
Average on defect samples
92.68
3.11
86.28
3.78
68.66
3.56
Nondefect samples
H9
98.30
2
74.04
3
99.61
4
H10
98.33
2
80.85
4
48.05
4
H11
98.22
2
89.06
4
48.65
4
Average on nondefect samples
98.28
2.00
81.32
3.67
65.44
4.00
Total Average
95.48
2.56
83.80
3.72
67.05
3.78As can be observed from above results, the proposed entropy-based algorithm achieved better results than Tsai algorithm and significantly better results than Han algorithm. In both cases the proposed algorithm obtains higher performance with low decomposition level.We have also analysed the behaviour of the proposed algorithm as misclassification rates. A set of 120 images were processed by the proposed algorithm and also by Han and Tsai algorithms. Results were then analysed by a skilled blasting operator, who assessed what portions of the shown hull surface would be blasted in real conditions at the repair yard. Table4 shows the average number of defect points classified as Type I and Type II errors for 120 samples of the 260-image set indicated above.Table 4
Automated inspection examined by a skilled blasting operator.
Entropy-basedalgorithm
Hanalgorithm
Tsaialgorithm
Type I error
6.8%
9.2%
11.1%
Type II error
0.9%
1.1%
0.7%As we can see, the proposed algorithm produced better results as regards false positives—that is, points marked as defective when they are not (Type I error). This is essentially because the operator tends to blast larger areas than necessary, and moreover he is less able to control the cut-off of the grit jet. On the other hand, the proposed algorithm identified similar false negatives (Type II error). This difference was not very significant and is quite acceptable in view of the clear advantage offered by the computer vision system equipped with the proposed inspection algorithm as regards Type I errors.


## 6. Conclusions

This paper has presented a computer vision algorithm based on the wavelet transform which brings a robust method for detecting defects in ship hull surfaces. To achieve this, we used an image reconstruction approach based on automatic selection of the optimal wavelet transform resolution level by means of a novel use of the Shannon entropy, calculated on the different detail subimages.The algorithm has been incorporated to a computer vision system that masters a robotized system for blasting ship hulls, making it possible to fully automate grit blasting operation. The results as regards reliability were very similar to those achieved with human workers, while faster inspection was provided (among 8% for flat surfaces in oil tankers and 15% for shaped hulls like frigates) and the consequences of operator fatigue minimized.



---

*Source: 101837-2013-05-27.xml*