Computer Vision Method in Beer Quality Evaluation—A Review

Beers are differentiated mainly according to their visual appearance and their fermentation process. The main quality characteristics of beer are appearance, aroma, flavor, and mouthfeel. Important visual attributes of beer are foam appearance (volume and persistence), as well as the color and clarity. To replace manual inspection, automatic, objective, rapid and repeatable external quality inspection systems, such as computer vision, are becoming very important and necessary. Computer vision is a non-contact optical technique, suitable for the non-destructive evaluation of the food product quality. Currently, the main application of computer vision occurs in automated inspection and measurement, allowing manufacturers to keep control of product quality. This paper presents an overview of the applications and the latest achievements of the computer vision methods in determining the external quality attributes of beer.


Introduction
Beer is one of the oldest (low) alcoholic beverages in the world and the third most widely-consumed drink (after water and tea). Today, besides industrial commercial beers, craft beer has gained great popularity among consumers [1]. Beer is produced in a brewing process from malt, water, brewer's yeast, and hops. The basic quality characteristics of beer are divided into visual and sensory attributes. Appearance is the first attribute that consumer experiences (and evaluates) when he/she gets a glass of beer. Important visual characteristics of beer are foam appearance (volume and persistence), as well as color and clarity of the beer. Perception and acceptability of beer are also determined by other properties e.g., the alcohol content (expressed as Alcohol by volume, ABV or Alcohol by weight, ABW), carbon dioxide content, the presence/absence of off-flavors in bottled beer [2][3][4], aroma, mouthfeel and bitterness (listed in International Bitterness Units, or IBUs).
The main collections of the standard methods of beer analysis used worldwide are methods of the Institute of Brewing and Distilling (IBD), American Society of Brewing Chemists (ASBC), European Brewery Convention (EBC), and Central European Commission for Brewing Analysis (MEBAK). Beers are differentiated mainly according to their visual appearance (depends on its color and turbidity) and their fermentation process. Regarding the yeast used and the fermentation temperature, beer can be categorized in the three main categories: top-fermented (ale), bottom-fermented (lager), and naturally fermented beer. Beer classification can be done regarding the color during the production process. Beer color is determined by the malt color that develops during the Maillard reactions and CVS can measure the external features of products, recognize objects and extract quantitative information from digital images [15]. Currently, the main application of CVS occurs in the automated inspection providing constant control of product quality. Configuration of CVS is relatively standard, basic components are illumination device (lights), a device for image acquisition (digital camera/scanner), frame grabber (in the case of an analog camera), and computer hardware and software (algorithms for image analyzing and pre-processing) [16,17]. CVS can measure the external features of products, recognize objects and extract quantitative information from digital images [15]. Currently, the main application of CVS occurs in the automated inspection providing constant control of product quality. Configuration of CVS is relatively standard, basic components are illumination device (lights), a device for image acquisition (digital Beverages 2019, 5, 38 3 of 21 camera/scanner), frame grabber (in the case of an analog camera), and computer hardware and software (algorithms for image analyzing and pre-processing) [16,17].

Illumination
With the camera, one of the most important elements of the CVS system is the illumination. The illumination device is used for object illumination under test. There are many properties of illumination (light angle of incidence, light source color, direct/diffuse light technique), which must be selected in such a way to reduce disturbances (shadows, reflections, noise) or enhance image contrast [14,18,19]. Suitable illumination increases the quality of captured images and improves the accuracy of the analysis. There are several simple rules and good practices that can help select the proper illumination and improve the image quality: • maximizing the contrast of the features that must be inspected or measured • minimizing the contrast of the features of no interest • getting rid of unwanted variations caused by ambient light and differences between items that are non-relevant to the inspection task.
To view an object, it is necessary for it to be illuminated by a light source. The color perception of an object depends on the color of the light source and the color of the surface. Considering the color, we distinguish these light colors: red, green, blue, white with particular color temperature, infrared, and ultraviolet. Light sources may be either natural (sunlight) or artificial (incandescent, halogen, fluorescent, compact fluorescent, LED, metal halide, Xenon, High Pressure Sodium, lasers, and infrared lamps) [20][21][22][23]. The most suitable illumination is defined by its position, sources type, geometry and color [14,19]. The term "light source" implies any object that emits energy in the visible spectrum (380-750 nm). Sunlight is one example of the light source, but is not suitable for colorimetric characterization because its quality and energy may vary during the day. To provide reliable colorimetric characterization CIE establishes illuminants upon binding standards (relative energy versus wavelength).
All illuminants are compared against the color temperature, which is described as the spectral energy distribution of the ideal blackbody radiator that radiates light with a specific color at defined temperatures in kelvin (K). Color temperature for an incandescent lamp (~100 W) is 2800 K, for halogen lamp 3000-3200 K, for the fluorescent lamp (cold white) 4000 K, for Xenon and metal halide lamp 4500-5000 K, for warm white LED lamp is 2700-3000 K, and cold white LED lamp 5000-5500 K [20,24].
According to the CIE, we distinguish several illuminants like: Several parameters should be considered when deciding on a selection of illuminant source: characteristic of the object surface (whether the object is absorptive, transmissive or reflective), the object geometry (curved of flat), and object/background contrast (translucent objects are usually illuminated with backlight). When an object is illuminated, the incident light is partly ( Figure 2): • reflected and/or • transmitted and/or • absorbed and/or • strayed.
Type of the effect that will occur, depends on the object surface (opaque, semi-transparent or translucent, glossy or matt). Because of that, the position of a light source is very important. When the Beverages 2019, 5, 38 4 of 21 object surface is glossy, the light is reflected from the object surface at an angle of incidence. If surface is opaque, semi-transparent or translucent, the light is transmitted (penetrates through the object) or it can be polarized or diffracted at the object surface. Usually one of these effects never appears alone, but it is always a combination of several effects.
Due to a different object geometry, there are the three common lighting geometries: the point lighting for flat objects, the diffuse lighting for challenging reflective 3-D objects, and collimated lighting (laser light) [10,22]. Due to a different object geometry, there are the three common lighting geometries: the point lighting for flat objects, the diffuse lighting for challenging reflective 3-D objects, and collimated lighting (laser light) [10,22]. Regarding the angle of incidence of the illumination (angle between light source, object and camera), there are several illumination techniques [14]:  lateral light at angles-at angles from one side or all around;  shallowly-illumination at a shallow angle from all sides: dark field illumination (usually uses a low angle ring light that is mounted very close to the object where the light rays from the light source are not reflected into the camera lens, but only a proportion of light that is scattered by an uneven surface);  backlighting-transmitted light from the opposite side of the object (backlit image);  collimated lighting-laser light (Figures 3-8). Regarding the angle of incidence of the illumination (angle between light source, object and camera), there are several illumination techniques [14]: • direct incident light (front light) vertical illumination from above, ring illumination, angular illumination; • incident lighting with a diffuser flat, coaxial, dome-shaped; • lateral light at angles-at angles from one side or all around; • shallowly-illumination at a shallow angle from all sides: dark field illumination (usually uses a low angle ring light that is mounted very close to the object where the light rays from the light source are not reflected into the camera lens, but only a proportion of light that is scattered by an uneven surface); • backlighting-transmitted light from the opposite side of the object (backlit image); • collimated lighting-laser light (Figures 3-8).

