The Application of Digital Image Processing to Study Slug Flow Characteristics in A Horizontal Pipe

Several flow measurement methods have been developed to get more in depth information of two-phase flow. Digital image processing technique is one of the methods which provide many advantages. It is classified as non-intrusive methods and able to process a large number of images. Furthermore, this technique is also supported by the flexible algorithm and advanced technology in high speed camera. In slug flow, the presence of small bubble become one of the biggest challenges since it can distract slug interface. This work explains image processing procedures to get clear interface between the gas and liquid phase on horizontal slug flow. Then the image processing technique was applied to a set of slug flow data. The experiment was conducted in a horizontal pipeline with 50 mm inner diameter using the combination of superficial liquid velocity 0.20.77 m/s and superficial gas velocity 0.7 – 1.88 m/s. The flow was recorded using high speed video camera and extracted into images sequence. Next, applied algorithm is well explained and the example of image processing result is presented. When the interface is clear, some slug flow parameter can be calculated like its velocity, length, and frequency. This method is able to reveal the effect of liquid superficial velocity and gas superficial velocity on slug flow parameter. Moreover, present data is also compared with previous research and shows good agreement. Keyword Two-phase Flow, Slug Flow, Flow Characteristics, Flow Visualization, Digital Image Processing.


II. EXPERIMENTAL SET UP
A set of data consist of 16 different superficial velocity combination is gathered then processed by image processing techniques. That combination can be classified as a transition region between slug and plug. The range is 0.2-0.77 m/s for water superficial velocities (J L ) and 0.7 -1.88 m/s for air superficial velocities (J G ). The specific superficial velocity can be obtained by dividing flow rate of water and air with pipe cross sectional area. Fig.1 shows experimental facility used in this work. A transparent acrylic horizontal pipeline is used to allow flow observations with a length of 18 m and an inner diameter of 50 mm. Water and pressurized air entry the test section through the mixer. A split plate was attached in the middle of the mixer to reduce flow fluctuations at the inlet. In the end, the separator was placed where the air is released to the atmosphere and the water is stored in the tanks before it is pumped back to the inlet storage. In order to reduce image distortion, a water filled transparent rectangular acrylic box was installed on 9 m from inlet position. Three 30 watt LED lamps were placed behind the filled transparent rectangular acrylic box as a light source. Tracing paper also was set to help the lamp produce better light uniformity. The flow visualization was recorded using a high speed video camera Phantom Miro M310 which able to record 1280 x 800 pixel images maximum rate at 3200 fps. This experiment use slightly slower recording rate to get longer video recording duration (around 110 s). Moreover, in order to capture more detailed picture, higher speed frame rate is applied.

III. IMAGE PROCESSING PROCEDURE
The recorded data was saved into image sequence through Phantom Control Camera application. It is the default application to control the phantom camera and provide a lot of operation such as file conversion, contrast and brightness enhancement and video player. Then the selected images were processed using MATLAB through algorithm programs. Our previous work [8], have used this method in order to determine slug parameter in 26 mm inner diameter pipe. In this works, those steps are explained well and followed by a number of improvement.

A. Image Loading
Each grayscale image was loaded into MATLAB using "imread" function.

B. Image Preconditioning
Some treatment needs to be done before the calculation started. One of them was image rotating. "imrotate" function was applied to eliminate misalignment between image horizontal axis and pipe. In addition, "imcrop" function was also implemented to remove the unused area in the image. From Fig.2, it can be seen that Pipe inner diameter was the outside border of the image.

C. Image Filtering
Each pixel of grayscale images has grayscale value from 0 to 255. Morphological operation is a shaped on the basis of image processing method which can be used to modify pixel value. Every pixel in the input image is compared with its neighbors depend on specific shape and size to produce new value of output image pixel. Top hat filter and bottom hat filter are two example of morphological operations. These two function can be used for contrast enhancement [9] using a scheme as shown in Fig.3. Fig.4. presents the effect of top hat filter and bottom hat filter on the image and its grayscale distribution. It can be observed that this image filter produces a better output image. The background color tends to change lighter while the interface bubble is getting darker. In addition, Fig.4. below shows that the amount of black pixel (value of 0) increase significantly and it makes the image segmentation process easier.

