Keywords

1 Introduction

Currently, digital images have widespread use in many applications. The increase in its use is mostly because much of the information that humans get from the world is by observing images, whether in their daily life, walking down the street, watching television, reading books, or in professional and scientific applications. In the last case, there are many data obtained from the analysis of photographs, spectrograms, thermal imaging, etc.

Computer Vision employs artificial systems that can extract information from digital images. It involves image acquisition, processing, and analysis.

As presented, Computer Vision techniques can offer support in many areas [14]. Images produced by experimental tests can be better understood through these techniques. In this work, image-processing techniques will be applied to better understand the behavior of a phase-changing material in the presence of natural convection. The analysis of this kind of problem has received increasing research attention and it is important for energy storage systems, thermal environment control, crystal growth processes, and other engineering applications. This study deals with the melting of a pure substance in the presence of natural convection in a rectangular enclosure due to a horizontal thermal gradient.

Several numerical and experimental studies have been reported in the literature concerning the problem of melting or solidification in the presence of convection. Examples of experimental studies can be found in the works of Wolff and Viskanta [5] and Bénard et al. [6]. In numerical analyses, the works of Kim and Kaviany [7], based on the Finite Difference method, and the works of Sparrow et al. [8], which pioneers in solving phase change problems by the Finite Volumes method, can be mentioned. Gobin and Le Quéré [9] performed a comparison exercise about melting with natural convection. This work applies different numerical procedures and models to a simple phase change problem.

Some fluids exhibit maximum density near their freezing points. In such case, the problem becomes even more complex because the hypothesis that the density varies linearly with temperature cannot be applied. This phenomenon occurs with water near 4 °C at atmospheric pressure, which is a temperature often found in several technological applications and in nature. Numerical and experimental works involving maximum density and thermal natural convection can be found in the literature, such as in the work of Lin and Nansteel [10] and Bennacer et al. [11]. Braga and Viskanta [12] and Kowalewsky and Rebow [13] analyzed the effect of maximum density in water solidification in a rectangular cavity. Tsai et al. [14] presented a numerical work about the effect of maximum density on laminar flows in tubes with internal solidification, involving mixed convection. A simple model of water freezing in a differentially heated cavity is used by Yeoh et al. [15].

This work is motivated by the need to gain a more complete understanding of the heat transfer process during the solid–liquid phase change that occurs with natural convection and maximum density.

2 The Phase Change Problem

This study deals with melting of a vertical ice slab upon a gravitational field in a rectangular enclosure due to a horizontal thermal gradient. The process is driven by thermally induced natural convection in the liquid phase.

2.1 Mathematical Model

The physical problem at time t * = 0 is shown in Fig. 12.1. The asterisk superscript (*) is used to indicate the dimensional variables. In the initial condition considered half of the material volume is in the solid state, while the other half is in the liquid state. Initially, all the volume of the testing substance is set at its fusion temperature, i.e., T 0  = T Fus. The melting process begins when the temperature of one of the vertical walls of the rectangular cavity, represented by T H , is increased. H is the cavity’s height and L is the width. The right vertical wall is kept isothermal at T 0 and the horizontal walls are adiabatic. The entire process is controlled by the natural convection in the liquid phase. The position of the interface at time t* and level z* is defined by its distance from de hot wall \(c^{*} (z^{*} ,\;t^{*} )\).

Fig. 12.1
figure 1

Physical problem at time t* = 0

The hypotheses below were assumed in order to formulate the equations that manage the problem:

  • The flow is laminar and two-dimensional.

  • The liquid material is Newtonian and incompressible.

  • The fluid’s physical properties are constant, except for density in the buoyancy force term.

  • The viscous dissipation is negligible.

  • The density change of the material upon melting is neglected.

  • It is assumed that the velocity of propagation of the melting front is several orders of magnitude smaller than the fluid velocities in the boundary layers on the vertical walls. This suggests that it is possible to divide the process in a number of quasi-static steps, separating, therefore, the melting front motion calculations from the natural convective calculations.

The coordinate system adopted, the time and the melting front were made dimensionless in the following way:

