## 3 Image Processing
### Defect Image  
#### 3.1.1 Transformation and Filtering  
A balanced MFL array signal was acquired after preprocessing. This data could be transferred to a two-dimensional gray image, with a mapping function as follows:  
\[f(i,j)=L\cdot(\frac{f(x,y)}{N}\cdot\frac{V_{s}}{V_{p}}+0.5) \tag{3}\]  
where \(L\) is the maximum gray value after transformation, \(f(x,y)\) is the array input, \(N\) is the minimum quantification value of ADC, \(V_{s}\) is the maximum sampling voltage, \(V_{p}\) is the maximum peak-to-peak voltage of amplifier, and \(f(i,j)\) is the output gray image.  
Limiting sensor size, system axial frequency is much more than circumferential. In real sampling conditions, the voltage of axial neighboring domain does not vary obviously; the most variety was from quantization errors. Besides, the device would lightly swing then acquire circumferential MFL information in neighboring detection. Thus, the dense axial sampling contained much circumferential MFL information, and we could use this high-frequency sampling to forecast circumferential distribution through equal two-dimensional sampling. In this paper, axial sampling frequency was about nine times as much as that of circumferential sampling, thus the axial was down-sampled nine times to fit the circumferential sampling. We can obtain nine frames of MFL images of wire rope. We adopted Equation (4) to prove that the down sampling interval does not cause signal distortion.  
According to signal decimation, a discrete signal \(x(n)\), assuming a down-sampling signal of \(y(n)=x(Mn)\), if their frequencies are in accord with \(f_{s}\geq 2 Mf_{c}\), where \(f_{s}\) is discrete sampling frequency and \(M\) is down-sampling interval, the DTFT of signal \(y(n)\) and \(x(n)\) is satisfied as follows:  
\[Y(e^{jw})=\frac{1}{M}\sum_{k=0}^{M-1}X(e^{i(w-2\pi k)/M}) \tag{4}\]  
According to Equation (4), the spectrum of down-sampling signal was extended \(M\) times, then shifted \(2\pi k/M\) (\(k=1,2,\)..., \(M\)-1) and superposed together; moreover, the amplitude was reduced nine times but \(y(n)\) was equivalent to \(x(n)\). Figure 9a shows a balanced signal block from the testing results above, and Figure 9b shows the spectrums of balanced and down-sampling signals, where frequency of peak value conformed to a nine-time relationship and there was no frequency aliasing. Thus, the nine-times down-sampling signal was equivalent to raw signal and there was no signal distortion.  
These new images combined noise, such as pulse noise, strand waves, and converted noise. A mean filter mask was applied to restrain the noise. Then, utilizing a second-order derivative mask to sharpen images, we get:  
\[W=[0,1,0;1,-4,1;0,1,0] \tag{5}\]  
The down-sampling image is shown in the top section of Figure 10, and the middle one was filtered and sharpened. Canny edge detector was applied to get the locations of defects, and to avoid the influence of weak region, we performed an expand and corrosion operation where structure elements were separately a \(3\times 3\) mask and \(3\times 1\) mask. Defect regions after this process are shown in the bottom section of Figure 10. The contrast of all pictures was enhanced for defect visualization.  
Figure 9: (**a**) A defect balanced signal block of one channel; (**b**) spectrums of primary sampling and down-sampling.