Image Acquisition Devices
Image acquisition encompasses images capturing, with digital camera or scanner. There are three basic elements in image capturing: energy, the lens (optical system) and the sensor. Electronic capturing of the image with camera and frame grabber is the first step in the processing of the digital image. Photons are converted to electrical signals with a camera, and these signals are digitalized with the frame grabber [18]. The frame grabber is required for the transformation of analog to digital signal when analog cameras are used [25]. Usually, only three channels are used by camera (i.e., R, G, B), but when higher accuracy and extended information is required, more channels can be used.
The basic parameters ( Figure 9) of an imaging system are: Working Distance (WD)-the distance between the lens front and the inspected object;

Image Acquisition Devices
Image acquisition encompasses images capturing, with digital camera or scanner. There are three basic elements in image capturing: energy, the lens (optical system) and the sensor. Electronic capturing of the image with camera and frame grabber is the first step in the processing of the digital image. Photons are converted to electrical signals with a camera, and these signals are digitalized with the frame grabber [18]. The frame grabber is required for the transformation of analog to digital signal when analog cameras are used [25]. Usually, only three channels are used by camera (i.e., R, G, B), but when higher accuracy and extended information is required, more channels can be used.
The basic parameters ( Figure 9) of an imaging system are:  Field of View (FOV)-visible object area photographed;  Working Distance (WD)-the distance between the lens front and the inspected object;

Image Acquisition Devices
Image acquisition encompasses images capturing, with digital camera or scanner. There are three basic elements in image capturing: energy, the lens (optical system) and the sensor. Electronic capturing of the image with camera and frame grabber is the first step in the processing of the digital image. Photons are converted to electrical signals with a camera, and these signals are digitalized with the frame grabber [18]. The frame grabber is required for the transformation of analog to digital signal when analog cameras are used [25]. Usually, only three channels are used by camera (i.e., R, G, B), but when higher accuracy and extended information is required, more channels can be used.
The basic parameters ( Figure 9) of an imaging system are: • Field of View (FOV)-visible object area photographed; • Working Distance (WD)-the distance between the lens front and the inspected object;  There are a wide range of digital camera capabilities, and consequently, of sizes and prices ( Table  1). The most commonly used camera sensors are charged coupled device (CCD) and complementary metal-oxide semiconductor (CMOS) [26]. In a CCD camera, radiation energy (proportional to light exposure) is converted to an electrical signal using of mass photodiodes. These cameras provide good system differentiation and flexibility for various applications (industrial imaging, digital photography, scientific and medical research, etc.). A CMOS camera is more sensitive than a CCD camera, and has a greater dynamic range with very fast signal transferring. They are suitable for industrial use for on-line product inspection, and for all other applications where there is no need for high image quality (wireless video devices, video conferencing, toys, bar-code scanners, etc.) [26].
Scanners are usually used for specialized tasks and specific use (extreme resolution, large numbers of output channels or extreme wavelengths). Qualifying specification parameters for a scanner are bit (color) depth, resolution, and dynamic range. The scanner's bit-depth defines the amount of color information in the image. Accuracy increases with higher depths (4-bit with 16, 8-bit with 256, 24-bit with almost 17 million tones, etc.). Resolution is expressed in dots per inch (dpi) and determines the number of details in the image. Dynamic range is a measure of scanner ability to distinguish image colors and tones. It is similar to image depth and it ranges from perfect white (0.0) to black (4.0) [20]. There are a wide range of digital camera capabilities, and consequently, of sizes and prices ( Table 1). The most commonly used camera sensors are charged coupled device (CCD) and complementary metal-oxide semiconductor (CMOS) [26]. In a CCD camera, radiation energy (proportional to light exposure) is converted to an electrical signal using of mass photodiodes. These cameras provide good system differentiation and flexibility for various applications (industrial imaging, digital photography, scientific and medical research, etc.). A CMOS camera is more sensitive than a CCD camera, and has a greater dynamic range with very fast signal transferring. They are suitable for industrial use for on-line product inspection, and for all other applications where there is no need for high image quality (wireless video devices, video conferencing, toys, bar-code scanners, etc.) [26].
Scanners are usually used for specialized tasks and specific use (extreme resolution, large numbers of output channels or extreme wavelengths). Qualifying specification parameters for a scanner are bit (color) depth, resolution, and dynamic range. The scanner's bit-depth defines the amount of color information in the image. Accuracy increases with higher depths (4-bit with 16, 8-bit with 256, 24-bit with almost 17 million tones, etc.). Resolution is expressed in dots per inch (dpi) and determines the number of details in the image. Dynamic range is a measure of scanner ability to distinguish image colors and tones. It is similar to image depth and it ranges from perfect white (0.0) to black (4.0) [20].

