Froth Image Acquisition and Enhancement on Optical Correction and Retinex Compensation

To well monitor and optimize the flotation production, a computer vision and image analysis system is used. In such a system, the first important step is to acquire the froth surface images in high quality. Froth imaging quality is hard to control, and the industrial field noise, froth 3D properties, complex textures, and mixed colors can also cause the flotation image to be difficult to segment and process. To acquire high quality images, a new system for image acquisition of the lead flotation is studied. The system constructs the free-form surface lens based on the non-imaging optics theory, which can improve the optical efficiency of the lens and the uniformity of light sources, and can reduce flare effects. For the compensation, an improved MSR (Multi-Scale Retinex) adaptive image algorithm is proposed to increase the brightness and intensity contrast for small bubbles, and to enhance texture details and froth weak edges by analyzing the Retinex output characteristics of the shaded area and improving the gain function. Under the condition of the optimal parameters, the image acquisition system can obtain uniform illumination and reduce different noises. Experiments show that the new froth image acquisition system increases Signal/Noise by 14%, contrast by 21%, and image segmentation accuracy by 26% in an image.


Introduction
In mineral processing can be used in many application areas [1].The froth flotation is a traditional and important method.The froth flotation is used to selectively separate minerals (such as copperand lead minerals) from gangue, and this method can also be used in paper recycling and waste-water treatment industries.For mineral processing, the ground ore is generally mixed with water to form the slurry, and the desired minerals are rendered hydrophobic by the addition of the surfactant/collector chemical.The slurry of hydrophobic particles and hydrophilic particles are introduced to tanks called as flotation cells which are aerated to generate bubbles.The hydrophobic particles attach to the air bubbles, which rise to the surface, forming froths.The froths are removed from the cell, producing the concentrate of the target minerals.The froth flotation efficiency can be determined by different factors, such as particle and bubble contact, particle and bubble attachment, transportation between the pulp and froths, and froth collecting into the product launder.To keep the flotation correct, normally, an operator adjusts flotation parameters from time to time, according to froth surface variation, which is operator-dependent.

Design of Uniform Light Distribution
A conventional flotation illumination system generally adopts the existing light sources on the market (e.g., fluorescent lamps, energy-saving lamps, etc.).It is effective as a device for lightning, but the acquired images have problems of uneven illumination, lack of texture details, and abnormal color, which is on account of the characteristics of the flotation half transmission fluid level and fast dynamic movement [20,21].In order to construct a feasible illumination system, we bought three kinds of cameras and seven types of lights, and tested six different methods (respectively using one, two, three, four, five, or six lights as the light sources) based on the literature [2,5,12,13], but since our working environments and flotation materials are different to that in the literature, the testing results were not good enough.As shown in Figure 1, there are different distortion degrees by three kinds of ordinary light sources to obtain the froth images.LED has unmatched advantages comparing to a traditional lightning source: it has a long service life, the good color rendering, and the less power consumption.Using LED to replace the traditional light sources is the main trend in the machine vision, so in this article, we chose LED as a lighting source.In order to make the flotation image illumination more even, we needed to redistribute the lighting on the flotation surface through physical optics.As far as possible under the condition of the low-energy cost, the lighting was spread evenly on the flotation surface.

