Texture Detection of Aluminum Foil Based on Top-Hat Transformation and Connected Region Segmentation

. A new method of texture detection for aluminum foil based on digital image processing technology is proposed. Top-hat transformation and image segmentation technology based on the connected domain are used to change the method of determining texture fraction by using human experience. Compared with the brightness method, pit detection method, and EBSD technology, this method can complete quantitative detection eﬃciently, automatically, and accurately, and reduce the detection time and manpower. It eliminates the instability of manual detection and ensures the accuracy of detection. By this method, the error of test results can be controlled within 1.6%, which is much better than 7.3% of the brightness method and 4% of the pitting method. It provides more accurate test results for the production process control of aluminum foil.


Introduction
Aluminum electrolytic capacitors are widely used in various types of products, including electronic products, electrical and mechanical products, home appliances, and other products.e advantages of aluminum electrolytic capacitors are light weight and low price.With the advent of the information age, the development of all walks of life brings new opportunities and challenges for capacitors.Smaller size, larger capacity, lower cost, higher frequency, and lower impedance are the trend of development.As the key material of aluminum electrolytic capacitors, cube texture volume fraction of the electrolytic capacitor aluminum foil has a great influence on its electrical properties.So it needs enough strong cube texture [1][2][3][4][5][6].In order to meet the needs of electronic aluminum foil production, it is necessary to adjust and control the product process better, to increase the {100} cube texture proportion of the electronic aluminum foil [7,8].
As the convenient methods, the bright crystal method, etch pit method, and EBSD technology are widely used in the measurement of recrystallized cube texture of a high-voltage electronic aluminum foil.e etch pit method has a small field of sampling detection.
e selection of multiple sampling regions is easily influenced by manual operation.e detection results are large randomness and poor representativeness.In many cases, the sampling results greatly differ from the overall results.e bright crystal method is an indirect method to measure the cube texture in an aluminum foil.Due to the week corrosion resistance of the noncube texture, the surface of the crystals that belong to the noncube texture appears as white bright after etching.en, the noncube texture can be obtained through calculating the number of white bright crystals [9].In most production lines, the simple bright crystal method relies on human experience to determine the cube texture fraction using human eyes.Not only it is just a qualitative method, but also the person needs to have some experiences.Besides, it cannot give accurate detection results that are divided into several grades based on experience and the result accuracy is low [10][11][12].e results of the EBSD technology are accurate, but there are some problems such as complex sample preparation.
In view of this, in this paper, a machine vision platform is set up instead of the artificial recognition to measure the cube texture fraction in an aluminum foil with the bright crystal method.e brightness of the electronic aluminum foil with texture and without texture is not uniform.As the aluminum foil is light and easy to wrinkle, it will bring the perspective of light interference.e image segmentation processing technology based on top-hat transformation and connected region is proposed.Firstly, the digital morphology open operation is used to subtract the background from the original image to get the target to be analyzed.
en, the connected region segmentation is carried out to increase the accuracy in the target image.After conversion calculation, the quantitative detection of the cube texture in the electronic aluminum foil is realized.

Process and Principle of Measuring Cube Texture Fraction of Electronic Aluminum Foil Based on Image Processing
According to the characteristics of electronic foil images, the detection method including image acquisition, pretreatment, image segmentation, and feature extraction is proposed.Figure 1 shows the flow chart of the cube texture detection of electronic aluminum foil based on image processing [13].

Image Acquisition.
e samples were taken from the commercial aluminum foils in different batches with the size of 75 mm × 50 mm.And they were etched with a specific reagent.e composition and dosage of reagents are shown in Table 1.
In this study, the image acquisition device of MER-1070-14U3M/C-L industrial digital camera combined with LM16JC10M lens was used.e focal length of the lens was 16 mm.e low-angle bar light source was selected, and the pixel size of the pictures was 3840 (H) × 2748 (V), so the accuracy can reach about 0.02 mm. e complete image is taken, and the bright white dots representing the noncube texture are clearly recorded.

Image Preprocessing.
e black part of the image is the background, and the other part is the aluminum foil.e gray part is the cube texture, and the white bright part is the noncube texture.In order to meet the requirement of the threshold segmentation, the contrast enhancement is used to pretreat the images to enlarge the difference in light and darkness between different objects.e results are shown in Figure 2.

