Abstract

In this paper, an image enhancement algorithm is presented for identification of corrosion areas and dealing with low contrast present in shadow areas of an image. This algorithm uses histogram equalization processing under the hue-saturation-intensity model. First of all, an etched image is transformed from red-green-blue color space to hue-saturation-intensity color space, and only the luminance component is enhanced. Then, part of the enhanced image is combined with the original tone component, followed by saturation and conversion to red-green-blue color space to obtain the enhanced corrosion image. Experimental results show that the proposed method significantly improves overall brightness, increases contrast details in shadow areas, and strengthens identification of corrosion areas in the image.

1. Introduction

In several applications, equipment made up of metallic material is widely used. Under the influence of the external environment, the metallic material will be corroded, causing the appearance of several features on the surface of the corrosion area, such as morphology, texture, grayscale, and color. The degree and type of corrosion in the material can be identified by analyzing these features. During visual inspection process, it is difficult to control the influence of the external environment, e.g. [1], light source, distance, and angle [2]. And, therefore, the quality of the corrosion image will be limited to a certain extent especially the corrosion picture inside the metal [3]. For subsequent detection and recognition of corrosion morphology, it is important to enhance this image [4].

At present, image enhancement algorithms mainly include single-scale Retinex (SSR) and multiscale Retinex (MSR) enhancement methods, which are based on the color sense consistency model [57], direct enhancement method aiming at pixel grayscale [8, 9], homomorphic filtering enhancement method [10, 11], enhancement method of defogging with respect to the dark channel priori theory [12, 13], image enhancement algorithm based on wavelet transform, and histogram equalization algorithm [14, 15]. Each of the above methods has its own advantages and can be used in relevant application scenarios.

The Retinex enhancement algorithm is put forward by Ma et al. [1618]. This method can maintain brightness and details in an image and provide better enhancement for the gray area in the image [19]. Moreover, this method can effectively alleviate the halo phenomenon generated due to color restoration. However, the method is susceptible to color distortion, and the color of the image is different from the original color [20]. Color distortion also occurs when the method of direct processing of pixel values proposed by Mao et al. is used [12]. Although this method improves the dynamic range of image brightness, enhances the low-illumination image to some extent, and deals with Retinex halo artifact. The homomorphic filtering color image enhancement algorithm can improve the image brightness, but it does not deal with metal corrosion images. The dark channel defogging enhancement algorithm put forward by Wang et al. can enhance haze images [17], but it is only limited to images based on the dark channel principle [21]. Xu et al. used wavelet transform for image enhancement [18], and the results show that the wavelet transform can indeed enhance images. However, the image enhancement by this method is not significant. Hao et al. [22] address the problems in Retinex-based methods, such as less-effective image decomposition or strong imaging noise; it requires to carefully model the priori by a regularization term and usually makes the optimization process complicated. So the authors address these issues by proposing a novel Retinex-based low-light image enhancement method, in which the Retinex image decomposition is achieved in an efficient semidecoupled way. The experimental results show that the method has both higher visibility and better visual quality, which outperforms the state-of-the-art low light enhancement methods in terms of several objective and subjective evaluation metrics. Wang et al. [23] proposed a colored image correction method based on nonlinear functional transformation according to the illumination-reflection model and multiscale theory. Compared with the classic algorithm, the proposed algorithm can improve the adaptability of image enhancement in images with low illumination and other issues. Overall brightness and contrast of an image while reducing the impact of uneven illumination. The enhanced images appear clear, bright, and natural.

Image processing using a histogram equalization algorithm improves the contrast. However, when there are black parts in an image, enhancing the image will result in the loss of image features [19]. Hou and Liu proposed a metal corrosion image enhancement algorithm called dark details enhancement algorithm [9]. In this algorithm, by enhancing the “I” component in the HSI model, the overall brightness of the image and the recognition degree of the corrosion area can be enhanced. However, the enhancement effect on the hue and saturation of the image is not obvious, and the recognition degree of the corrosion area of the image is not evident.

To deal with the problems of the existing algorithms, this paper proposes a new algorithm that combines histogram equalization and dark detail algorithms. These algorithms are chosen as they are known to have good image enhancement performance. Taking advantage of these algorithms and to minimize the image distortion as much as possible, we aim to maximize the information present in an image. The proposed image enhancement algorithm for metal corrosion areas is based on the HSI model [24].

The quality of the corrosion image will be limited by the external environmental factors present in an imaging channel. The purpose of this article is to solve this problem.