Design of Uniform Light Distribution
A conventional flotation illumination system generally adopts the existing light sources on the market (e.g., fluorescent lamps, energy-saving lamps, etc.).It is effective as a device for lightning, but the acquired images have problems of uneven illumination, lack of texture details, and abnormal color, which is on account of the characteristics of the flotation half transmission fluid level and fast dynamic movement [20,21].In order to construct a feasible illumination system, we bought three kinds of cameras and seven types of lights, and tested six different methods (respectively using one, two, three, four, five, or six lights as the light sources) based on the literature [2,5,12,13], but since our working environments and flotation materials are different to that in the literature, the testing results were not good enough.As shown in Figure 1, there are different distortion degrees by three kinds of ordinary light sources to obtain the froth images.LED has unmatched advantages comparing to a traditional lightning source: it has a long service life, the good color rendering, and the less power consumption.Using LED to replace the traditional light sources is the main trend in the machine vision, so in this article, we chose LED as a lighting source.In order to make the flotation image illumination more even, we needed to redistribute the lighting on the flotation surface through physical optics.As far as possible under the condition of the low-energy cost, the lighting was spread evenly on the flotation surface.For the redistribution of LED lightings, first of all, the mesh method was adopted for the design of the froth image acquisition system.The divided mesh method [22] defines the map from a light source to the light distribution according to the theorem of conservation of energy, using the mapping defined for the optical system design.This method is feasible for the secondary optical design, which can solve the problem of complex illumination distribution.In Figure 1, three kinds of images are acquired by three different light illuminations, and the image qualities are different: (a) from top to bottom in the image, the lighting increases from weak to strong, and in the top parts of the image, froth are difficult to recognize; (b) the lighting is stronger in the left and right parts than that in the centre part, and in the centre part the froths are dark and cannot be recognized; and (c) in the whole image, the lighting is too strong, and the froths cannot be distinguished from each other.
The flotation surface is a plane surface, but not a smooth plane structure as shown in Figure 1, and therefore cannot be made a simple surface and formulated by unified equations.In application, the flotation surface can be controlled at any angle with a strong light for even distribution; in order to achieve the uniform lighting, we must improve the utilization rate of light energy.
The basic thought to build up a free surface (corresponding to the froth liquid surface with densely packed, different-sized bubbles) is to solve all the points on a surface by getting the tangent vector of the point in the surface [20].It is through the relationship between the lens of the incident and the emergent light vector, and the relationship between choosing the intersection of lens with For the redistribution of LED lightings, first of all, the mesh method was adopted for the design of the froth image acquisition system.The divided mesh method [22] defines the map from a light source to the light distribution according to the theorem of conservation of energy, using the mapping defined for the optical system design.This method is feasible for the secondary optical design, which can solve the problem of complex illumination distribution.In Figure 1, three kinds of images are acquired by three different light illuminations, and the image qualities are different: (a) from top to bottom in the image, the lighting increases from weak to strong, and in the top parts of the image, froth are difficult to recognize; (b) the lighting is stronger in the left and right parts than that in the centre part, and in the centre part the froths are dark and cannot be recognized; and (c) in the whole image, the lighting is too strong, and the froths cannot be distinguished from each other.
The flotation surface is a plane surface, but not a smooth plane structure as shown in Figure 1, and therefore cannot be made a simple surface and formulated by unified equations.In application, the flotation surface can be controlled at any angle with a strong light for even distribution; in order to achieve the uniform lighting, we must improve the utilization rate of light energy.
The basic thought to build up a free surface (corresponding to the froth liquid surface with densely packed, different-sized bubbles) is to solve all the points on a surface by getting the tangent vector of the point in the surface [20].It is through the relationship between the lens of the incident and the Minerals 2018, 8, 103 4 of 11 emergent light vector, and the relationship between choosing the intersection of lens with LED and receiving surface geometric center axis, for the initial point of free-form surface that finally solves the whole free-form surface combining with the boundary conditions.The details are separated into three parts as follows.
(1) First of all, we need to establish a simple optical system consisting of LED, free surface, and receiving surface, as shown in Figures 2 and 3, where p 0 is the vertex of the surface, located in the geometry center shaft between LED and the receiving surface.The incident ray via p 0 on the surface refracts to t 0 (the receiving surface).
(2) The refraction of the incident ray vector → I of p i , the emergent light vector → O, and the normal vector → N at that meeting point can be expressed as: where, n is the refractive index of a lens, the unit of incident light vector is, n when the distance of p t is greater than the p o ; → O can be expressed using the approximate point coordinates of t as, {x t, y t, z t }/ x 2 t + y 2 t + z 2 t where, z t is the distance between the illuminated area and light.
The unit normal vector of point p is, Put the above three vector expressions into refraction formulae: (3) We determine the corresponding relationship between the incident light and the emergent light without considering energy loss on the basis of the energy conservation, with the mapping relationship u → y, v → x: where, I(u,v) is the function of light intensity, and E(x t ,y t ) is the light intensity of plane illuminated.The point coordinates t can be obtained by (x t ,y t ) = (f(u,v),g(u,v)), put into the expression of the normal vector of N by combining with boundary conditions to solve the flotation surface.Figure 4 shows the contrast of flare (or light reflection) effect between LED light for the use of traditional lens (Figure 4a) and the use of the flotation surface lens designed in this paper (Figure 4b), where, one LED lamp (60W) is used at a 45° angle inside a hood, and lighting area is an elliptical area.In Figure 4a, the light energy is lower, which causes uneven illumination; for an elliptical area, the lights gradually decrease from the centre area to the edges.It can be seen clearly from Figure 4b that the flotation surface lens designed redistributes the lighting, which makes the light received more even, reduces the light energy loss, and greatly improves the utilization rate of light energy and the availability of the image.In Figure 4b, the illumination is even in the elliptical area, the lighting is evenly distributed from the centre area to the edges.At the same time, about 98% of the light energy is uniformly distributed in the planning area by using professional optical software, Trace Pro, through 2 million rays to tract and simulate.The minimum value Emin of luminance in the area is equal to 10.17lx, and the maximal value Emax of luminance in the area is equal to 11.03lx.