$$y = {{y^{*} } \mathord{\left/ {\vphantom {{y^{*} } H}} \right. \kern-0pt} H}; \quad z = {{z^{*} } \mathord{\left/ {\vphantom {{z^{*} } H}} \right. \kern-0pt} H}$$
(12.1)
$$t = t^{*} \upsilon /H^{2} ;\quad c(z,t) = {{c^{*} (z^{*} ,t^{*} )} \mathord{\left/ {\vphantom {{c^{*} (z^{*} ,t^{*} )} H}} \right. \kern-0pt} H}$$
(12.2)

Dirichlet thermal boundary conditions are taken on the vertical wall and at the interface, and the horizontal walls are adiabatic. In the liquid cavity, zero velocity dynamic boundary conditions are considered at the four walls.

Based on the previous hypothesis, the governing equations used in the nonrectangular liquid domain can be written in their dimensionless form as following:

$$\nabla \bullet {\bar{\mathbf{V}}} = 0$$
(12.3)
$$({\bar{\mathbf{V}}} \bullet \nabla ){\bar{\mathbf{V}}} = \nabla^{{\mathbf{2}}} {\bar{\mathbf{V}}} - \nabla {\text{P + }}\left( {\frac{{{\text{gH}}^{ 3} }}{{\upsilon^{ 2} }}} \right)\left( {\frac{{\rho (T) - \rho_{\text{ref}} }}{{\rho_{\text{ref}} }}} \right) \, \bar{k}$$
(12.4)
$$\text{(}{\bar{\mathbf{V}}} \bullet \nabla )\theta = \frac{1}{\Pr }\left( {\nabla^{2} \theta } \right)$$
(12.5)

The dimensionless velocity vector \(\bar{V}\) is given by: \(\bar{V} = {{\left( {\bar{V}^{*} {\text{H}}} \right)} \mathord{\left/ {\vphantom {{\left( {\bar{V}^{*} {\text{H}}} \right)} \upsilon }} \right. \kern-0pt} \upsilon }\), where \(\upsilon\) is the kinematic viscosity. The dimensionless temperature is given by \(\theta_{{}} = {{\left( {T_{{}} - T_{\text{av}} } \right)} \mathord{\left/ {\vphantom {{\left( {T_{{}} - T_{\text{av}} } \right)} {\varDelta T_{{}} }}} \right. \kern-0pt} {\varDelta T_{{}} }}\), where T av is the average temperature given by \(T_{\text{av}} = {{\left( {T_{H} + T_{\text{Fus}} } \right)} \mathord{\left/ {\vphantom {{\left( {T_{H} + T_{\text{Fus}} } \right)} 2}} \right. \kern-0pt} 2}\). T is the dimensional temperature, and \(\varDelta T = T_{H} - T_{\text{Fus}}\). The Prandtl number is given by Pr = υ/α, and α is the thermal diffusivity. P is the dimensionless pressure, given by \(P = {{\left( {P^{*} \upsilon } \right)} \mathord{\left/ {\vphantom {{\left( {P^{*} \upsilon } \right)} {H^{2} }}} \right. \kern-0pt} {H^{2} }};\,\rho_{\text{ref}}\) is the reference density (equal to the average density of the interval imposed by the temperature of the walls) and \(\bar{k}\) is the unitary vector in the vertical direction. At the moving interface, the energy balance equation is given by:

$$\nabla \theta \bullet \overline{\text{n}} = \frac{\partial c}{\partial \tau }$$
(12.6)

The term \(\left( {{{\partial c} \mathord{\left/ {\vphantom {{\partial c} {\partial \tau }}} \right. \kern-0pt} {\partial \tau }}} \right)\)represents the local velocity of the melting front along the vector \(\overline{\text{n}}\), normal to the interface and τ = Ste × Fo, with Stefan number given by Ste = (c p ΔT)/L F , where c p is the specific heat and L F the latent heat. Fo is the Fourier number.

2.1.1 Density Approximation in the Buoyancy Term

As mentioned earlier, for fluids that reach an extreme density value at a specific temperature, it is not suitable to assume the hypothesis that the density varies linearly with temperature. Contrary to the linear estimate that predicts a unicellular flow, the maximum density formulation predicts a bicellular flow. As for water, the following equation, proposed by Gebhart and Mollendorf [16], provides very good results for temperatures below 10 °C:

$$\rho (T) = \rho_{\text{ref}} .\left( {1 - \gamma .\left| {T - T_{\text{ref}} } \right|^{q} } \right)$$
(12.7)

