**1. Introduction**

An emulsion can be defined as a system consisting of two immiscible liquids, in which one of the liquids is dispersed as small spherical droplets in the other liquid [1]. The size and distribution of droplets depend upon the energy input and temperature during homogenization, the characteristics and ratios of the two phases (dispersed and continuous), and the type and concentration of the emulsifier [2]. It is well known that the size and distribution of droplets have a great impact on emulsion stability, optical properties, rheology, and sensorial characteristics [1]. The distribution of droplets in emulsion systems can be monodispersed or polydispersed. If all droplets in an emulsion are the same size, the emulsion is referred to as "monodisperse" and can be characterized by the size of a single droplet (the radius or diameter of the droplet). However, the vast majority of emulsions, such as food emulsions, are polydisperse systems containing droplets with a range of different sizes. Therefore, they should be characterized by the particle or droplet size distribution, which represents the concentration of droplets in different size classes [1]. The droplet size distribution of an emulsion is one of the important factors that control aggregation, coalescence, and resistance to sedimentation or creaming. The size distribution can also be used as a representative of stability if measured as a function of

**Citation:** Salum, P.; Güven, O.; Aydemir, L.Y.; Erbay, Z. Microscopy-Assisted Digital Image Analysis with Trainable Weka Segmentation (TWS) for Emulsion Droplet Size Determination. *Coatings* **2022**, *12*, 364. https://doi.org/ 10.3390/coatings12030364

Academic Editor: Eduardo Guzmán

Received: 16 February 2022 Accepted: 7 March 2022 Published: 9 March 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

time. It is well known that the smaller and more uniform the droplets, the more stable the emulsions, provided that all other conditions are the same [3]. Therefore, determining the size distribution of the droplets in the continuous phase in a precise and accurate manner is essential for studies in emulsion science.

In the literature, considerable work has been carried out for the development of analytical techniques to obtain information about the droplet size distribution, such as light scattering, electrical conductivity, acoustics/electroacoustics, near-infrared spectroscopy, nuclear magnetic resonance, and various kinds of microscopic measurements (optical microscopy, transmission electron microscopy, and scanning electron microscopy) [4–7]. Several particle size analyzers have been designed and are commercially available for the determination of particle size distribution based on several physical principles, such as the scattering of light, the velocity of particles in a field, scattering, or absorption of ultrasonic waves [1,4]. In general, these analyzers are automated, rapid, and reliable systems with high installation costs. On the other hand, among all of these measurement techniques, microscopic measurement methods differ from other techniques, as they rely directly on the visual measurement of droplets [3]. Optical microscopy stands out in particular, as it is an inexpensive, relatively easy-to-use instrument available in most laboratories. However, droplet size determination by optical microscopy is generally time-consuming and laborious [3,4,6,8,9]. These weaknesses of microscopic analysis techniques become especially apparent when considering the necessity of observing thousands of droplets and quantifying their sizes to obtain meaningful results in droplet size distribution analysis.

Optical microscopes can be coupled with a digital camera, and in this way, images can be recorded and digitalized. It is possible to utilize these digitalized data with the aid of image processing techniques to reduce the time and workload required for the analysis [10]. Microscopy and image processing techniques have been used in combination to determine the droplet size distribution of emulsions [2,3,10–12]. Jokela et al. (1990) used a computerized microscope image analysis technique to determine the droplet size distribution of an oil-in-water emulsion [10]. The threshold method was used for the discrimination of droplets from the background. They found that the computerized microscope image analysis results were satisfactory and in agreement with "Coulter counting" and "laser diffraction" methods. Moradi et al. (2011) used optical microscopy and image analysis to determine the droplet size distribution of water-in-crude oil emulsions by using image enhancement techniques. They noted that applying general enhancement techniques such as brightness and contrast adjustment, sharpening, and open filters improved the detection of droplets [3]. Maaref and Ayatollahi (2018) also utilized some of the general enhancement techniques, including brightness, smoothing, and sharpening, for distinguishing emulsion droplets from the surroundings to evaluate the droplet size distribution of water-in-oil emulsions [11].

Digital image analysis with the assistance of microscopy consists of four basic steps: (i) image acquisition, (ii) image restoration, (iii) segmentation and filtering, and (iv) measurement [13]. First, the appropriate image is transferred from the microscope to the computer via the image transmitter and a Charge-Coupled Device (CCD) or Complementary Metal-Oxide-Semiconductor (CMOS) camera. In this step, proper focusing is crucial, as the droplets should not have overlapping structures and should not cause any disturbances during the analysis [3]. After image acquisition, imaging defects, noise, or disturbances can be reduced, and the brightness and contrast of the images can also be adjusted. Then, segmentation and filtering processes are performed [13]. After the segmentation is completed and the images are converted to binary form, particle size analysis is performed. In addition, obtaining reproducible, highly accurate results that reflect the sample requires creating a protocol to perform as much automated or semi-automated particle size analysis as possible. Moreover, an adequate number of droplets representing the system are necessary to conduct a meaningful statistical analysis. Moradi et al. (2011) reported that reliable results that guarantee convergence of the distribution were produced with 2000 or more droplets [3].

The other challenge is the poor contrast between components of emulsions. Hu et al. (2018) stated that this could be due to the close refractive indices of water and oil, which are the two major components of the emulsions, under an optical microscope. This can cause difficulties in segmentation during the image analysis of emulsions [8]. Although visual separation of water and oil phases is possible with the use of dyes, there are limitations, as they show interfacial activity and change the physical properties (pH, electrical conductivity, density, etc.) that have an impact on the emulsion character [1,14]. Most traditional segmentation methods rely on the density and spatial relationships of pixels or constrained patterns, such as pixel-based, edge-based, texture-based, or region-based methods. Each of these methods has various advantages and disadvantages. Compliance with the subsequent processing and the obtained dataset can only be achieved by determining the threshold appropriately. As a result, the application of these techniques is not suitable for all situations. However, machine learning techniques overcome the problem based on the manual calibration of parameters by applying optimization techniques to a given set of training images [15]. Therefore, in recent years, the use of trainable machine learning methods, which enable more dynamic and accurate results to be obtained, has come to the fore [16,17]. The Trainable Weka Segmentation (TWS) is one of the plugins of Fiji, which is an open-source image processing package based on ImageJ [16,18]. It uses Waikato Environment for Knowledge Analysis, which was developed at Waikato University in New Zealand, for data mining tasks [16,19]. It is a combination of image segmentation and machine learning algorithms [17].

This study aimed to develop a protocol for the determination of droplet size of an emulsion with a microscopy-assisted digital image analysis technique using TWS for the segmentation step. For this purpose, emulsions (O/W) were prepared with different oil/water phase ratios and homogenization times, and their droplet size parameters were determined. For verification of the method, instrumental measurements of the same emulsion samples were also performed with the laser diffraction method and the results were compared. Moreover, the relationships between the droplet size and the physical properties of emulsions (turbidity and viscosity) were investigated. To the best of the authors' knowledge, this is the first time in the literature that TWS was used for the segmentation of emulsion oil droplets from the background in digital image analysis of emulsion micrographs.