The main contributions and novelty of this paper are as follows:(1)Aiming at the defects of the metal corrosion image, in order to effectively separate the features and background in the image, the novelty of this paper is to use the histogram equalization to process the metal corrosion image. The experiment shows that the effect is significant.(2)In this paper, wavelet transform and homomorphic filtering are combined to make the image have a uniform light background and lower distortion rate. At the same time, the combination of them makes the histogram equalization image enhancement better. Finally, a variety of algorithms are compared.(3)This paper uses histogram equalization and dark detail algorithms to increase the amount of information contained in the image while maintaining a low degree of distortion. The novelty lies in the optimization and adjustment of some parameters in the algorithm in order to better integrate these algorithms.

The details of the algorithm proposed in this paper are as follows: firstly, the original corrosion image is converted from RGB color space to HSI color space, and the brightness component is extracted for enhancement. Secondly, the image is enhanced using histogram equalization and dark detail enhancement algorithms. Finally, the enhanced brightness component is restored to RGB color space together with the original saturation and hue components to obtain the enhanced corrosion image. Experimental results show that the enhanced image obtained using this algorithm greatly improves the recognition of corrosion area in the image and facilitates further analysis of corrosion and subsequent damage in metallic materials [25].

This paper is organized as follows: in Section 2, the theory behind this algorithm is elaborated, and the principles and implementation of the algorithm are described. Section 3 presents an analysis of the results obtained in the specific experimental environment. Section 4 concludes this paper [26].

In this paper, the HSI model is selected to extract the brightness component of the metal corrosion image. Subsequently, the brightness component is enhanced to improve image identification, which makes it easier to identify the corrosion area of metal. The dark detail enhancement algorithm proposed by Zhao and Sun and histogram equalization algorithm are combined to enhance the image. The best image output is chosen based on the image information entropy [27, 28].

Figure 1 shows the flowchart of the proposed algorithm: the original corrosion image is converted from RGB color space to the HSI color model, followed by the application of histogram equalization and dark detail enhancement method to the component “I.” The enhanced image is obtained by combining the enhanced “I” component with the original “H” and “S” components [6] and subsequent conversion to the RGB color space. The whole process is implemented using Matlab.

2.1. The HSI Model

The HSI model has three components, H, S, and I, which are used to describe the color characteristics. These components represent hue, saturation, and intensity or brightness, respectively. This model reflects the basic attributes of human perception of color. Therefore, the HSI model has been widely used in the image representation and processing system of the human visual perception system. In the HSI model, the color is only related to the “H” and “S” components [26]. Compared with the RGB model, in the HSI model, the correlation degree of each component is relatively small [29]. Thanks to this feature, good color image enhancement can be achieved, albeit with a few distortions [30]. This paper considers the conversion of HSI and RGB and proposes an improved algorithm based on histogram equalization.

The formulas for converting the RGB model into HSI model are given by equations (1)–(4) as follows [31]:

In this paper, only the brightness component is enhanced, and after enhancement, it is combined with the original saturation and tonal components.

The formulas for converting the HSI model into RGB model are given by equations (5)–(7) as follows [32]:

2.2. Histogram Equalization

Histogram equalization also known as histogram flattening is a nonlinear stretching of images and redistribution of image pixel values such that the number of pixel values in a certain gray range is roughly the same [26]. The image histogram is relatively flat by enhancing the contrast of the peak portion and reducing the contrast of the valley portions on both sides. In other words, the basic idea behind histogram equalization is that each gray level appears with the same frequency so that the probability of each gray level is evenly distributed, leading to a flat histogram. The image also becomes clear [7].

The theoretical formula of histogram equalization is as follows [25]:(1)Count the number of pixels in each gray level of the original input image. This number corresponding to the gray level is given by , where , and is the total number of gray levels.(2)Calculate the histogram of the original image, which is the probability density of each grayscale, given by () = /n, where is the total number of pixels in the original image.(3)Calculate the cumulative distribution function as follows: .(4)Calculate the final output grayscale  = INT [( − ) () +  + 0.5]/(L − 1), and which is an integer operator. Let  = 0 and  = L-1, this equation can be simplified into  = INT [(L − 1) () +  + 0.5]/((L − 1) × ).(5)According to the mapping relation between , i.e., the grayscale function of the original image and , modify the original grayscale to obtain an output image, whose histogram is approximately evenly distributed.

Figures 2(a) and 2(b) show the effect of histogram equalization on an image. It can be observed in Figures 2(c) and 2(d) that, after histogram equalization, the number of pixels is spread over all the range of gray levels, the image contrast is significantly improved, and the details in the image can be clearly seen.

2.3. Wavelet Adaptive Adjustment
2.3.1. Introduction to Wavelet Adaptive Adjustment

As shown in the example given in the previous subsection, histogram equalization enhances the whole image. However, a corrosion image with different scales and corrosion details cannot be effectively enhanced using only the equalization. Wavelet transforms with good localization properties in both the time spatial domain and frequency domain can be used for multiresolution analysis of signals. This paper uses this transform to make differential improvements to the image enhanced using the histogram equalization and modify the image background with different contrast scales.