The term \(\gamma\) is the phenomenological coefficient given by \(\gamma\) = 8 × 10−6 °C−2; q = 2. In this case, ρ ref is equal to the maximum density of the fluid, also called ρ M ; and T ref is equal to the temperature of the maximum density, which is also called T M . For water T M  = 3.98 °C. A modified Grashof number based on the cavity height and on ΔT max (maximum temperature interval considered) have been defined:

$${\text{Gr}}_{\bmod } = \frac{{g.H^{3} .\gamma .\left( {\varDelta T_{\hbox{max} } } \right)^{2} }}{{\upsilon^{2} }}$$
(12.8)

The effect of variation of ρ is approximately symmetrical to the maximum density. The relative density variation that causes the flow in each cell is directly linked to the intervals between T M and the wall temperatures. Then:

$$\varDelta T_{1} = \, T_{H} - \, T_{M}$$
(12.9)
$$\varDelta T_{2} = \, T_{M} {-} \, T_{0}$$
(12.10)

The maximum temperature interval considered is:

$$\varDelta T_{ \hbox{max} } = {\text{ Max}}(\varDelta T_{1} , \, \varDelta T_{2} )$$
(12.11)

2.2 Numerical Procedure

The numerical method used in this work has been successfully compared to the results of other researchers for the case of materials that do not present a maximum density to a comparison exercise proposed by Gobin and Le Quéré [9]. The numerical simulation technique is based on the hypothesis that the melting process is a succession of quasi-stationary states. In order to map the irregular space occupied by the liquid into a rectangular computational space, the dimensionless coordinates were transformed. The curvilinear coordinate system adopted is given by:

$$Z = z ; \quad Y = {y \mathord{\left/ {\vphantom {y {C(Z)}}} \right. \kern-0pt} {C(Z)}}$$
(12.12)

where C(Z) = c*(z*)/L and L is the maximum width of the liquid cavity. Z and Y are the computational dimensionless coordinates. Other details of the coordinate transformation method are shown in the work of Vieira [17]. The transformed equations are discretized on a computational domain using the hybrid differencing scheme [18]. The pressure-velocity coupling is solved through the SIMPLE algorithm. The solution of the discretized equations is obtained through the ADI procedure. The grid defined on the computational domain is spaced irregularly to obtain a better resolution of temperature and velocity gradients at the solid walls. Among the types of grid tested, the 42 × 42 grid was chosen to present the results, based on the optimal balance of precision and computational time. Table 12.1 present the test performed.

Table 12.1 Case test

The acceleration of gravity g used was 10.0 m/s2. The values of the physical properties used are described in Table 12.2. These data have been obtained from the work of Gebhart et al. [19], based on the average temperature of each temperature interval considered.

Table 12.2 Thermophysical properties

2.3 Experimental Procedure

The experiments were performed in the rectangular test section shown in Fig. 12.2. The inner dimensions of the test section were: 187 mm in height, 187 mm in width, and 200 mm in depth. The top, bottom, and back acrylic walls were 12 mm thick. The observation window (front wall) was constructed with a pair of acrylic sheets 12 mm thick with a 12 mm air gap between them to eliminate condensation. The two copper sidewalls were held at constant temperatures and were 3 mm thick. The copper surfaces were oxidized to avoid corrosion. The inner surfaces of the test section, except the front wall and a slit of the top wall, were painted black to minimize the light beam reflection for photographic observations. The sidewalls were maintained at different temperatures by electrical resistances and circulating fluids coming from thermostatically controlled reservoirs.

Fig. 12.2
figure 2

Semi-assembled test section