Image Quality Compensation Algorithm Based on Adaptive MSR
The purpose for redistributing LED lighting is to make a CCD camera directly obtain a relatively uniform froth image.However, there are certain bubble shadows [23][24][25][26][27][28] in a 2D image because of foam solids, which are very difficult to improve through the distribution of the light source.The Retinex theory holds that the formation of an image is the result of the ambient lighting and reflection of the objects.The image enhancement algorithm has features [23][24][25][26] such as improving the contrast between the global area and the local areas, edge enhancement, and color invariant.Among them, the single-scale Retinex (SSR) algorithm is a good method in some cases, but in general, the algorithm of multi-scale Retinex (MSR) has is faster and obtains better treatment effect, and it is widely used in industry applications.Figure 4 shows the contrast of flare (or light reflection) effect between LED light for the use of traditional lens (Figure 4a) and the use of the flotation surface lens designed in this paper (Figure 4b), where, one LED lamp (60 W) is used at a 45 • angle inside a hood, and lighting area is an elliptical area.In Figure 4a, the light energy is lower, which causes uneven illumination; for an elliptical area, the lights gradually decrease from the centre area to the edges.It can be seen clearly from Figure 4b that the flotation surface lens designed redistributes the lighting, which makes the light received more even, reduces the light energy loss, and greatly improves the utilization rate of light energy and the availability of the image.In Figure 4b, the illumination is even in the elliptical area, the lighting is evenly distributed from the centre area to the edges.At the same time, about 98% of the light energy is uniformly distributed in the planning area by using professional optical software, Trace Pro, through 2 million rays to tract and simulate.The minimum value E min of luminance in the area is equal to 10.17lx, and the maximal value E max of luminance in the area is equal to 11.03lx.Figure 4 shows the contrast of flare (or light reflection) effect between LED light for the use of traditional lens (Figure 4a) and the use of the flotation surface lens designed in this paper (Figure 4b), where, one LED lamp (60W) is used at a 45° angle inside a hood, and lighting area is an elliptical area.In Figure 4a, the light energy is lower, which causes uneven illumination; for an elliptical area, the lights gradually decrease from the centre area to the edges.It can be seen clearly from Figure 4b that the flotation surface lens designed redistributes the lighting, which makes the light received more even, reduces the light energy loss, and greatly improves the utilization rate of light energy and the availability of the image.In Figure 4b, the illumination is even in the elliptical area, the lighting is evenly distributed from the centre area to the edges.At the same time, about 98% of the light energy is uniformly distributed in the planning area by using professional optical software, Trace Pro, through 2 million rays to tract and simulate.The minimum value Emin of luminance in the area is equal to 10.17lx, and the maximal value Emax of luminance in the area is equal to 11.03lx.