D. Image Complement
For the next step, "imcomplement" function is applied. In this process, each pixel value was reversed to its compliment. Output pixel value was obtained by subtracting maximum pixel value of grayscale image (255) with its former pixel. At the same time, 20 pixel height zero filter was applied to remove the distortion in the bottom of the pipe. (a) shows good interface between water and air phase. But, there is noise due to the unequal condition of light. In order to remove this noise, a new background was created by using a full liquid pipe image. Median filter was applied to remove noise then combined with imcomplement function. This image is used to subtract previous image. As shown in Fig.5. (b), uneven background was fixed.

F. Binary Conversion
Image segmentation through binary conversion is one of fundamental approach in digital image processing. It divides image into two parts: one corresponding to black means background and another corresponding to white means to object (foreground). A threshold value is needed to execute this operation. Each pixel which is higher than threshold value will change into 1. On the contrary, value of 0 appears when pixel intensity is lower than threshold value. One of well known method to determine threshold value is otsu method based on [10]. This method is chosen in this works because of its automation and simple calculation. Matlab has provided "graythresh" function to find global image threshold using otsu method. This function is followed by another algorithm such as "imfill", "imclose", and "bwareaopen" to produce good binary and perimeter image like  Even though previous step can segment bubble clearly, different method is also proposed to overcome difficulties due to the presence of dispersed bubble. As superficial velocity increases, an extensive number of small bubble appears around the tail bubble. These bubbles are attached to the tail or even block partially the elongated bubble. Fig.6. shows the steps that used to separate the dispersed bubble. Previous step (1-5) is used before binary conversion process. Then, "ones" function is applied to change the ride border side of bubble into white and followed by "imcomplement" function. Unused white area in Fig.6. (c) can be removed by 'imclearborder' function. Basically 'imclearborder' suppresses the white pixels that are connected to the image border. The result of this function can be seen in Fig.6. (d). Next, "imclose" function performs morphological closing operation to eliminate black area between the bubbles. Finally Fig.6.  Fig.7. shows the result of image processing, specifically on nose contour. The use of smoothing filter successfully eliminates the disturbance noise because of unsimilar gray level pixel on the interface. Moreover, the technique was able to reveal the effect of gas-liquid superficial velocities on nose behavior. At low velocities, short nose appears and is located on the top of the pipe. As the velocity increase, bubble nose tends to move toward the center of the pipe due to inertia force. The nose is also thinner and longer. At the same time, bubble tail contour can be seen in Fig.8. Two different methods were used to get the best result in this work. For lower velocity, the presence of dispersed bubble is not significant. For this reason, the dispersed bubble separation technique is not necessary needed. As shown in Fig.8. (a), the bubble tail is well defined. The hydraulics jump exists at the bubble end, but it doesn't reach the top of the pipe. It creates very thin air phase layer, around 0.1 D thick. This phenomenon occurs on lower velocities. The increase of gas superficial velocities causes the hydraulic jumps blocks the pipe. The tail separation occurs and drives the bubble entrainment from elongated bubble to liquid slug. Consequently, the dispersed bubble can be found attached on the tail bubble. Even though the presence of dispersed bubble, Fig.8. (b) and (c) show that elongated bubble tail can be described clearly using proposed method that already explained before. From the tail contour, it can be seen that the hydraulic jump angle increases for higher gas superficial velocity. Furthermore, this present data indicates same behavior with bubble shape model proposed by [11].

IV. RESULT AND DISCUSSION
To get quantitative data from image, calibration factor should be defined by dividing pipe in pixel with its real diameter. As soon as calibration factor is set, several slug parameters can be calculated. One of the important parameters is bubble velocity that has been investigated for years. Bubble velocity is measured by calculating the distance of bubble coordinates in the different frame using equation (1).