A schematic diagram of the experiment apparatus is shown in Fig. 12.3. In this figure, the copper wall is represented by (C), the acrylic wall by (A), the heat exchanger by (E), the insulation by (I), the thermocouples by (Ti), and the resistances by (Ri). The apparatus was insulated with styrofoam to minimize the heat gain from the environment to the experimental apparatus. During the visualization and photographic observations, part of the insulating material was removed. Distilled water was used as the testing fluid to avoid the presence of air bubbles. Four independent and controllable electrical resistances for each copper wall and two multipass copper heat exchangers were used. Omegatherm 201 conductive paste was used to ensure good thermal contact between the electrical resistances and the heat exchangers and the copper wall. The heat exchanger positioned on the side of the hot wall was connected through a valve system to the constant temperature bath. Four 0.5 mm thermocouples equally spaced in the z direction were embedded into each copper wall for continuous monitoring of their temperature. In this way, it was possible to maintain the temperature of the sidewalls uniform within ±0.1 °C of the desired temperature. In order to measure the temperature distribution inside the test section eight 1.0 mm thermocouples were inserted in the back wall through eight holes. They were arranged in two horizontal planes perpendicular to the front and back walls. In this way, two ranks of four evenly spaced thermocouples in the y direction measured the temperatures at two water depths in the z direction. This arrangement minimized heat conduction along the thermocouples and therefore reduced the measurement error. All thermocouples are type k (NiCr-NiAl) sheathed with stainless steel and were calibrated with an accuracy of ±0.1 °C. The thermocouples outputs were recorded by a data acquisition system at preselected time intervals between two consecutive measurements. These reservoirs, which are also called constant temperature baths, were connected to the coolant flow system by rubber tubes, which were insulated by foam pipes. Alcohol was used as the coolant fluid in the constant temperature baths.

Fig. 12.3
figure 3

Schematic diagram of the test section

The experimental case were performed with the cold wall maintained at 0 °C and the hot wall at T H  = 12 °C. This is an important interval to explore the maximum density phenomenon. The water was carefully siphoned into the test section to avoid introduction of air. To obtain the initial configuration of the solid phase of the fluid, it was necessary to freeze the substance with the test section turned 90° to the left before the beginning of the experiment (Fig. 12.4). In this way, the two constant temperature baths were set at low temperatures. After conclusion of the freezing process, the solid was heated up to a temperature close to its fusion point. In this way, the control point temperature was gradually increased and the temperature in the solid was carefully monitored. This heating regime was continued until all the system reached 0 °C. At this moment, the rest of the test section was filled with water at 0 °C. The desired water temperature (0 °C) was obtained by mixing cold water with crushed ice and allowing sufficient time for the equilibrium. The water was carefully siphoned into the test section to avoid introduction of air. The test section was turned 90° back to its original position, as shown by Fig. 12.4. Next, the valve attached to the hot wall was closed and the temperature of the bath connected to the valve was increased. When the temperature bath attained the desired temperature, the valve was reopened and the left wall was heated to T H within 1 and 4 min depending on the T H value. Once the initial conditions were attained, the melting run was started. Thermocouple data were collected at 1-min intervals. The temperature of the sidewalls was maintained constant throughout the data run with the help of the electrical resistances. Since the solid phase occupies a greater volume than the liquid phase, a feed line connected to the top wall was used to fill the test section with water at 0 °C.

Fig. 12.4
figure 4

Initial condition

To visualize the flow patterns, the water was seeded with a small amount of pliolite particles. Pliolite is a solid white resin with a specific gravity of 1.05 g/cm3 that is insoluble in water. These tracer particles of small diameter (<53 μm) are neutrally buoyant. A beam from a 5.0 mW helium-neon laser was used as light source. The laser beam passed through a cylindrical glass rod to produce a sheet of laser light before passing through the test section wall. Photographs of the flow patterns were taken using ASA 100 film (T-Max) and a 35 mm camera. The exposure time was about 60 s, with f = 5.6. Figure 12.5 shows schematically the illumination system. In this figure, the acrylic wall is represented by (A), the removable window by (W) and the insulation by (I).

Fig. 12.5
figure 5

The illumination system

3 Computer Vision Techniques

In order to determine the ice and water volume using the photographs obtained in the experimental procedure, it is necessary to apply a segmentation technique in these images. The target is the segmentation of ice and water areas into two different pixel groups. This process can be so easy to many people, in Fig. 12.6, for instance the separation of ice and water by human vision is very intuitive. However, to perform the segmentation process automatically using Computer Vision techniques it should be well accomplished.

Fig. 12.6
figure 6

Picture of the experiment

A digital image can be considered as an array of N 1 × N 2 elements where 1 ≤ n i  ≤ N i . Therefore, for each position (n 1 , n 2) we have a f(n 1 , n 2) function, which represents the intensity of each pixel illumination (Fig. 12.7). In grayscale images, this function can be 0 ≤ f(n 1 , n 2) ≤ 255.

Fig. 12.7
figure 7

Example of an image representation