Image Quality Compensation Algorithm Based on Adaptive MSR
The purpose for redistributing LED lighting is to make a CCD camera directly obtain a relatively uniform froth image.However, there are certain bubble shadows [23][24][25][26][27][28] in a 2D image because of foam solids, which are very difficult to improve through the distribution of the light source.The Retinex theory holds that the formation of an image is the result of the ambient lighting and reflection of the objects.The image enhancement algorithm has features [23][24][25][26] such as improving the contrast between the global area and the local areas, edge enhancement, and color

Image Quality Compensation Algorithm Based on Adaptive MSR
The purpose for redistributing LED lighting is to make a CCD camera directly obtain a relatively uniform froth image.However, there are certain bubble shadows [23][24][25][26][27][28] in a 2D image because of foam solids, which are very difficult to improve through the distribution of the light source.The Retinex theory holds that the formation of an image is the result of the ambient lighting and reflection of the objects.The image enhancement algorithm has features [23][24][25][26] such as improving the contrast between the global area and the local areas, edge enhancement, and color invariant.Among them, the single-scale Retinex (SSR) algorithm is a good method in some cases, but in general, the algorithm of multi-scale Retinex (MSR) has is faster and obtains better treatment effect, and it is widely used in industry applications.
When there are lighting spaces or spectral changes, the quality of a froth image will have a great decreases.The visibility of image color and shadow details will be very poor, while in the case of lighting, regardless of change in the spectrum of blue or red, the whole scene visibility will be affected.Since the defect of the lighting is quite common, therefore, for a scene with a white surface (like cloud or snow), the color and details of non-white areas of an image have the poor visibility.Hence, we need an algorithm to improve the quality of these images.The Retinex algorithm is useful to strengthen this kind of images.
The Retinex algorithm was proposed in 1971 by Edwin, and he developed "The Retinex Theory" to explain it.Many researchers had demonstrated large dynamic range compression, sharpness and color increase, and accurate replication, which are produced by MSR and color reduction, especially for the froth images under complex conditions.In general, the Retinex algorithm is superior to any other method.In order to make the Retinex algorithm better for froth image enhancement, we make the following formulation to describe how to extend SSR to MSR [27,28].
The simple description of SSR algorithm is as follows: R n (x, y) = log[I n (x, y)/F(x, y) * (x, y)] (5) where, x, y are the image coordinates; I n (x, y) is the n th spectral band image at point (x,y); R n (x, y) is the Retinex result of the n th spectral band at point (x,y); G(x,y) is a Gaussian function; σ is the constant of Gauss around space; P is a scale; and * is the convolution symbol.Due to the balance of the dynamic range compression and color reproduction, it is essential to choose a good scale in SSR formula.If you do not want to sacrifice dynamic range compression or color reproduction, the MSR algorithm is a good solution, and it is a weighted combination of different scales' SSR.
The classic mathematical form of the MSR algorithm [28] is the result of the weighted average of the multiple SSR process, where, R M i (x, y) is the output MSR in the first i segment of the color spectrum, N is the number of dimensions, w n is the weight of corresponding scale, and R n i (x, y) is the output of the first n scale of the first segment of the color spectrum [27,28].
Using the constant gain can lead to the over-enhancement of a smooth area and the edges of the high-contrast image by the classic MSR algorithm, appearing on the lighting circle ring on the edge of the image, without the obvious improvement in details in a bubble shaded area.Therefore, this article analyzes the characteristics of the shadow region Retinex output, and improves the gain function in view of the characteristics of a bubble image directly obtained by a CCD camera, using the small gain to get high-contrast edges and using bigger gain in the shaded area.The mathematical expression form with space change gain adopted in this article is as follows: where, k 1 , k 2 , b are constant factors used for changed curve, NR n i (x, y) is the normalization of R n i (x, y), and c n is the constant surrounded by a normalized Gauss function.It is defined as, where, The mathematical expression of the improved MSR algorithm after calculating the gain function by Formulae ( 9)-( 11) is: As tested, this algorithm can be widely used in different application areas, such as for strength fuzzy remote sensing images [29], and for enhance dark tunnel 2D images or 3D visual information [30].