=
(1) Where U B is the bubble nose velocity (m/s), ΔX P is the change of bubble coordinate in X axis (pixel), PixCal is Calibration factor to change pixel unit into meter unit, ∆ frame is frame difference which shows bubble, and FR is frame rate (frame/s).
The changes of bubble coordinate in X axis is found using maximum tracking method. Each row is scanned horizontally to find the biggest value of nose position. In addition, liquid slug (bubble rear) velocity is also can be measured by this method. While bubble velocity calculation uses maximum tracking method, tail coordinate was found using minimum tracking method. Through these techniques, velocity of each single bubble and liquid slug was calculated automatically. A number of recorded slug was used, so statistical analysis can be done get better understanding of this irregular flow pattern. Fig. 9. a dan b shows a distribution of bubble and liquid slug velocity. it reveals that the velocity of the bubble and liquid slug is not similar one each other. Even though most of the data normally distributed around the main value, outlier still exists in measured data. That figure also shows that the mean velocity of bubble and liquid slug is almost similar, around 1.60 m/s for J G = 0.7 m/s and j L = 0.44 m/s. It is supported by Fig. 10. (a) that present the comparison bubble and liquid slug velocity for each data. It indicates that slug flow observed is fully developed, as previous research [12] mentioned. The correlation between bubble velocity and mixture superficial velocity is presented in Fig.10.b. Bubble velocity depends on both liquid and superficial velocity with linear regression. Additionally, Froude number also contributed to the increase of bubble velocity. Bendiksen [13] explained that for low values of Froude number bubble tends to move on the upside of the pipe. While in high Froude number, the inertia force affects the bubble to move toward to center of pipe. Woods and Hanratty [14] also proposed three correlations for bubble velocity based on Froude number. Those correlations give good agreement when compared to this work, as shown in Fig.10. b. All of the experiment data set was placed inside 20 % error line area with an average error about 5.04%. Slug frequency can be determined by dividing the number of slug which passes test section with recorded time. Understanding slug frequency is important because it is related to inner pipe corrosion rate [15]. Moreover, Morales et al [2] have been explained bubble nose detection nose method clearly. The effect of liquid and gas superficial velocity is briefly presented in Fig.11. (a). Slug frequency increases as liquid superficial velocity increases. In addition, liquid superficial velocity is strongly related to the change of slug frequency compared to the gas superficial velocity. Fig.11(b) shows the result of Measured frequency which is plotted in Strouhal number (f. D / J G ) versus the ratio of liquid superficial velocity to mixture velocities. Compared to previous study [16] [17] [18], it shows good agreement even though the present work gives a little smaller value. Another parameter which can be calculated is bubble and liquid slug length. Most of elongated bubble and liquid slug length exceeds observation section size. In this case, a set of sequence images can be combined as a complete image using the tracking method [19]. The result of liquid slug and bubble reconstruction is presented in Fig.11. As a result, the length of individual liquid slug or bubble are determined by calculating the difference between tail and nose position. On other hand, bubble length also can be measured separately using tail and nose position, the number of frame show the body, and its velocity. This method is more simple because image reconstruction is not needed. Fig.12. presents the influence of the gas superficial velocity on the average length of the elongated bubble. Under constant J L , the elongated bubble length increases proportionally as the increase of J G . This trend shows good agreement with previous research [8] [20].

V. CONCLUSION
In this work, sequence procedures were applied to the visual data collected by high speed video camera. This algorithm was able to produce a clear interface between liquid and gas phase and the disturbance effect caused by dispersed bubble can be reduced. In addition, this technique can measure important slug parameter and showed good agreement when compared to previous research. In the future, research related to this topic still provide a lot of improvement area like the developing of new segmentation techniques and bubble contour reconstruction in highly aerated slug. Furthermore, deeper analysis related this measured data is needed due to the importance of slug flow.