Image segmentation is the process of partitioning an image into meaningful parts [2]. Segmentation techniques can be thresholding, boundary detection, or region growing.

In the thresholding process, generally it used the analysis of pixels grayscale frequency (histogram) to determine a threshold (l) parameter (Eq. 12.13). The image result is a new one I(x,y) [20].

$$I(x,y) = \left\{ {\begin{array}{ll} {0,} & {f(x,y) < l} \\ {255,} & {f(x,y) \geq l} \\ \end{array} } \right.$$
(12.13)

This method can achieve good results in images with bimodal histograms (Fig. 12.8), different from the example image histogram shown in Fig. 12.9, where there is no two noticeable picks. In bimodal histograms case, it is simple to choice a threshold parameter l to segment the two different regions in an image. However, the method of amplitude threshold is not a good procedure in many cases, as can be seen in Fig. 12.9. The reason of this bad result is the fact that the luminance isn’t a distinguishable feature for water and ice in this particular example.

Fig. 12.8
figure 8

Bimodal histogram

Fig. 12.9
figure 9

Histogram of Fig. 12.6

The result shown in Fig. 12.10 was obtained by the application of a segmentation technique that uses the smallest value between the two higher picks of the histogram (Fig. 12.9).

Fig. 12.10
figure 10

Binary image

Due to uniformity of the brightness values around the ice in the image and the features inside the water, it was necessary to use a more accurate algorithm to determine the ice and water area in the experiment. Region growing method is not adequate because it forms distinguished regions by combining pixels with similar grayscale intensity. Observing the Fig. 12.6, it can be noted that many small regions could be highlighted. For that reasons, the chosen algorithm used to separate ice and water is a boundary enhancement method.

3.1 Boundary Enhancement Techniques

Boundary enhancement methods use information about the intensity differences between neighboring regions in order to separate these regions [2]. Boundaries or edges are discontinuities of a color or grayscale intensity in an image. These intensity discontinuities can help to identify the physical extensions of objects in a digital image. Figure 12.11 shows four possible schemas of an edge considering a continual one-dimensional domain [21].

Fig. 12.11
figure 11

Edges examples: a Ramp edge, b Step edge, c Line, d Roof edge

The edges generally are characterized by its amplitude and slope angle. A detector algorithm must find the slope midpoint that characterizes the edge. This task would be very simple if the edge slope angle is 90o, called a step edge. However, this inclination is not found in digital images, step edges exist only for synthetic and graphical images. In a real picture, the transition is very irregular.

There are many different methods to enhance an edge in order to segment the different regions in an image. However, each one has different approaches that generate different results, depending on the specificity of the image. Figure 12.12 shows the obtained results considering the application of some edge detector methods (Log, Prewitt, Roberts, Sobel, Zero-Cross).

Fig. 12.12
figure 12

Methods of edge detection: a Log, b Prewitt, c Roberts, d Sobel, e Zero-cross

When different methods are used, many different aspects in images can be found. The algorithms of edge detection can also modify the results when these methods are used to measure objects, as it is the main objective of this chapter.

In a previous work, diverse edge detector methods were evaluated [22]. The aim of this work was to reach the better result in an aperture area calibration, considering edge detection. Thus, six methods for edge enhancement were tested and compared each one with average value of all results. This comparison was carried out through to define if some of the methods are not appropriate for aperture area measurement. We used the following edge enhancement algorithms: Sobel, Prewitt, Roberts, Laplacian, Zero-Crossing, and Canny [23, 24].

The Canny algorithm was considered the best method. With the criteria used in this algorithm, even if the edge has a small slope and amplitude of intensity sufficiently reduced, the Canny method was shown efficient.

3.2 Canny Edge Detector

The objective of this experiment is to determine the area of ice and water in the images. With that purpose an algorithm of edge detection was used. Considering the discrete description of image, several techniques can be used for edge enhancement and detection in digital images. Here, the chosen technique was the Canny method.

John Canny, in 1986, in his paper “the computational Approach to edge detection” described a method for edge detection purpose [25]. In this paper, Canny treats the problem of edge detection establishing suitable criteria, so that one can achieve better results than other known methods.

The first criterion is the called low error rate, which considers that “edges occurrences can’t be discarded and false edges can’t be found.” The second criterion refers to “the distance between the center of the edge and the points in its neighborhood that should be minimized.” The last one was implemented because the first two were not sufficient to eliminate the possibility of multiple results for only one edge. Therefore, the third criterion considers that the algorithm should find only one result for a single edge.

The application of the Canny method is done by steps. The first step is the use of a Gaussian filter. The objective of this filter is to remove undesirable noises and enhance important features. This filter is accomplished by the convolution of the image, using a mask that is different depending on the specific filter.

The convolution operation consists in the application of a bidimensional filter taking into account the image grayscale intensity domain. Each pixel in the original image x(n 1 , n 2) is transformed in a new one y(n 1 , n 2) (Eq. 12.14).

$$y\left( {n_{1} ,n_{2} } \right) = h(n_{1} ,n_{2} ) \otimes x(n_{1} ,n_{2} )\,\, = \sum\limits_{{k_{1} = - \infty }}^{\infty } {\sum\limits_{{k_{2} = - \infty }}^{\infty } {x(k_{1} ,k_{2} )h(n_{1} - k_{1} ,n_{2} - k_{2} )} }$$
(12.14)

The term h represents the convolution mask of the used filter.

In order to implement the filtering of images through convolution, it is necessary to slide a mask (kernel) across the image (Fig. 12.13). The new pixel value y(n 1 , n 2) is the weighted sum of the input pixels x(n 1 , n 2) within the mask where the weights are the values of the filter assigned to every pixel of the window itself [21].

Fig. 12.13
figure 13

Convolution procedure

The choice of convolution mask is done according to the filter and the resolution desired. If the mask is large, the effect of the algorithm will be less observed. On the other hand, when the mask is small we will spend more computational processing.

For the Gaussian filter, its mask is obtained by a discreet Gaussian fit. The Gaussian curve has the characteristic of augment values that are close to the average value and to reduce the intensity values that are far from it. The Gaussian curve width is measured considering the number of standard deviations.The Gaussian curve equation is given by:

$$g_{\sigma } (x) = \frac{1}{{\sqrt {2\pi \sigma } }}{\text{e}}^{{\frac{{ - x^{2} }}{{2\sigma^{2} }}}}$$
(12.15)

To use this equation in image processing, it is necessary to generalize the Gaussian curve into a two-dimensional space.

$$G(x,y) = \frac{1}{{2\pi \sigma_{x} \sigma_{y} }}{\text{e}}^{{\frac{{ - x^{2} }}{{2\sigma_{x}^{2} }} + \frac{{ - y^{2} }}{{2\sigma_{y}^{2} }}}}$$
(12.16)

where σ is the standard deviation and the points (x, y) correspond to the distance between the coordinates and the mask center. For the application of this chapter, we used a 7 × 7 dimension mask with a standard deviation equal to σ = 1, 4.

$$\frac{1}{115} \cdot \left[ {\begin{array}{*{20}c} 2 & 4 & 5 & 4 & 2 \\ 4 & 9 & {12} & 9 & 4 \\ 5 & {12} & {15} & {12} & 5 \\ 4 & 9 & {12} & 9 & 4 \\ 2 & 4 & 5 & 4 & 2 \\ \end{array} } \right]$$
(12.17)

The second step of the algorithm consists in determining the edge magnitude from the gradient of the image. It can be found using a Sobel operator. This method uses two 3 × 3 masks that approximate the derivatives of the image, for direction x and direction y.

$$\begin{aligned} &\left[{\begin{array}{*{20}c} { - 1} & 0 & 1 \\ { - 2} & 0 & 2 \\ { - 1} & 0 & 1 \\ \end{array}}\right]\, \left[ {\begin{array}{*{20}c} 1 & 2 & 1 \\ 0 & 0 & 0 \\ { - 1} & { - 2} & { - 1} \\ \end{array} } \right] \\ &\quad\quad Gx \quad\quad\quad\quad Gy \end{aligned}$$
(12.18)

Using the obtained results from both directions, the gradient of the image can be calculated (Eq. 12.19).

$$G = \sqrt {G_{x}^{2} + G_{y}^{2} }$$
(12.19)

The next step is to determine the edge directions in the image. Using the values of the gradient and Eq. 12.20, we can determine these directions.

$$\theta = a\tan \left( {\frac{{G_{y} }}{{G_{x} }}} \right)$$
(12.20)

When the algorithm is implemented we must consider the cases where Gx is equal to 0. In this case, we will generate a mathematical error. Therefore, in these points the algorithm must analyze the gradient in Gy direction in order to decide which is the edge direction (0°, 45°, 90°, 135°).

Then the algorithm realizes a suppression process. This process consists in analyze, using a 3 × 3 matrix, all the points in all obtained directions calculating their gradient angle. We will consider as an edge only the points that have higher grayscale intensity than their correspondent neighbors in the opposite directions.

Finally, to find the edges, the image is analyzed using two threshold points, a high and a low one. When a pixel is greater than the high threshold value, its neighbor pixels need to have higher values than the low threshold point, in order to generate a continuous edge.

3.3 Image Processing Results

The Canny method was applied in five images of the experiment presented in Sect. 2.2. To reduce the possibilities of error in this algorithm and to obtain more efficient computational results, the images had been divided into two parts, because in this experiment the space occupied by the ice wasn’t higher than 50 % of the total reservoir area (Fig. 12.14).

Fig. 12.14
figure 14

Images cropped to apply the Canny method

The results of Canny method in the images are shown in Fig. 12.15.

Fig. 12.15
figure 15

Results of Canny method

Applying the algorithm, it is possible to separate completely water and ice in each image. These images are used as masks in the original images (Fig. 12.16). The final result consists in the distinguished ice (white) and water (black) pixels in each image.

Fig. 12.16
figure 16

Ice and water areas

After that it is possible to determine ice and water area, performing the sum of the white and black pixels, respectively. Considering the reservoir dimensions and the picture resolution, we calculate the volume of the solid and liquid state.

4 Results and Discussions

The photographs of the evolution of the melting front produced by the experimental procedure are shown in Fig. 12.17, and the isotherms and the evolution of the melting front produced by the numerical procedure are shown in Fig. 12.18.

Fig. 12.17
figure 17

Photographs of the evolution of the melting front produced by the experimental procedure

Fig. 12.18
figure 18

Isotherms and the evolution of the melting front produced by the numerical procedure

The experimental and numerical tests show that the influence of the maximum density is evident. The counterclockwise cell is close to the cold wall and the clockwise cell is close to the hot wall. As the isothermal values of the dominant cell are greater than T M , the melting front advances faster at the top of the cavity. The incidence of the heated fluid normal to the interface is responsible for the accelerated melting of ice at this point. These figures show a good qualitative agreement on the evolution of shape of the melting front.

The evolution of the liquid fraction (melted fraction) of the experiment is shown in Fig. 12.19. The melted fraction is the ratio of the liquid volume to the total volume of the enclosure. In the beginning of the process there were 50 % of liquid in the cavity, as the initial condition established previously. The results show a linear evolution of the melted fraction. There is a good agreement among the numeric and experimental results, obtained by the images processing, although it can be noted that the experimental points are clearly below the curve obtained by the numeric procedure. That is, for the same time, the melting front in the numeric simulation moves faster than for the experiments.

Fig. 12.19
figure 19

Liquid fraction

5 Conclusions

The most significant changes and improvements in scientific measurements are due to the development of measuring methods with higher accuracy results and lower uncertainties. Most researchers have developed and improved methods and systems of noncontact measurement, where all steps in the procedure use Computer Vision techniques [22].

Following this trend, we proposed to evaluate some Computer Vision techniques to support the experimental analysis of a melting problem with natural convection. The complete knowledge of experimental results is very important for the understanding of the complex phenomenon that involves moving boundary problems. Systems that can extract information from digital images help in the validation of numerical and experimental results, and provide a better understanding of the phenomenon under study. The results of this study can be applied in energy storage systems and other engineering applications. The experiments consider two water volumes in the solid and liquid states. The objective is to analyze the behavior of the moving interface and the evolution of the liquid fraction.

The problem was solved using image segmentation, which is the most studied topic in image analysis. Considering that there is not a universal method to segment all images [2], the aim of this study is unique.

The results using Computer Vision techniques to extract the ice and water volume obtained during the experimental procedure matched the values obtained in the numerical modeling. Given the uncertainties of the measurement process and experimental procedure, the final results are considered very satisfactory.

The segmentation algorithm used gave a better definition for the edges, reducing the number of incorrect values in the enhancement of the ice-water interface.