Experimental Results and Analysis
The lighting system for obtaining flotation images was applied in a flotation cell, where a metal hood with dimensions 50 cm × 40 cm × 80 cm was used to protect the camera from dust and ambient light.It also consists of a CCD camera, a LED lamp mounted at a 45 • angle in one side of the inside the hood, and two fans to eliminate heat and moisture on the other two opposite sides of the hood.We classify images into three types: images of mixed large-sized and small-sized bubbles, images of medium-sized bubbles, and images of small-sized bubbles.In the tests, three different types of images were randomly collected at different time periods, and the testing results were compared by different algorithms.
Figure 5 shows the image obtained by free surface lens using LED as a light source, which well improves the overall uniformity of the image.However, there are many shadows in the image of small-sized bubbles (see red-color-encircled parts), and in the image of mixed sized bubbles, the result has missing texture details on the bubble surfaces, decreasing the number of highlights at the top of the window.To solve the above problems, we tested different common image enhancement algorithms, such as Histogram Equalization (HE), but the results were not satisfactory (Figure 5).Instead, we use the improved adaptive MSR algorithm to make compensation for the image.
It can be seen clearly from Figure 6 that the brightness is significantly enhanced in the shaded areas, the overall uniformity is optimized, and the details are also enhanced.The quality of the image is improved, and the accuracy of image segmentation is increased as well.In order to quantitatively evaluate the effect of the image enhancement, we select the contrast and SNR (signal-to-noise ratio) to verify the effect of the enhancement [24].The measuring function of the contract is defined as: where, A max and A min , respectively, are the maximum and the minimum of grey level values of a 3 × 3 window centered by ϕ(m, n).Table 1 gives the quantitative indicators of the three different types of bubble images.Thus, it can be seen that the contrast and SNR are increased significantly by the improved adaptive MSR.
where, Amax and Amin, respectively, are the maximum and the minimum of grey level values of a 3 × 3 window centered by , .Table 1 gives the quantitative indicators of the three different types of bubble images.Thus, it can be seen that the contrast and SNR are increased significantly by the improved adaptive MSR.The valley edge detection algorithm [20,21] is widely used in the flotation image segmentation with its fast calculation speed, high accuracy, and less memory resources.It is based on pixel grey level information, with low grey level of pixels to the edge of a bubble.The edge of each bubble has a different gray level constituting the valley distribution.We use the valley edge detection algorithm to identify the edges of the bubbles.In Figures 7-9, three types of images are enhanced by adaptive  The valley edge detection algorithm [20,21] is widely used in the flotation image segmentation with its fast calculation speed, high accuracy, and less memory resources.It is based on pixel grey level information, with low grey level of pixels to the edge of a bubble.The edge of each bubble has a different gray level constituting the valley distribution.We use the valley edge detection algorithm to identify the edges of the bubbles.In Figures 7-9, three types of images are enhanced by adaptive MSR and segmented by using the valley edge detection algorithm [20,21] respectively.Results show that the adaptive MSR can increase the image segmentation accuracy.Tables 2 and 3 show that when using the adaptive MSR, the extracted bubble numbers or white spots are more closed to that by  The valley edge detection algorithm [20,21] is widely used in the flotation image segmentation with its fast calculation speed, high accuracy, and less memory resources.It is based on pixel grey level information, with low grey level of pixels to the edge of a bubble.The edge of each bubble has a different gray level constituting the valley distribution.We use the valley edge detection algorithm to identify the edges of the bubbles.In Figures 7-9, three types of images are enhanced by adaptive MSR and segmented by using the valley edge detection algorithm [20,21] respectively.Results show that the adaptive MSR can increase the image segmentation accuracy.Tables 2 and 3 show that when using the adaptive MSR, the extracted bubble numbers or white spots are more closed to that by manual.