Separation of the Aluminum Foil from the Background.
e background of the image is close to pure black; that is, the gray value (0-255) is close to 0. But the gray value of both the aluminum foil and the noncube texture is far greater than 0. Firstly, an appropriate threshold value is searched for the aluminum foil image to separate the aluminum foil in the image from the background.After binarization, the aluminum foil portion in the binarized aluminum foil image is white, and the nonaluminum foil portion is black.
e threshold required for binarization can be obtained by using the maximum between-class variance method [12][13][14]15].For foil images I(x, y), the foil and background segmentation threshold is denoted as T. e ratio of pixels belonging to the aluminum foil to the image is denoted as ω 0 , and its average gray is recorded as μ 0 .
e ratio of the background pixels to the total image is denoted as ω 1 , and its average gray is recorded as μ 1 .e total average gray level of the image is denoted as μ, and the variance between classes is recorded as g.Assuming that the background of the image is dark, the size of the image is M × N, and then Substituting ( 1) into (2) gives the equivalent formula: e traversal method is used to obtain the threshold T that maximizes the variance between the two classes of aluminum foil images.Greater than the threshold is the foil area of the image, while less than the threshold is the background area.

Feature Extraction.
After extracting the main body of the aluminum foil, the proportion of the noncube texture can be obtained.

Noncube Texture Extraction Based on Top-Hat
Transformation.Noncube texture appears as a bright white spot in the image.Different parts of the aluminum foil are still uneven in illumination after the light source is adjusted.It is difficult to meet the demand for a certain threshold via experiments.In order to correct the impact of uneven illumination, the morphological top-hat transformation combined with the maximum between-class variance method is used to achieve adaptive segmentation of images and extract the noncube texture.e process is as follows: where x, y represents the position of the image pixel, and F(x, y) represents the entire image.B is the structural element, and G(x, y) is the output image.Θ represents the morphological opening operation; that is, the image is corroded and swell with the structural elements of 15 × 15 [16][17][18].e output image G(x, y) is obtained after the morphological opening operation from the original image.en, the second threshold for the binarization operation is determined using the maximum interclass variance method.
e threshold value T is obtained when the between-species variance g � ω 0 ω 1 (μ 0 − μ 1 ) 2 reaches the maximum.And the bright white spots representing the noncube textured parts can be initially separated from the nonuniform background after being binarized.

Reflective Removal Based on Connected Areas.
e wrinkle of the aluminum foil causes the reflection in the process of image shooting.e reflection region would be separated in the binarization process as large white areas, 2 Advances in Materials Science and Engineering which greatly affect the detection accuracy.So the large white areas need to be removed.e flow chart is shown in Figure 3. Firstly, the connectivity area is marked by the eight-connectivity decision method [19].at is, each pixel is connected to the adjacent eight pixels with the same gray value.And the number of pixels in each white connected area can be counted.en, it is determined whether the number of pixels in each of the white connected regions is 10 times greater than the average number of pixels in a single white dot.At this time, the region is considered to be reflective part.e white connected region is removed when the area is larger than the preset threshold [20][21][22].e other parts appear black except that the noncube texture appears as a bright white spot in the image.e result is shown in Figure 4.

Calculation of Cube Texture Fraction.
e number of pixels occupied by the extracted aluminum foil is S1; the number of pixels in the white area caused by the large-area reflected light is S2; the number of bright pixels representing the noncube texture is S3; the fraction of noncube texture is S3/(S1-S2); and the fraction R of the cube texture in the aluminum foil is obtained as follows:

Comparison with the Bright Crystal Method.
e bright crystal method utilizes the different corrosion resistance between the cube and no-cube texture.Because of the week corrosion resistance, the surface of the noncube texture is white bright after etching and the other area is cube texture.
e texture identification can be obtained through the proportion of areas covered with different colors.e artificial result means that the artificial experience is used to   Advances in Materials Science and Engineering judge the proportion of gray in the whole aluminum foil after etching.Four batches of aluminum foil were obtained from the industrial site and calibrated by human identification in the simple bright crystal method.In each batch, there are four samples that the texture fraction is estimated as 88%, 92%, 95%, and 97%, respectively.Using the present method for each batch of 4 samples, a total of 16 samples were tested as shown in Table 2: (1) e average cube texture fractions of several aluminum foils calibrated by human identification and image processing are basically the same.(2) However, there are some limitations of human identification.For example, the cube fraction of two aluminum foils in number 1 was identified as 95% and 97%.But the present method measured texture fraction was 98.51% and 98.33%, respectively.
In summary, the human eye recognition relies on the rich experience of the staff to judge so that it is not quantitative method and cannot give the result accurately.e method described in this paper based on image processing of texture measurement of the cube textured aluminum foil can achieve the quantification of detection results.

