A Method of Obtaining Catchment Basins with Contour Lines for Foam Image Segmentation

Abstract: Foam image segmentation, represented by watershed algorithm, is wildly used in the extraction of bubble morphology features. H-minima transformation was proved to be effective in locating the catchment basins in the traditional watershed segmentation method. To further improve the accuracy of watershed segmentation, method of topbottom-cap filters and method of morphological reconstruction were implied to marking the catchment basins. In this paper, instead of H-minima transformation, a method of contour lines is specially proposed to obtain the catchment basins for foam image segmentation by using top-bottom-cap filters and less morphological reconstruction. Experimental results in foam segmentation show that the proposed method is equally accurate but more efficient than the method of H-minima plus morphological reconstruction, and equally efficient but more accurate than the method of H-minima plus top-bottom-cap filters.


Introduction
Image segmentation methods are widely applied in such areas as smart transportation system, medical image analysis, remote probing, floatation process, etc. In the process of mineral flotation, the bubble shape can directly reflect the production conditions and production indicators. Foam image segmentation is a key step in the extraction of bubble morphology features [Lezoray and Christophe (2009);Sadr-Kazemi and Gilliers (1997); Zhou, Yang, Gui et al. (2010)]. With the introduction of many new theories and new methods in various disciplines, many image segmentation methods have been developed, in terms of segmentation methods based on threshold [Wu (2014)], region [Girshick, Donahue, Darrell et al. (2016); Zhou, Qiu, Li et al. (2018)], edge [Al-Amri, Kalyankar and Khamitkar (2010)], cluster analysis [Arifin and Asano (2006) ;He, Dantong, Wang et al. (2018)], fuzzy set theory [Tobias and Seara (2002)], wavelet transform [Unser (1995)], neural network [Kuntimad and Ranganath (1999)], etc. The watershed algorithm is the most commonly used foam image segmentation algorithm. However, because the flotation bubbles are stuck, affected by the ambient light, and unobvious at the boundary, therefore, it is necessary to improve foam image segmentation.

Related works 2.1 Standard watershed algorithm for foam segmentation
The foam image segmentation method based on watershed transform is a mathematical morphology segmentation method based on topological theory, in which the image is regarded as an inverted geodesic topological feature. Taking the gray value of each pixel in the gradient image, the connected areas of the image are found. The watershed transformation method assumes that each local minimum value and its surrounding area form a catchment basin. As the water potential increases, the catchment basin gradually expands, and the confluence of the catchment basin is the watershed. The classical watershed transformation was proposed by Vincent Luc et al. [Vincent and Soille (1991)], including the sorting process and the flooding process. The watershed represents the maximum point of the input image. The watershed calculation process is an iterative labeling process. First, each pixel is sorted from low to high gray level, and then in the process of submerging from low to high, each local minimum value in H-minimum area uses a first-in, first-out structure to judge and mark the catchment basin.
In formula (1), function Hmin represents an H-minima transformation, and Hw represents a H-minima transformation threshold. By setting the depth threshold Hw, the local minimum of the basin below a given threshold is eliminated. After inverting the foam image, each bubble can be regarded as a catchment basin. The watershed transformation can be used for edge segmentation. The basic steps are as follows: First, search the catchment basin in the foam image, using H-minima transform. Second, reconstruct the shape of the catchment basin. Finally, perform edge segmentation to the foam image with watershed transform method. The key to determining the effect of the watershed transformation segmentation is to accurately locate the catchment basins [Cai, Li and Guo (2014)]. It is inevitable to find low qualities or faults in the foam image, such as uneven illumination, noise, quantization error, texture, etc., which result in too many local minima and a so-called oversegmentation that the target image be segmented into a large number of small areas. Fig. 1 shows a foam image F (size: 800*600), and Fig. 2 shows the result of edge segmentation directly using the watershed transform of F. Obviously, the oversegmentation phenomenon is very serious.

Enhancement of the catchment basins with top-bottom-cap filters
According to the research of Yingying Gu et al. [Gu, Lin, Li et al (2007)], in the foam image, the gray value less than 20 is the shadow of bubbles, and the gray value greater than 225 is the reflection of the illumination light on the top of the bubble. Therefore, the foam image can be transformed with top-bottom-cap filters to improve the effect of watershed transformation [Liu, Yuan and Guo (2011)]. Assuming the gray value of top part of bubbles is exceeded b1, and the gray value of bottom part of bubbles is lower b2, then the target of top-cap filter is to make the data in top part distributed at the highest intensity of c1, and the target of bottom-cap filter is to make the data in bottom part distributed at the lowest intensity of c2. The transformation formula of top-bottom-cap filters is: , For example, through the transformation of top-bottom-cap filters, the gray values the foam image are linearly mapped to [0, 255] range, with top 1% data assigned to 255 and bottom 1% data assigned to 0. The enhancement effect to the foam image F is shown in Fig. 3 and Fig. 4 in a threedimensional view. The processed image has an obviously higher recognition degree for bubble object.