Hardware and Supplied Software
Furthermore, important components of CSV are computer hardware and software, providing storage space for images and computing capacity with specific software applications. Visualization of images and results of the image analysis process, are enhanced by high-resolution monitors [16,[27][28][29].

Digital Image Analysis
Image capturing (acquisition), processing and analysis are operations included in the computer vision system ( Figure 10). The role of image processing is to obtain an image with enhanced quality and to decrease various defects such as noise, distortion, improper lighting and focus, and errors caused by camera movement. Image analysis separates the region of interest (ROI) from the background is then used to obtain quantitative information about the analyzed object. There are several steps in image processing and analysis. The first step is image acquisition and pre-processing of the image to improve its quality (correction of contrast, blur, distortions etc.). Second processing step includes image segmentation (thresholding), representation and description [28]. In the last step, different statistical tools are used to recognize and interpret information obtained from the object image [30].

Digital Image Analysis
Image capturing (acquisition), processing and analysis are operations included in the computer vision system (Figure 10). The role of image processing is to obtain an image with enhanced quality and to decrease various defects such as noise, distortion, improper lighting and focus, and errors caused by camera movement. Image analysis separates the region of interest (ROI) from the background is then used to obtain quantitative information about the analyzed object. There are several steps in image processing and analysis. The first step is image acquisition and pre-processing of the image to improve its quality (correction of contrast, blur, distortions etc.). Second processing step includes image segmentation (thresholding), representation and description [28]. In the last step, different statistical tools are used to recognize and interpret information obtained from the object image [30].

Perception and Measuring of Beer Color
Each beer style has a range of acceptable colors. The actual color of each beer is nothing more than gradations of a brown tone, which decreases in concentration through red, copper, and amber colors, through to golden yellow and light yellow. The brewer's ability to predict and control beer color, as one of the three visual attributes which influence beer appearance, is very important. Consumers have a habit associating the beer color with the flavor, and according to the color, to determine which type it belongs, to lager, ale or stout [31]. Consumers expect consistently high-quality standards of foods and beverages, and color loss will be perceived as a sign of quality reduction. They have high requirements in terms of external product quality (appearance, shape, color), so the food industry has the task of providing efficient systems for continuous monitoring of the product's color during the production and storage [12].
The color of the beer comes from malted barley, and wort production. Substances responsible for beer color (melanoidin, polyphenols, trace metals like copper and iron, riboflavin, caramel) are formed during several different chemical reactions [32][33][34]. Melanoidins are water soluble pigments whose color changes from initially yellow to dark brown [35]. During the kilning process, when the temperature is greater than 95 °C, a Maillard reaction takes place and produces color and aroma components from sugars and amino acids. Caramelization reactions take place at temperatures above 120 °C, and are affected by pH and the type of sugar [36]. At the temperature above 200 °C, pyrolysis reaction occurs and black pigments are produced in the brewing process.
Through history, numerous techniques of color determination of malt and beer have been

Perception and Measuring of Beer Color
Each beer style has a range of acceptable colors. The actual color of each beer is nothing more than gradations of a brown tone, which decreases in concentration through red, copper, and amber colors, through to golden yellow and light yellow. The brewer's ability to predict and control beer color, as one of the three visual attributes which influence beer appearance, is very important. Consumers have a habit associating the beer color with the flavor, and according to the color, to determine which type it belongs, to lager, ale or stout [31]. Consumers expect consistently high-quality standards of foods and beverages, and color loss will be perceived as a sign of quality reduction. They have high requirements in terms of external product quality (appearance, shape, color), so the food industry has the task of providing efficient systems for continuous monitoring of the product's color during the production and storage [12].
The color of the beer comes from malted barley, and wort production. Substances responsible for beer color (melanoidin, polyphenols, trace metals like copper and iron, riboflavin, caramel) are formed during several different chemical reactions [32][33][34]. Melanoidins are water soluble pigments whose color changes from initially yellow to dark brown [35]. During the kilning process, when the temperature is greater than 95 • C, a Maillard reaction takes place and produces color and aroma components from sugars and amino acids. Caramelization reactions take place at temperatures above 120 • C, and are affected by pH and the type of sugar [36]. At the temperature above 200 • C, pyrolysis reaction occurs and black pigments are produced in the brewing process.
Through history, numerous techniques of color determination of malt and beer have been developed. Grading techniques are based on a comparison of the color standards with the product color. The color is expressed using several scales according to Lovibond ( • L), European Brewery Convention color scheme (EBC) [37] or Standard Reference Method (SRM) (Figure 11). A scale for the beer color expression is determined by the used method of color measurement. The first method used to determine the color of beer was the visual comparison method, where beer color is expressed in degrees Lovibond. J.W. Lovibond developed this method in 1893, which was then adopted by Bishop in 1950. The method is quantitative and based on subjective estimation of beer color by visual comparison of beer samples with colored glass discs references. After improving, the European Brewery convention accepted the visual comparison method and the color of malt, wort and beer are expressed in EBC units [31]. In the US, the color of malt is commonly expressed in • L while SRM scale is used for estimation of the beer color. However, visual comparison method ha weaknesses, because it is subjective (based on visual comparison of color sample and reference with the human eye). Because of this disadvantage, new instrumental methods for beer color assessment are developed (spectrophotometric and tristimulus method). That group of methods is independent of the observers, and allow an objective assessment of beer color. In the tristimulus method, light reflected from the sample is separated through the filters into three color channels corresponding to the human eye vision and captured by sensors. Several color systems have been proposed to describe a color as a tristimulus value of individual intensities of red, green and blue [38]. There are many different color systems like Lovibond RYBN color, The Munsell Scale, CIE color system (CIELab, CIELCh, CIEXYZ), RGB color system. The spectrophotometric method uses multiple sensors to measure spectral transmittance or reflectance in a visible light spectrum range (380-740 nm).
Currently, the color of beer and wort is expressed in EBC scale, and North America is an exception where the color is expressed in a SRM scale. The American Society of Brewing Chemists (ASBC) has developed a method for beer color determination by spectrophotometer, called the Standard Reference Method (SRM). The SRM method is based on an absorbance measurement, where the beer color is expressed as a quantity of absorbed light at a wavelength of 430 nm in a 10 mm quartz cuvette against water as a reference [39].
where, D = dilution factor of the sample and A 430 = the light absorbance at 430 nm in a 1 cm cuvette. Based on spectrophotometry, the European Brewing Convention (EBC) system has developed a similar method in Europe. The simple equation is used to calculate beer color in EBC units: where, D present dilution factor of the sample, A 430 present absorbance of the beer at a wavelength of 430 nm in a 1 cm cuvette. Since EBC and ASBC measurements are based on absorbance at 430 nm, conversion can be made by simply adjusting for the differences in path length and multiplicative factors by the following equation: For both methods, it is important that the beer sample have no turbidity during color measurement. Otherwise, if turbidity is greater than 1 EBC unit, the sample needs to be filtered or centrifuged.
The values of the EBC color scale are approximately 2 times higher than the values of the SRM scale. There are also darker beers whose color is out of the scale and difficult to detect; such samples have to be diluted when measuring [40]. Photometry can be used for color determination of beer and malt [9], and color can be expressed with a tristimulus CIELab color model, were L is the lightness component, a refers to the degree of the red and green, and b to the degree of the blue and yellow color. Lightness (L value) is strongly correlated with the conventional EBC scores [41]. To replace the conventional visual color assessment a novel, computer vision system (CVS) has been developed [24]. CVS enables the non-destructive, contactless, fast, automated, objective, and repeatable color measurement of different food products. It is based on the analysis of each pixel on a captured photo (covering the entire sample), which makes it objective and precise as a method [42,43].
Various methods have been developed for the characterization of different beer types. Silva et al. [44] investigated computer vision method and digital image analysis as an alternative method for color classification of Brazilian pale lager beers. Beer samples are scanned in Petri dishes, and digital image analysis was applied for pattern recognition of beers. After applying digital image analysis, results were presented as color histograms in RGB color space for each brand of Brazilian pale lager beer. Along with conventional analytical methods of color determination, digital image analysis has been demonstrated to be a suitable method for classifying beer of the same type or category. Nikolova et al. [45] reported the use of digital image analysis and spectrophotometer for beer type classification according to their color. For this purpose, several beer samples were chosen to obtain digital images: light beer, dark beer, a beer with lemon and beer with fruits. Cluster analysis was applied to a group of similar beer samples. Beer samples were photographed with a CCD camera in a BMP format. After pre-processing of the image, obtained results were presented as RGB values, and later transformed Photometry can be used for color determination of beer and malt [9], and color can be expressed with a tristimulus CIELab color model, were L is the lightness component, a refers to the degree of the red and green, and b to the degree of the blue and yellow color. Lightness (L value) is strongly correlated with the conventional EBC scores [41]. To replace the conventional visual color assessment a novel, computer vision system (CVS) has been developed [24]. CVS enables the non-destructive, contactless, fast, automated, objective, and repeatable color measurement of different food products. It is based on the analysis of each pixel on a captured photo (covering the entire sample), which makes it objective and precise as a method [42,43].
Various methods have been developed for the characterization of different beer types. Silva et al. [44] investigated computer vision method and digital image analysis as an alternative method for color classification of Brazilian pale lager beers. Beer samples are scanned in Petri dishes, and digital image analysis was applied for pattern recognition of beers. After applying digital image analysis, results were presented as color histograms in RGB color space for each brand of Brazilian pale lager beer. Along with conventional analytical methods of color determination, digital image analysis has been demonstrated to be a suitable method for classifying beer of the same type or category. Nikolova et al. [45] reported the use of digital image analysis and spectrophotometer for beer type classification according to their color. For this purpose, several beer samples were chosen to obtain digital images: light beer, dark beer, a beer with lemon and beer with fruits. Cluster analysis was applied to a group of similar beer samples. Beer samples were photographed with a CCD camera in a BMP format. After pre-processing of the image, obtained results were presented as RGB values, and later transformed into the CIELab values. The beer color determined by the image analysis corresponds to the color results measured by the spectrophotometer. Therefore, computer vision and digital image analysis proved capable color-based method in classifying beer.

Bubble Size Distribution and Nucleation in Beer
Bubble haze arises in the beer during dispensing beer into the glass (creating an illusion of haze), as a result of a large number of microbubbles which are formed during bubble nucleation. Formed microbubbles do not go immediately to its surface, thus contributing to the effect of the beer bubble haze, and are responsible for the formation of the foam ring on the top of the liquid surface. Bubble haze is an important beer quality parameter and can be preferred by the consumers. For the brewing industry, it is essential to measure beer bubble haze during beer dispense, as one of the product quality indicators. Furthermore, it is very important to determine and control the bubble size in beer haze because their size directly affects the distribution of flavor and taste of beer. Bubbles collect at the top of the glass in a foam called "head". A beer perceived as flat showed little nucleation activity (bubbling) in the glass, regardless of its normal CO 2 content. Also, active bubbling regenerates the head [46][47][48].
Several methods can measure the frequency of bubble formation, their size and distribution in supersaturated beer liquid. Saxena et al. [49] categorized these methods into three groups: • Image (photographic) analysis methods-analysis of the captured images of bubbles; • Optical probe methods-analysis of the bubble penetration length in the area of intensive bubbles migration; • Electrical conductivity (resistivity) probe methods-analysis of the bubble volume with ultrasound/isokinetic sampling probes.
A digital balance can be used for the estimation of gas loss (measuring the mass loss of the beer glass) over time, to quantify the degree of nucleation activity. The nucleation activity also can be performed visually, observing the reduction in the number of bubbles occurring in beer glass over time. This method is one of the first to be reported for observing the nucleation activity in beer. This method has many faults, is long-lasting, requires a lot of time and is not precise and objective [50]. Lubetkin and Blackwell [51] developed a method for quantification of the nucleation activity using sound data recorded with a microphone and computer at the surface of the liquid. After recording, the sound data were analyzed and the frequency of the bubble rupturing is determined. In this method, the nucleation activity is observed by measuring the sound of rupturing bubbles. This method also has limitations in the application since the beer is the system with foam-forming nature. Image analysis method can also be used for measuring the bubble rate formation in beer. This method is based on image analysis of the photographed bubbles in beer glass during the time. Liger-Belair et al. [52] reported the use of an image analysis method for investigation of the bubble formation in Champagne. They used stroboscopic light and digital camera for image capturing. In this study, the authors reported that the image analysis method could be used to measure numerous parameters of bubble formation: bubble formation frequency, growth rates, and bubbles rising velocities in the liquid.
Hepworth et al. [53][54][55] made several studies of using computer vision method and image analysis to monitor bubble haze in beer and to investigate the influence of numerous process parameters on bubble haze formation and distribution in beer glass during beer dispense. Hepworth et al. [55] tried to explain the phenomenon of bubble haze in beer more closely in the general aim to predict their presence or absence, and to understand how process parameters affect the bubble haze. They examined the influence of changing the dissolved nitrogen and carbon dioxide content on the stability of the bubble haze in beer. Furthermore, they observed the influence of beer flow rate from the tap and applying a sparkler (a thin plastic disk) in the tap on the stability of the bubble haze. Stability of beer bubble haze was monitored by measuring surge time (the period of the haze disappearing), haze velocity (velocity increase of bubbles), and bubble size distribution (diameter and number of bubbles) in beer. Experiments were carried out using the high-speed video camera and a CCD camera for image acquisition, followed by the image analysis method. Experimental results indicate a positive correlation between the surge time and beer flow rate, sparkler application and supplied nitrogen content. Besides, the size and number of bubbles are crucial factors for the prediction of bubble haze lifetime, and they can be affected by varying the process condition [55].
Hepworth et al. [54] also developed another experimental procedure for monitoring the bubble nucleation (measuring bubble production rate and bubble size) during beer dispense. In this study, they investigated the influence of liquid motion, gas composition, and beer flow rate on the bubble nucleation in beer using computer vision and mathematical modeling. The image analysis was performed on images captured with a CCD camera to determine the bubble diameters and bubble distribution. They adopted the classical mathematical model for predicting bubble nucleation by including liquid motion as a new variable. According to the result, the proposed mathematical model can be suitable for predicting the bubble production rate and size, considering liquid motion. When the flow rate increases, the bubble nucleation rate in beer also increases. The nitrogen content in the gas headspace has an opposite effect on the bubble nucleation (greater nitrogen content, the lower nucleation rate). Hepworth et al. [53] developed and adapted the image analysis method for measuring bubble distribution in beer (measuring bubble production rate and size). For this purpose, they captured images of bubbles in beer, and after image capturing, they applied an image processing to extract valuable data from the captured image like bubble size (diameter) and bubble velocities (distribution and position of bubbles in the observed tank during the time) (Figure 12). In order to ignore the influence of errors and limitations during image capturing (distortion from the curved glass, the distance between the camera lens and glass, focusing problems), they constructed flat-bottomed beer tank with the camera in a very close position. Thus, distortions were avoided due to this positioning method. The proposed method has shown as a good tool for predicting the bubble nucleation rate, bubble growth, and motion under various experimental conditions. The great advantage of this technique is that is designed to be simple to use and relatively portable. and a CCD camera for image acquisition, followed by the image analysis method. Experimental results indicate a positive correlation between the surge time and beer flow rate, sparkler application and supplied nitrogen content. Besides, the size and number of bubbles are crucial factors for the prediction of bubble haze lifetime, and they can be affected by varying the process condition [55].
Hepworth et al. [54] also developed another experimental procedure for monitoring the bubble nucleation (measuring bubble production rate and bubble size) during beer dispense. In this study, they investigated the influence of liquid motion, gas composition, and beer flow rate on the bubble nucleation in beer using computer vision and mathematical modeling. The image analysis was performed on images captured with a CCD camera to determine the bubble diameters and bubble distribution. They adopted the classical mathematical model for predicting bubble nucleation by including liquid motion as a new variable. According to the result, the proposed mathematical model can be suitable for predicting the bubble production rate and size, considering liquid motion. When the flow rate increases, the bubble nucleation rate in beer also increases. The nitrogen content in the gas headspace has an opposite effect on the bubble nucleation (greater nitrogen content, the lower nucleation rate). Hepworth et al. [53] developed and adapted the image analysis method for measuring bubble distribution in beer (measuring bubble production rate and size). For this purpose, they captured images of bubbles in beer, and after image capturing, they applied an image processing to extract valuable data from the captured image like bubble size (diameter) and bubble velocities (distribution and position of bubbles in the observed tank during the time) ( Figure 12). In order to ignore the influence of errors and limitations during image capturing (distortion from the curved glass, the distance between the camera lens and glass, focusing problems), they constructed flat-bottomed beer tank with the camera in a very close position. Thus, distortions were avoided due to this positioning method. The proposed method has shown as a good tool for predicting the bubble nucleation rate, bubble growth, and motion under various experimental conditions. The great advantage of this technique is that is designed to be simple to use and relatively portable.  Zabulis et al. [56] reported the method for bubbles detection and their size determination in dense dispersions with digital image technique. In this study, they developed software for bubble detection, which is easy to use without any need for additional intervention during application. The method is objective and effective in determination of the bubble distribution, and bubble size in beer. This method provides a good tool to control and monitor foam decay through measurement of bubble size distribution. The method is based on monitoring of visual appearance (appearance-based approach) of beer samples with a digital camera in a single image. The proposed approach utilizes templates to increase robustness and an image scale-space to detect bubbles independently of their size. Furthermore, algorithmic optimizations for the proposed approach that target the reduction of computational complexity and user-intervention are proposed and compiled into a software application.

Foam Stability (Head Retention)
Beer external quality is characterized by foam stability and visual appearance. Therefore, for beer having a long-lasting head of foam and strong foam, some say that beer is of good quality and is desirable among consumers Features of a good foam are quantity and stability, cling or lacing (adhesion to the glass), density or creaminess, whiteness, and strength. Methods for foam quality evaluation are based on the different foam physical characteristics. Most methods measure foam collapse or the rise of the liquid/foam surface (drainage). Drainage is the liquid flow from a wet foam fraction to the liquid underneath and, in the first stages of the foam decay (collapse), it is the dominant process contributing to foam collapse. However, rearrangement of the foam bubbles during time is an equally important factor when measuring foam stability. Furthermore, some other phenomena also must be considered when beer foam kinetics is studied, e.g., creaming, which represents the rise of the bubbles to the top of the system [57].
Many research activities have been focused on detecting the main components and reaction mechanisms that influence beer foam quality (both positive and negative effects). Stability of beer foam mainly depends on the presence of the hydrophobic surface-active proteins (polypeptides) of albumin class, primarily protein Z (40 kDa) and lipid transfer protein LTP1 (9.7 kDa). Among the proteins mentioned above, the stability of beer foam is also influenced by an iso-α-acids from hops, metal cations, hordein-derived (poly) peptides, polyphenols and non-starch polysaccharides (β-glucan and arabinoxylan). Contrary to substances that promote foam stability, destabilization substances are lipids, some amino acids and increased ethanol content [47,48,[56][57][58][59][60][61]. The beer foam stability can be improved by using nitrogen gas, the way of pouring beer into a glass (pouring from a certain height which can increase the foam in the glass), or by using the beer dispensing system. In addition, the shape of a beer glass plays an important role in beer foam stability. Beer glasses with a larger diameters at the top have a larger exposed surface area of foam in relation to volume ratio, which is why the stability of the foam is disturbed.
The assessment of beer foam quality depends both on the foam generation method, and on foam collapse/drainage measurement procedure. Techniques to generate beer foam can be divided into artificial (foaming devices) and natural categories (pouring). Standard methods for determination of beer foam stability are based on measurements of the weight or volume of the liquid collapse from the foam, visual assessment of foam volume decrease or conductometric assessment of foam/air interface. Some traditional methods for the foam quality assessment are Rudin head retention, Ross and Clark procedure, NIBEM, Sigma head value (SHV), ASBC sigma method [62]. Those traditional (standard) methods can produce errors due to some experimental conditions, e.g., non-reproducible and irregular way of foam generation. Evaluation of the foam stability is much more commonly determined by measuring the liquid drainage rate from the foam due to an inconsistent foam-air boundary, which is difficult to define precisely. Additionally, the beer temperature of 20 • C is greater than one used when beer is served to the customer; foam stability is directly related to temperature (the foam quality differs at lower and higher temperatures).
In contrast to standard methods, new devices like digital cameras and image analysis software have been developed for the assessment of the beer foam stability [59]. Methods using such devices are automated, low-cost, contactless and non-destructive, and measures the foam collapse over time. The method is based on photographing a glass in which a known volume of beers is poured. This method can be used to monitor two parameters simultaneously: beer foam collapse or beer liquid height increase in the glass over the time. The beer poured into a glass and is photographed over time, photos are processed using appropriate image analysis software, and obtained results describe the decrease of the beer foam height and increase of the beer liquid phase height over time. Constant [63] investigated the beer foam collapsing by photographing the foam collapse during a 5 min period. After applied image analysis method on photographed beer samples, he observed two separated parameters on photography: total beer height (which includes foam, and liquid together), and liquid height separated from the foam (beer beneath the foam). Yasui et al. [64] investigated foam stability (foam collapse over time, FTC) using image analysis method. Total foam stability over the time is measured using images captured with CCD camera, and beer samples are poured into a beer glass directly from a beer bottle. This method is based on simulation of the foam formation in realistic conditions (the consumer pours beer directly from the bottle into the beer glass). After images are captured, they are analyzed by the image analysis software. The results of the image analysis method (captured foam collapse during the time) are foam height, FTC and foam stability. They confirmed that image analysis is suitable as a method to monitor foam stability by measuring FTC values. Further, it has been found that monitoring FTC values may replace the usual visual impression of foam stability.
Wallin et al. [65] reported a comparison of three methods for the assessment of foam stability. To measure foam stability of nine different beer, they use NIBEM (foam collapse assessment), Steinfurth (foam drainage assessment) and image analysis technique (monitoring foam stability during time) ( Figure 13). The main difference between those methods is a way that foam is generated. In the NIBEM and Steinfurth method, foam is generated artificially (under pressure); meanwhile, for the purpose of the image analysis, foam is generated in a natural pour. The result showed a significant correlation between three different methods for assessing foam stability and good reproducibility, and better foam stability of ale beers over lagers. The method is based on photographing a glass in which a known volume of beers is poured. This method can be used to monitor two parameters simultaneously: beer foam collapse or beer liquid height increase in the glass over the time. The beer poured into a glass and is photographed over time, photos are processed using appropriate image analysis software, and obtained results describe the decrease of the beer foam height and increase of the beer liquid phase height over time. Constant [63] investigated the beer foam collapsing by photographing the foam collapse during a 5 min period.
After applied image analysis method on photographed beer samples, he observed two separated parameters on photography: total beer height (which includes foam, and liquid together), and liquid height separated from the foam (beer beneath the foam). Yasui et al. [64] investigated foam stability (foam collapse over time, FTC) using image analysis method. Total foam stability over the time is measured using images captured with CCD camera, and beer samples are poured into a beer glass directly from a beer bottle. This method is based on simulation of the foam formation in realistic conditions (the consumer pours beer directly from the bottle into the beer glass). After images are captured, they are analyzed by the image analysis software. The results of the image analysis method (captured foam collapse during the time) are foam height, FTC and foam stability. They confirmed that image analysis is suitable as a method to monitor foam stability by measuring FTC values. Further, it has been found that monitoring FTC values may replace the usual visual impression of foam stability. Wallin et al. [65] reported a comparison of three methods for the assessment of foam stability. To measure foam stability of nine different beer, they use NIBEM (foam collapse assessment), Steinfurth (foam drainage assessment) and image analysis technique (monitoring foam stability during time) (Figure 13). The main difference between those methods is a way that foam is generated. In the NIBEM and Steinfurth method, foam is generated artificially (under pressure); meanwhile, for the purpose of the image analysis, foam is generated in a natural pour. The result showed a significant correlation between three different methods for assessing foam stability and good reproducibility, and better foam stability of ale beers over lagers.  Recently, to analyze some foam properties like foamability, foam stability, and structure, the Dynamic Foam Analyzer (DFA100) has been introduced. This apparatus is based on the principle of the image analysis method. In KRÜSS GmbH study report [66] samples of degassed clear wheat beer, Pils and Kolch were analyzed to determine the influence of the surfactants in the beer independently of the CO 2 content and its impact on the foam behavior. Removal of CO 2 before analyses provides a better insight into the influence of other foam-forming substances (e.g., proteins). The equipment uses a vacuum pump to remove CO 2 from the sample and, after degassing, foaming is conducted in controlled conditions by computer-regulated air pumping through the beer sample. Samples are illuminated with the LED panel and changes in foam height is captured with photodetector of a video camera. During the analysis, the device records the formed foam in a column and simultaneously provides data on the foamability and foam stability. Furthermore, this equipment measures changes in foam structure during the time (size and number of foam bubbles).
Sauerbrei et al. [67] conducted a computer-aided image processing research of redistribution and size of the foam bubbles during the beer foam decay. They used CCD camera, diffuse coaxial illumination to record photographs of the foam collapse, and foam bubble structure over time (5 s interval). The use of the ultrasonic device accomplished foaming. They have successfully implemented image analyses to measure the foam bubble size and area of the liquid fraction in the foam. Immediately after foaming bubbles were very small and uniformly distributed. Over time, coalescence occurs due to rupture of the bubble surface and some of the bubbles merge, forming larger bubbles ( Figure 14). Remaining smaller bubbles fill the remaining space between the larger bubbles. The authors have compared the resulting pattern to a known mathematical structure called the Apollonian gasket. They also concluded that beer foam does not follow simple exponential decay but more complex higher order kinetics. Recently, to analyze some foam properties like foamability, foam stability, and structure, the Dynamic Foam Analyzer (DFA100) has been introduced. This apparatus is based on the principle of the image analysis method. In KRÜ SS GmbH study report [66] samples of degassed clear wheat beer, Pils and Kolch were analyzed to determine the influence of the surfactants in the beer independently of the CO2 content and its impact on the foam behavior. Removal of CO2 before analyses provides a better insight into the influence of other foam-forming substances (e.g., proteins). The equipment uses a vacuum pump to remove CO2 from the sample and, after degassing, foaming is conducted in controlled conditions by computer-regulated air pumping through the beer sample. Samples are illuminated with the LED panel and changes in foam height is captured with photodetector of a video camera. During the analysis, the device records the formed foam in a column and simultaneously provides data on the foamability and foam stability. Furthermore, this equipment measures changes in foam structure during the time (size and number of foam bubbles).
Sauerbrei et al. [67] conducted a computer-aided image processing research of redistribution and size of the foam bubbles during the beer foam decay. They used CCD camera, diffuse coaxial illumination to record photographs of the foam collapse, and foam bubble structure over time (5 s interval). The use of the ultrasonic device accomplished foaming. They have successfully implemented image analyses to measure the foam bubble size and area of the liquid fraction in the foam. Immediately after foaming bubbles were very small and uniformly distributed. Over time, coalescence occurs due to rupture of the bubble surface and some of the bubbles merge, forming larger bubbles ( Figure 14). Remaining smaller bubbles fill the remaining space between the larger bubbles. The authors have compared the resulting pattern to a known mathematical structure called the Apollonian gasket. They also concluded that beer foam does not follow simple exponential decay but more complex higher order kinetics. Cimini et al. [68] presented an inexpensive, automated and flexible image analysis method instead of the standard foam head retention method (developed by Rudin [69]). The standard Rudin's method is improved by using three different systems for automatic data collection: tracking software for mouse movement; Accurate Image Analysis system (AIA) and low-cost image analysis (LCIA) system. The main difference between AIA system and LCIA system is that AIA used CCD camera and script written in MATLAB, while LCIA system used a Raspberry Pi single-board computer and a camera module. Authors reported that the LCIA system could be successfully used for analyzing beer foam attributes, such as the number of bubbles in the beer, their distribution, diameter and size. Cimini et al. [68] presented an inexpensive, automated and flexible image analysis method instead of the standard foam head retention method (developed by Rudin [69]). The standard Rudin's method is improved by using three different systems for automatic data collection: tracking software for mouse movement; Accurate Image Analysis system (AIA) and low-cost image analysis (LCIA) system. The main difference between AIA system and LCIA system is that AIA used CCD camera and script written in MATLAB, while LCIA system used a Raspberry Pi single-board computer and a camera module. Authors reported that the LCIA system could be successfully used for analyzing beer foam attributes, such as the number of bubbles in the beer, their distribution, diameter and size.

Conclusions
The computer vision system (CVS) represents an efficient and non-destructive inspection technique for evaluating the external attributes of food products. It is an effective alternative to human vision, enabling rapid and objective analyses of food quality properties. Lately, digital image analysis is increasingly used in the study of various beer quality parameters (color, bubble size and distribution, foam stability, etc.). The strongest arguments for deploying CVS in evaluating external quality attributes of beer are the reliability and reproducibility of the obtained results. Although more and more progress is being made on the development of image analysis devices, there is still no available equipment that will simultaneously cover the determination of all quality features, due to the complexity and broad spectrum of beer quality parameters. Despite the fact that CVS is, in any case more, precise than visual methods, algorithms used for image representation and interpretation may be the source of the errors, resulting in the improper extraction and analysis of the obtained data. Therefore, additional efforts must be made in the development of more sophisticated equipment and algorithms that will further enhance measuring precision. One way of improving algorithms is the use of the information collected with the chemometric methods, using a wide set of various statistical tools which are capable of providing useful information by the analysis and modeling large quantities of data.