Comparison and Analysis with Etch Pit Method.
e etch pit method uses different shapes and colors after the corrosion to measure the texture.e cube texture has almost same direction and gray color, while the noncube texture appeals irregular shape and black color.e result can be obtained via a metallurgical microscope [9].
For each of the aluminum foil samples, a detection field of view was randomly shifted in the range of 10 mm × 10 mm in the sample and the pixel size of the pictures was 2000 (H) × 2000 (V).A single field of view is shown in Figure 5(a).After binarization, the noncube texture in view can be obtained as shown in Figure 5(b).
e cube texture fraction of the sample was calculated according to the area method shown in formula (6).e arithmetic mean of the cube texture fraction of nine subsamples was calculated as the cube texture fraction of the aluminum foil.e results are shown in Table 2. ere were 16 samples, and each sample is measured based on two different zones, which are chosen randomly.For example, in number 1-2 (Table 3), the first number 1 respects the batch number and the second number 2 respects the second detection in the same batch.e number 1 in Table 2 respects the batch number: In the formula, A is the percentage of the cube texture of {100} crystal plane, a i is the cube orientation grain area of the i in view, and s is the total area of the detection field [11].
ere are some differences between the two methods as shown in Tables 2 and 3. e result of the etch pit method for each sample is about 2% higher than the artificial result.e reason is that the etch pit method does not cover the entire field of view, and people tend to choose to have some noncube textures in the field of view, rather than having a cube texture in the field of view or a large number of noncube textures.In addition, due to the presence of defects such as impurities and dislocations, the surface pits are distorted.ese factors can cause the statistical results to be too small [23].Although the method described in this paper cannot reach the accuracy of the etch pit method under metallographic microscope, it can reflect the cube texture of the aluminum foil as well as the etch pit method.And it is a macro field of view that covers a large area and reflects a more comprehensive region.So the result is more representativeness.6.
e electropolishing method was used to prepare samples.And then, the samples were kept in the vacuum experimental environment.e samples were tilted at 70 °, and the accelerating voltage and working distance were selected according to the condition of the samples.e max deviation angle is set as 15 °. e EBSD probe is inserted again to produce an EBSP pattern.Finally, the EBSD results were analyzed by HKL Channel 5 software.e statistical distribution (texture) of crystal orientation can be determined by statistical calculation.e results of cube texture detection based on different methods compared with EBSD are shown in Table 4.
e results of EBSD processing are more credible, but because of its complex sample preparation, it has not been widely used in industry.From the results in Table 3, the errors between other methods and EBSD for measuring cube texture content can be obtained.
e comparison results show that the image processing method is far less than other methods, which shows that the proposed method has high reliability.

Conclusion
(1) e etch pit method can quantitatively detect the texture of the electronic aluminum foil with high accuracy.However, the sampling area is small, and the detection results obtained in many different sampling areas are easily affected by the sampling and analysis personnel's operation level.Bright crystal method measures the texture of a material by observing the area of the noncorroded area.e    Advances in Materials Science and Engineering noncorroded area is determined by the corrosion resistance of the different crystal planes of the recrystallized texture in the aluminum foil under certain chemical etching conditions.e imagebased detection method described in this article can accurately and quantitatively give the results to reflect the overall texture of the detection sample.
(2) From the average cube texture fraction in the experimental results, it can be seen that both the present method and the etch pit method can truly reflect the cube texture fraction of the aluminum foil.ey all meet the needs of production accuracy.However, compared with the etch pit method, the detection range of present method is larger, which can avoid the influence of manual selection on the field of view.e results reflect more objectively and comprehensively.At the same time, compared with the simple bright crystal method, the quantitative analysis is realized by using machine vision instead of human, which is more accurate than the empirical classification results.
(3) Texture fraction detection as a common indicator of quality control in industrial mass production, etch pit method, and the bright crystal method is the main method of texture detection.In particular, the bright crystal method has been popularized in China.In this paper, with the help of the light-crystallinity method, under the uneven brightness and reflection, an image segmentation processing technology based on top-hat transformation and connected region was proposed.eoretical analysis and experimental results show that good segmentation results can be obtained.
erefore, the cube texture fraction detecting method of the electronic aluminum foil based on image processing has practical significance that is reliable and easy to implement.
ere is a bright future for the cube textures offline detection of the electronic aluminum foil.

Figure 1 :
Figure 1: Flow chart of the cube texture detection based on image processing.

Table 1 :
Reagent composition and dosage.

Table 2 :
Results on the cube texture fraction based on image processing (%).

Table 3 :
Results on the cube texture fraction based on pit etching (%).

Table 4 :
Results of cube texture detection based on different methods (%).