Enhancement of the catchment basins with morphological reconstruction
Morphological reconstruction of the catchment basins with prior knowledge is an effective way to enhance the catchment basin markers [Hu and Cai (2011)].
The result of the expansion operation is to merge the background pixels that are in contact with the object boundary into the object, filling the small holes in the image and the small concave portions at the edges of the image. The structural element Q is recorded for the expansion of the image F, which is defined as: The etching operation is the inverse of the expansion operation. The corrosion of the structural element Q on the image F is described as: In formula (4), The filling operation can be achieved by using multiple iterations of combination of expansion operations, complement operations, and intersection operation.
In which B is a cross-shaped structural element.
Commonly, the morphological expansion operations are used to merge the closed marks to reduce the over-segmentation of the image, and morphological corrosion operations are used to eliminate the blanks inside the mark and reduce the under-segmentation of the image.     Second, invalid catchment basins were checked and deleted to ensure each catchment basin has area in a proper range. Third, the shape of catchment basins was separately fixed with a series of morphological operations, mainly including corrosion operation and expansion operation. Then, all catchment basins were merged into a unique catchment basin map.
Finally, the foam image was reconstructed with the unique catchment basin map as shown in Fig. 8, and segmented with watershed algorithm.

Figure 8: Reconstruction of foam image F
As shown in Fig. 8, almost every bubble has a corresponding high-lighted block at central-top area, which will be treated as catchment basin for watershed transformation.

Proposed method 3.1 The relationship between height of contour line and bubble size
By setting the bubble height to its gray value, the gray space can be converted into a three-dimensional space. According to surface area formula of ball crown, the distribution function for the count of pixels in a bubble above a certain gray value is: In which si is the count of pixels in a bubble with radius of ri and height of h, and n is the number of bubbles. All bubbles contained in a foam image are semi-sphere with same height and different radius, as can be seen from Fig. 3 and Fig. 4. Then the equation of total surface area of bubbles should be: In which S means total surface area of all bubbles with average radius of r and height of h, and e is a constant coefficient.
Considering the case that bubbles in a specific foam image are separated by several contour lines, it is easy to set up the relationship between height of contour line and area or radius of bubbles section crossed by them.
Assuming k contour lines are performed, the corresponding section area is:

Foam image segmentation method based on gray contour lines
The steps of the image segmentation method based on gray contour lines are as follows: (1) Enhance the foam image with top-bottom-cap filters.
(2) Set up the model about the relationship between height of contour lines, area and radius of bubbles by using curve fitting method.
(3) Determine the number and height of the contour lines used to cut the bubbles, including at least three contour lines: the top contour, the middle contour, and bottom contour.
(4) Expand each bubble section separated by contours lines and determine whether they have a valid size.
(5) Merge foam images with all bubble sections and count how many repeated parts existing in a bubble. A morphological filling operation is recommended to eliminate blanks inside the compound bubble sections.
(6) Taking the compound bubble sections as the catchment basins, the original foam image after the inversion is segmented by watershed method to curve accurate bubble edge.

Obtaining catchment basins of foam image F with proposed method
First, the foam image F is enhanced with top-bottom-cap filters as shown in Fig. 9.  Through comparing Fig. 10 to Fig. 4, the valid distribution of gray value for foam image F is in range of [40,225], which is summed cumulatively as shown in Fig. 11. The sample date is changed by a square root operation and its fitted linear curve as shown in Fig. 12 In which r means average radius increment. If 100 bubbles contained in foam image F, according to formula (11), then the average radius increment to bubble sections is -9.37 pixels, which means the area of each bubble section will be same after a series expanding operation of {0, 9.37, 9.37*2, 9.37*3, 9.37*4, 9.37*5}. However, for large bubbles, the radius increment may be more than 100 pixels. For small bubbles, the radius increment may be less than 1 pixel. Let the identifiable bubble has a radius of from 6 pixels to 100 pixels, then radius of the smallest bubble at top layer is 1 and 100 for the largest bubble at bottom layer. To make sure all sections belong to a bubble, instead of sections belong to different bubbles, are connected to each other, the expansion operation to bubble section is suggested to be {0, 1, 2, 3, 4, 5}. Certainly, there are many proposals for other categories of bubbles if every category of bubbles can be dealt separately. The processes of expanding 6 layers of F are shown in Fig. 14.

Accuracy of segmentation of foam image by using watershed transformation
Three methods, including H-minima plus top-bottom-cap filters, H-minima plus morphological reconstruction, the proposed method mixed with top-bottom-cap filters, less morphological reconstruction and contour lines, are used to enhance the catchment basins and segment a series of foam images by using watershed transformation. The segment results of foam image F are shown from Fig. 16 to Fig. 18, which indicate that for bubble segmentation the proposed method is as accurate as the method of Hminima plus morphological reconstruction, while the method of H-minima plus topbottom-cap filters is a bit less accurate.

Efficacy of segmentation of a series of foam images by using watershed transformation
The time consumption of three segmentation methods based on watershed algorithm to foam images is shown in Fig. 19, which indicates that for bubble segmentation the proposed method is as efficient as the method of H-minima plus top-bottom-cap filters, and 5 times faster than the H-minima plus morphological reconstruction method.

Conclusions
H-minima transformation, top-bottom-cap filters and method of morphological reconstruction were proved to be effective for the traditional segmentation method in locating the catchment basins. However, instead of H-minima transformation, method of contour lines proposed in this paper with top-bottom-cap filters and less morphological reconstruction is also suitable to accurately and efficiently obtain the catchment basins. Experimental results in foam segmentation show that the proposed method is as highly accurate as the method of H-minima plus morphological reconstruction, and as efficient as the method of H-minima plus top-bottom-cap filters. Meanwhile, the proposed method is more accurate than the method of H-minima plus top-bottom-cap filters, and more efficient than the method of H-minima plus morphological reconstruction.