The flow of the wavelet adaptive adjustment algorithm is given in Figure 3. Firstly, the two-dimensional discrete wavelet transform is used to decompose the enhanced image obtained after histogram equalization, referred to as enhanced Figure 1. Secondly, nonlinear filtering operation is applied to the decomposed image group to obtain a filtered image group. Based on this image group, the weighting factor is calculated. Lastly, the image group is recombined based on , resulting in an enhanced image referred to as enhanced Figure 2.

2.3.2. Two-Dimensional Discrete Wavelet Decomposition

In the process shown in Figure 3, two-dimensional discrete wavelets based on Matlab’s fast decomposition algorithm [33] are used to decompose enhanced Figure 1. The wavelet decomposition series cannot be too large, as a large series leads to a higher computational complexity. Moreover, the illumination distribution characteristics cannot be fully reflected by the low-frequency wavelet coefficients, and as a result, the inhomogeneity of illumination cannot be effectively eliminated. However, if a small decomposition level is used, too much detailed information is included in the low-frequency component, which results in a loss of image details. Therefore, enhancement of the image details can be effectively carried out by choosing a decomposition level that keeps the computational complexity low, but at the same time enhances the image details.

In this paper, the image is decomposed into two levels to meet the above requirements. In the proposed algorithm, wavelet adaptive adjustment is only a supplementary step, and under other conditions, the number of decomposition stages can be different, such as three or four. The relevant expression for carrying out the decomposition is shown in the following equation:

The resulting image function , {} gives a multiresolution analysis of the etched image. The first term on the right side of equation (8) is the low-band image, and the second term is the subimage with different frequency bands. The two-dimensional wavelet functions and scale functions are given by (x, y) and (x, y), respectively, is the low-frequency coefficient, and is the high-frequency coefficient. The subscript j represents the image level. Taking the algorithm in this paper as an example, the possible values of j are one and two. Figure 4 shows a schematic diagram of secondary decomposition wavelet image, where , , , and are four subregions based on level 1 image decomposition, and , , , and are secondary subregions based on level 2 decomposition of .

2.3.3. Nonlinear Filtering

The nonlinear filtering operation is performed on the decomposed image group obtained in the previous group. The purpose of this operation is to correct the differences between contrast levels in the image background and to prepare for calculations in the next step. The operation modifies the brightness of each pixel in the decomposed image group. The modified value is the difference between maximum and minimum values in the neighborhood of each pixel point divided by the difference between the maximum and minimum values in the overall image. The relevant formula for this filtering operation is shown in the following equation:

In the above equation, and are the maximum and minimum values in the overall image, respectively, and and are the maximum and minimum values in the neighborhood around the filtering center point Q.

2.3.4. Global Contrast Weighting Factor

In order to obtain the global contrast weighting factor , the global contrast of the level needs to be calculated first. It is calculated according to the following equation, where is the pixel sum of the filtered output image at the level, and is the adjustment coefficient, which is generally equal to one.

Using the above equation, the global contrast-weighting factor of the j-level is calculated as follows:

2.3.5. Image Reconstruction

Image reconstruction is performed according to the global contrast weighting factor and luminance coefficient using the formula shown in equation (12). The coefficient is determined by the overall brightness of the image, and it is fixed as one. Generally, as the reconstruction starts from the lowest level, the algorithm uses the second-level reconstruction first, followed by the first-level reconstruction [32].

2.4. Block DCT (Discrete Cosine Transform) Homomorphic Filtering

Since the captured image is affected by uneven illumination, a few parts of the image may have insufficient local brightness, causing the previously enhanced details to be submerged in the dark background.

Using the illumination reflection model and the enhanced Figure 2, can be characterized by two features: the total amount of light source, which is incident on the observed scene and the total amount of reflected light from the object in the scene. The incident light is relatively uniform and shows minor spatial variations, mainly in the low-frequency band. However, due to different natural and structural characteristics of an object, the reflected light shows the significant spatial variation in intensity, which is mainly reflected in the high-frequency band. Therefore, to reduce the influence of uneven illumination, it is necessary to reduce the incident light and increase the reflection light.

The homomorphic filtering algorithm consists of first taking the logarithm of the image obtained from the previous step and separating the incident and reflected light components. Fast Fourier transform (FFT) is applied to transform an image from the spatial domain into the frequency domain. Next, the appropriate homomorphic filtering function is selected to filter the image, and the filtered image is converted from the frequency domain to the spatial domain using inverse fast Fourier transform (IFFT). Then, the enhanced luminance component image is obtained after taking the index. Finally, the enhanced luminance component image is obtained after taking the index, which eliminates the blocking effect caused by insufficient brightness and gives the final processed image.

3. Experimental Results and Analysis