Conclusions
This paper puts forward a method to redistribute the lighting on a lead froth surface based on the theory of non-imaging optics, significantly increasing the uniformity with more rich texture details in froth images.We made an improved adaptive MSR compensation algorithm to improve the gain function based on the analysis of characteristics of Retinex output in shadow regions, with a small gain in edges with a high contrast, and with a big gain in shaded are as to remove shadows.Experimental results indicate that the LED with free-form surface as a light source for a bubble image is good, in which we can get even illumination and make the texture details in an image evident in the ascension.The algorithm of compensation used in the shaded areas can raise the brightness and texture details, and can improve the quality on bubble edge regions.In this study, the combination of the optical correction and compensation algorithm are superior to the traditional image enhancement methods, and it can improve the uniformity and increase the texture details in most areas.Different mineral flotation will be tested and optimized in the next step.

Figure 1 .
Figure 1.Comparison of images acquired by three kinds of illumination, with the same illumination and different lamps.(a) PHILIPS E27 Fluorescent; (b) PHILIPS MHN-TDW Halide; (c) HY 03-033 Lamp.

Figure 1 .
Figure 1.Comparison of images acquired by three kinds of illumination, with the same illumination and different lamps.(a) PHILIPS E27 Fluorescent; (b) PHILIPS MHN-TDW Halide; (c) HY 03-033 Lamp.
(u,v)  is the function of light intensity, and E(xt,yt) is the light intensity of plane illuminated.The point coordinates t can be obtained by (xt,yt) = (f(u,v),g(u,v)), put into the expression of the normal vector of N by combining with boundary conditions to solve the flotation surface.

Figure 2 .
Figure 2. Sketch of generating free-form lens surface.

Figure 4 .
Figure 4. Flare contrast for ordinary light and the light in this design.(a) Conventional LED's reflection effect (b) Free curved LED's reflection effect.

Figure 4 .
Figure 4. Flare contrast for ordinary light and the light in this design.(a) Conventional LED's reflection effect (b) Free curved LED's reflection effect.

Figure 4 .
Figure 4. Flare contrast for ordinary light and the light in this design.(a) Conventional LED's reflection effect (b) Free curved LED's reflection effect.

Figure 5 .Figure 6 .
Figure 5. Different types of images acquired by using free-curved lens LED light (red-color-encircled parts are shaded parts), and their corresponding Histogram Equalization (HE) results.(a) First type; (b) Second type; (c) Third type; (d) HE on First type; (e) HE on Second type; (f) HE on Third type.

Figure 5 .Figure 5 .Figure 6 .
Figure 5. Different types of images acquired by using free-curved lens LED light (red-color-encircled parts are shaded parts), and their corresponding Histogram Equalization (HE) results.(a) First type; (b) Second type; (c) Third type; (d) HE on First type; (e) HE on Second type; (f) HE on Third type.

Figure 9 .
Figure 9. Third type of bubble image segmentation.(a) Image with optical correction; (b) Segmentation result; (c) Adaptive MSR segmentation.

Table 1 .
Quantitative evaluation of froth image enhancement.

Table 1 .
Quantitative evaluation of froth image enhancement.

Table 1 .
Quantitative evaluation of froth image enhancement.

Table 2 .
The number of bubbles in three types of images.

Table 2 .
The number of bubbles in three types of images.

Table 2 .
The number of bubbles in three types of images.

Table 2 .
The number of bubbles in three types of images.

Table 3 .
The number of white points (bubble seeds) in three types of images.