## 2 Materials and Methods
### Bubble Processing Methodology by Virtue of Computer Vision Approach
For the final methodology we have used both, namely Canny filter after Frangi filter, in order to make edges thinner while keeping in mind this approach might result in double-edging. Figure 3: Image transformations after application of (**a**) black-hat transform, (**b**) histogram equalization and (**c**) CLAHE on the sample frame from the F3 video. One can see that all the methods highlight edges in different ways. After the series of tests for all the transformations above the black hat transform was selected as the most promising and correct. Now when the boundaries are obtained the final preparatory step will be a well studied clustering method application. The complexity is determined by the superposition of bubbles on the top of each other, which might lead to the allocation of two bubbles in one cluster: we will consider this situation in detail in the following section. Meanwhile in general, when the bubbles are isolated as separate clusters, it is possible to approximate the bubble using the ellipse model (Figure 6), since bubble objects are visually quite similar. The approach allows, on the one hand, the target parameters to be calculated, e.g., area, and on the other hand the ellipse model reduces the number of model parameters and, as a result, allows more stable results to be achieved [32]. The ellipse is a curve of the second order and therefore we approximate a general function of \(ax^{2}+bxy+cy^{2}+dx+ey+f=0\). A numerically stable variation of the least squares method was used, namely least squares minimization with a guaranteed solution specific to the ellipse, also relevant for scattered or noisy data. The optimal solution is calculated directly, no iterations are required, which results in a simple, stable and reliable fitting method with undemanding implementation. The proposed algorithm has no computational ambiguity and throughput is more than 100.000 per second. For our case it is convenient to parameterize the ellipse in terms of the coordinates of the center, the semi-axis and the angle of inclination of the main semi-axis. Finally, it is worth noting that various parts of the ellipse contain different amounts of necessary information. As a result, if the defined bubble boundary does not contain kinks in the ellipse, there are a number of ellipses which can fit the data. Such uncertainty might result in a distorted ellipse, e.g., smaller and more elongated. In the following section we  
Figure 5: Examples of the final edge detection method on (**a**) F1, (**b**) F2, (**c**) F3 video sample frames. One can see that due to a high density of the image objects the method finally fails to detect bubbles correctly. represent the results of the single bubble size and bubble intersection examination, as well as results on bubble projection area estimation and model verification on the labeled data. Since different parts of the ellipse contain different amounts of the required information, one can obtain results with different accuracies depending on the parts data were generated from, meaning that, in case data contains points from both ellipse turns, the result is revealed to be much closer to the true values. Thus, for the following examples (Figure 7), the true values are \(x_{0}\) = 4; \(y_{0}\) = -3.5; \(a\) = 7; \(b\) = 3; \(\theta\)= 0.7854 (\(\pi/4\)): in Figure 7c the result is closer to the true values since the number of points is still 20 and all of them have more information. When calculating a number of derivative sign changes we keep in mind that the greater the number the more confident the result is. However due to the noise factor there might be more sign changes as seen in Figure 8. When edges are obtained the next step is to cluster them into separate bubbles. Since due to the process and filming specific bubbles might overlap on the image, a clustering method should in general tend to reduce the number of bubbles considering a few as one bubble; however, there might be smaller bubbles on bigger ones or a pseudo-bubble, i.e., not correctly detected edge.