Single-Phase Velocity Determination Based in Video and Sub-Images Processing: An Optical Flow Method Implemented with Support of a Programmed MatLab Structured Script

Important in many different sectors of the industry, the determination of stream velocity has become more and more important due to measurements precision necessity, in order to determine the right production rates, determine the volumetric production of undesired fluid, establish automated controls based on these measurements avoiding over-flooding or over-production, guaranteeing accurate predictive maintenance, etc. Difficulties being faced have been the determination of the velocity of specific fluids embedded in some others, for example, determining the gas bubbles stream velocity flowing throughout liquid fluid phase. Although


Introduction
The industry began to be interested in developing multi-phase-flow-meters, also just called as MPFMs, early in 1980s, since priory, single-phase measurements alone were sufficient to meet the industry's needs.Since 1994, MPFM installation numbers have been steadily increased as technology in the field, with substantial growth witnessed from 1999 onwards [1].Moreover, in any extension, a solution for detecting single-phase motions embedded in a multi-phase-flow environment may still have its importance and engineering impact.
Studies have shown that non-intrusive flow meters may be more adequate in activities where intrusive ones may affect the effectiveness of the process itself, or where further effort in terms of system re-engineering may show to be necessary, since situations can lead to metering damaging, more frequent maintenance necessity, etc. [2].
Furthermore, since the treatment of the information of this specific idea can be done and run on top of algorithm and media processing, it allows a more reliable real-time data sensing, keeping itself as a very good alternative to be implemented in complex areas or environment where size and intrusiveness of the measuring method may play a bigger role, being these the main motivation of the experiments carried out and detailed in the presented work.
For the developed experiment and simulation, a two-phase flow pattern (clean water and gas bubbles) was used as main fluid combination together with a high resolution recording camera pointing to a transparent tubing.So that non-intrusively, one could record a video from the stream, and subsequently, get the recorded media treated by the developed MatLab script, yielding with the gas bubbles flowing phase velocity determination.Since velocity is not more than a displacement over a specific time-range, putting this information together with the video recording rate in use, one can come-up with the actual effective gas bubbles single-phase stream velocity.Important to notice is that since the background represents the water, for example, it is estimating the total velocity and not the relative velocity on top of the water flow.

MatLab Media Processing Treatments
The media processing started transforming the images from RGB 3D format (Figure 3(a)) to 2D images, since it has shown to be necessary to have them as singles colors "RGB2GRAY (image)" (Figure 3(b)).
Sequentially, it was necessary to eliminate isolated pixels in order to allow distinguishing from gas bubbles background using the function "EDGE (image, 'sobel')", and also perform a bordering quality enhancement in order to allow a better delimitation of the bubbles itself (Figure 3(c)).
Finally as a final step, it is always better and necessary to have some pictures boundaries cropped-out, having a better and smoother image to be feeding the script, accomplished using the function IMCROP.

Algorithm Script Schematics Summary Flow-Chart
From Figure 4 shown, it can be seen how the logic behind the developed algorithm is.The source code itself has been hidden due to specific purposes.
Throughout the analysis and comparison developed with the results, could be verified that this developed methodology and source code script can help as a non-intrusive method of measuring gas bubbles stream velocity in a two-phase or even multi-phase flow environment.
There were two main factors affecting the results that could for sure be enhanced in a next research: better definition of the bubbles sharpness and processing by eliminating the isolated pixels, and guaranteeing to have just perfect ellipses or circles left to be representative so that just raw bubbles would be compared for the pixel superposition matching, allowing a much better accuracy.Furthermore, one can interpret that the matches happens  normally on the lasts superposition pixels, so that may not really be necessary to run the correlation code throughout the whole image matrix, but just after a certain specific matrix position.These could lead to source code optimization and results accuracy.Nevertheless, it allowed an estimation of the stream velocity with an accuracy of around 97% for the tests run, what is considerable in terms of the necessary work-around implied over these studies and processing.

Conclusions and Discussion
Throughout the analysis and comparison developed with the results, it could be verified that this developed methodology and source code script can help as a non-intrusive method of measuring gas bubbles stream velocity in a two-phase or even multi-phase flow environment.
There were two main factors affecting the results that could for sure be enhanced in a next research: better definition of the bubbles sharpness and processing by eliminating the isolated pixels, and guaranteeing to have just perfect ellipses or circles left to be representative so that just raw bubbles would be compared for the pixel superposition matching, allowing a much better accuracy.Furthermore, one can interpret that the matches happen normally on the last superposition pixels, so that it may not really be necessary to run the correlation code throughout the whole image matrix, but just after a certain specific matrix position.These could lead to source code optimization and results accuracy.
Nevertheless, it allowed an estimation of the stream velocity with an accuracy of around 97% for the tests run, what was considerable in terms of the necessary work-around implied over these studies and processing.

Figure 1 .
Figure 1.Main schematic of the correlation matching idea.

Figure 2 .
Figure 2. Example of iterative process from beginning up to the processing end match.

Figure 3 .
Figure 3. Media processing from raw 3D format (a) [3] up to final enhanced quality before cropping (c).