3.1. Experimental Environment

This paper proposes an image enhancement algorithm for observation of metal corrosion areas. The algorithm is mainly applied for image enhancement after pipeline image acquisition, and it is useful for detection and identification of subsequent corrosion morphology. Therefore, in order to verify the enhancement effect of the algorithm on the metal pipe image, images of a metal pipe corroded due to exposure to natural environment are selected. The photos of the metal pipes are given in Figure 5, where the corrosion can be observed.

3.2. Experimental Procedure

Three corrosion images with different corrosion patterns, uneven brightness, and low contrast in the corrosion areas are used for testing the performance of the proposed algorithm. These images are shown in Figure 6. The pipeline corrosion images shown in Figure 6 are enhanced by dark detail enhancement algorithm, defogging algorithm, homomorphic filtering, histogram equalization, and the algorithm proposed in this paper. The Matlab software is used for plotting the histogram of the enhanced images. The information entropy values of these images are also calculated and compared.

3.3. Experimental Results

The gray histograms of the three corrosion images enhanced by the dark detail enhancement algorithm, the defogging algorithm, the homomorphic filtering, the histogram equalization, and the proposed algorithm are shown in Figures 79.

Table 1 gives the information entropy of the original images and the images enhanced using different enhancement algorithms shown in Figure 6. Table 2 is the mean and variance of the information entropy of an image set consisting of 20 corrosion images and the image set enhanced using different algorithms. Entropy is an important indicator to measure the amount of information present in an image. A large entropy value indicates the presence of a higher amount of information in an image, which means a better image quality.

Firstly, it can be observed from the original corrosion images shown in Figures 79 that their overall brightness tends to be low, due to which some details in parts of the images cannot be recognized and distinguished from the background. Therefore, the corrosion degree detection of the tested area is directly affected due to low brightness. Figures 9(c) and 9(d) are the results after enhancement by the defogging algorithm and the homomorphic filtering. Although the information entropy values calculated after the use of these algorithms indicate improved image quality, some distortions occur.

The data of Tables 1 and 2 show that all algorithms increase the information entropy of the image to different extents. According to the data, the proposed algorithm and the histogram equalization algorithm achieve the highest increase in the entropy values. By using the latter algorithm, the information entropy values of corrosion Figure 1 and corrosion Figure 3 are the highest among all the algorithms. However, it can be seen from Figures 79 that, after histogram equalization, the dark portions in the original images are enlarged, and consequently, they engulf the image details. The brightness of the images enhanced by the proposed algorithm is obviously improved, which can be seen from the gray histograms of the images. The enhanced images further show significant image improvement offered by the proposed algorithm. From the data in Table 2, it can be observed that the proposed algorithm obtains the highest mean entropy value and the lowest entropy variance. Tables 3 and 4 show the evaluation criteria of each method applied to the image. The average value reflects the brightness of the image. The larger the average value, the greater the image brightness and vice versa. The standard deviation reflects the degree of dispersion between the image pixel value and the average value. The larger the standard deviation, the better the image quality. Based on the images, histograms, and quantitative evaluation shown in this section, it can be concluded that the proposed algorithm has superior and consistent performance.

4. Conclusion

In this paper, an algorithm for enhancing metal corrosion images was proposed. The proposed algorithm used histogram equalization combined with dark detail enhancement algorithm, which resulted in enhanced metal corrosion image, and improved image quality and recognition degree. The algorithm makes it easier to observe the metal corrosion area and reduces the difficulty in carrying out research on metal products affected by corrosion, which can be important in practical applications. As the proposed algorithm combined two algorithms, the resulting computational complexity was high. Furthermore, image information entropy was the only metric used for selecting and evaluating the images, which can be simplistic for practical applications. Therefore, the next step of our work is to select a set of image quality evaluation metrics to evaluate the algorithm performance in an all-round way and establish a direction for the optimization of the algorithm. At the same time, the logic and structure of the algorithm should be optimized to improve its real-time performance.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

This work was supported in part by the National Natural Science Foundation of China under Grant nos. 62073090 and 61473331, the Natural Science Foundation of Guangdong Province of China under Grant no. 2019A1515010700, the Key (Natural) Project of Guangdong Provincial under Grant nos. 2019KZDXM020, 2019KZDZX1004, and 2019KZDZX1042, the Introduction of Talents Project of Guangdong Polytechnic Normal University of China under Grant nos. 991512203 and 991560236, Guangdong Climbing Project no. pdjh2020b0345, Special Projects in Key Areas of Ordinary Colleges and Universities in Guangdong Province no. 2020ZDZX2014, Intelligent Agricultural Engineering Technology Research Center of Guangdong University Grant no. 2020ZDZX2014, and Guangzhou Key Laboratory of Intelligent Building Equipment Information Integration and Control.