원시데이터 수집 시스템
선정목록으로

Liquid Level Detection in Standard Capacity Measures with Machine Vision

관련 수소연료전지 · (5) 연료전지용 수분제어장치(가습기)

기본 정보

저자
  1. Gregor Bobovnik — Laboratory of Measurements in Process Engineering, Faculty of Mechanical Engineering, University of Ljubljana, Aškerčeva 6, SI-1000 Ljubljana, Slovenia
  2. Tim Mušič — Laboratory of Measurements in Process Engineering, Faculty of Mechanical Engineering, University of Ljubljana, Aškerčeva 6, SI-1000 Ljubljana, Slovenia
  3. Jože Kutin — Laboratory of Measurements in Process Engineering, Faculty of Mechanical Engineering, University of Ljubljana, Aškerčeva 6, SI-1000 Ljubljana, Slovenia
DOI
10.3390/s21082676
저널
Sensors
발행년도
2021
발행기관
Multidisciplinary Digital Publishing Institute
피인용수
12
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.3390/s21082676
토픽
Surface Roughness and Optical Measurements
OpenAlex ID
W3154843187

평가 내용

관련도
관련
사업분야
수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '수소연료전지 > 연료전지용 수분제어장치(가습기)' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Capacity measures are commonly used volume standards for testing measuring systems for liquids other than water. Manual readings from the measuring scale can often be difficult due to the location of the capacity measure or to the nature of the measured liquid. This article focuses on the automation of this procedure by using a single camera machine vision system. A camera positioned perpendicular to the transparent neck captures the image of the liquid meniscus and the measuring scale. The volume reading is determined with the user-defined software in the LabVIEW programming environment, which carries out the image preprocessing, detection of the scale marks and the liquid level, correction of lens distortion and parallax effects and final unit conversions. The realized measuring system for liquid level detection in standard capacity measures is tested and validated by comparing the automated measurement results with those taken by the operators. The results confirm the appropriateness of the presented measuring system for the field of legal metrology.

본문 39,271자

본문 펼치기
Introduction Capacity measures are commonly used volume standards for the testing and inspection of measuring systems for liquids other than water. Depending on their nominal volume, the capacity measures can be categorized into the following [1]: standard glass flasks (≤10 L), standard test measures (≤20 L) and prover tanks (up to several thousand liters). Despite the fact that the last two types are made of steel, their neck part is made of a glass tube, or has glass plates or separate and fixed gauge glasses [1]. They are all equipped with scale marks corresponding to their nominal capacity and to at least 1% below and above the nominal capacity [1]. For type approval tests, the requirement for the expanded uncertainty of the determination of errors on the indication of the measured quantity is one-fifth of the maximum permissible error, i.e., 0.1% for measuring systems with an accuracy class of 0.5 [2]. For all capacity measures, the diameter of the neck or of the glass gauge should be large enough to minimize the capillary and meniscus effects; however, the reading of the meniscus (its curvature and fluctuations) represents an important contribution to the uncertainty and repeatability of the volume determined by standard capacity measures [3,4]. The operator needs to be certain that the reading uncertainty is small enough in view of the requirement for the combined expanded uncertainty. Manual (visual) liquid level detection and obtaining readings from the measuring scale can often be time consuming and difficult due to the location of the capacity measure or the nature of the measured liquid. As the capacity measures are calibrated against their scale marks, any automated measuring system also must detect the liquid level with respect to the attached measuring scale. Therefore, it is evident that the automation of such measuring procedures cannot be realized using the traditional techniques for liquid level measurement (such as capacitance or pressure transducers, ultrasonic and radar methods, tuning forks [5]). An alternative utilizes the application of machine vision, where a camera is used for image acquisition, and computer vision techniques are used for processing the Sensors 2021, 21, 2676 2 of 13 acquired images. The aim of this article is to present a simple, configurable and low-cost machine vision system capable of reading the liquid level with respect to the attached measuring scale, which is applicable for the purposes of legal metrology. It consists of a standard web camera and a PC including the LabVIEW software for image processing. The developed system compensates for the lens distortion and parallax effect [6,7], which are consequence of lens imperfections, physical properties of light and some distance between the measuring scale of the capacity measure and the liquid column. The magnitudes of these corrections are dependent on geometrical distances in the measuring system, which means that the machine vision system must be configured and validated for each individual application. Due to this, the presented measuring systems are especially employable for liquid level measurement in fixed applications, such as tank provers. Introduction In the available literature, we can find some similarly configured machine vision measuring systems with a single camera that are used in other applications requiring the detection of liquid level. Chakravarthy et al. [8] and Gaber et al. [9] employed a light source that illuminated the surface of the liquid, while the corresponding light pattern on the surface of the liquid was imaged by a digital camera. In a similar system, the liquid level detection in a tank is based on the pixel count of the float in the captured image [10]. Another type of measuring system for water levels in rivers uses the image of the level gauge immersed in water, which is captured by a laterally positioned camera [11][12][13]. Refs. [14][15][16][17] present machine vision systems for the detection of liquid levels in applications similar to the one we are interested in. Pithadiya et al. [14] present an application for the detection of under-or overfilled bottles with emphasis on edge detection algorithms, while Eppel and Kachman [15] inspect the applicability of computer vision techniques for the recognition of liquid levels in various transparent containers. A later study suggests that good accuracy of liquid-air boundaries can be achieved with various edge detection methods. Samman [16] presents a LabVIEW based system for liquid level and colour monitoring in glass cylinders during chemical reaction. Liu et al. [17] expose the importance of lighting conditions in machine vision systems used for the detection of a water-oil interface. Introduction This paper is structured as follows. Section 2 presents the background of the parallax correction model, including the effects of a tilted camera. Section 3 describes the test setup and the signal processing algorithm, which also includes image correction for lens distortion and parallax effects. In Section 4, the measuring system for liquid level detection in standard capacity measures is experimentally tested and validated by comparing the automated measurement results with those taken by two operators. Parallax Correction Due to the distance between the measuring scale of the capacity measure and the liquid column, every optical system is generally susceptible to parallax effects [5]. The parallax is a shift of the apparent position of the liquid level in the background, regarding the measuring scale positioned in the foreground. When the liquid level is not aligned with the central axis of the camera, the parallax error occurs. This effect can be reduced by adjusting the camera so that it remains aligned with the liquid level, or by considering corrections after the image is captured. In this article, we use the camera in a fixed position and perform corrections of the parallax during image processing, which is crucial for achieving the accuracy of the measured values. This section presents the theoretical foundations for the parallax correction of two different cases: (i) parallax correction for the camera with its centreline positioned perpendicular to the measuring scale and (ii) parallax correction for the tilted camera. Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale Assuming that the camera is positioned perpendicular, as shown in Figure 1, the actual liquid level L 3 is not equal to the apparent position of the liquid level L 1 read by the camera from the measuring scale. The determination of the actual liquid level L 3 is affected Assuming that the camera is positioned perpendicular, as shown in Figure 1, the actual liquid level L3 is not equal to the apparent position of the liquid level L1 read by the camera from the measuring scale. The determination of the actual liquid level L3 is affected by the distance between the camera and the measuring scale (d), the distance between the measuring scale and the glass neck (ds), and by the glass thickness (dg). According to Figure 1, the liquid level L3 can be calculated as follows: Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale where L2 can be related to L1 by a similar triangle principle: Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale (2) and the angle β is defined according to Snell's law by the ratio between refractive indices of air (n1 ≈ 1) and glass (n2): Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale The refraction index of glass is higher than that of air (n2 > n1); therefore, the angle of refraction β is smaller than the angle of incidence α. Expressing the angle α as Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale , the liquid level L3 can be expressed as: Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale Observe how certain terms in Equation (4) influence the measurement result. Figure 2 shows the influence of the camera distance d on the magnitude of the parallax effect, defined as the difference between the scale reading L1 and the actual liquid level L3. The parallax is more pronounced for smaller distances between the camera and the measuring scale. Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale Measuring scale Liquid column According to Figure 1, the liquid level L 3 can be calculated as follows: Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale where L 2 can be related to L 1 by a similar triangle principle: Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale and the angle β is defined according to Snell's law by the ratio between refractive indices of air (n 1 ≈ 1) and glass (n 2 ): sin β = n 1 n 2 sin α Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale The refraction index of glass is higher than that of air (n 2 > n 1 ); therefore, the angle of refraction β is smaller than the angle of incidence α. Expressing the angle α as α = arctan(L 1 /d), the liquid level L 3 can be expressed as: Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale Observe how certain terms in Equation (4) influence the measurement result. Figure 2 shows the influence of the camera distance d on the magnitude of the parallax effect, defined as the difference between the scale reading L 1 and the actual liquid level L 3 . The parallax is more pronounced for smaller distances between the camera and the measuring scale. Figure 3 demonstrates a contribution from the glass wall (neck) to the parallax correction, which results in a difference between the level L 2 and the liquid level L 3 . This contribution includes the effects of finite glass thickness and the refractive index of glass. As expected, the parallax effect increases with glass thickness. The light refraction in the glass results in a smaller magnitude of the parallax effect; therefore, if we were to neglect the refractive index of glass, i.e., n 2 = n 1 , this would mean overcorrecting the camera readings. According to [3], the flasks and glass gauges are usually made of borosilicate (n 2 ≈ 1.48) or soda-lime glass (n 2 ≈ 1.52). By comparing the solid and dashed blue curves in Figure 3, it can be seen that if the distance between the measuring scale and liquid remains the same, the glass itself reduces the parallax by approximately 0.4% in the considered case. For the same case, the overall parallax effect amounts to ±0.8 and ±1.5% for glass thicknesses of 3 and 6 mm, respectively. Figure 3 demonstrates a contribution from the glass wall (neck) to the parallax correction, which results in a difference between the level L2 and the liquid level L3. This contribution includes the effects of finite glass thickness and the refractive index of glass. As expected, the parallax effect increases with glass thickness. The light refraction in the glass results in a smaller magnitude of the parallax effect; therefore, if we were to neglect the refractive index of glass, i.e., n2 = n1, this would mean overcorrecting the camera readings. According to [3], the flasks and glass gauges are usually made of borosilicate (n2 ≈ 1.48) or soda-lime glass (n2 ≈ 1.52). By comparing the solid and dashed blue curves in Figure 3, it can be seen that if the distance between the measuring scale and liquid remains the same, the glass itself reduces the parallax by approximately 0.4% in the considered case. For the same case, the overall parallax effect amounts to ±0.8 and ±1.5% for glass thicknesses of 3 and 6 mm, respectively. Figure 3 demonstrates a contribution from the glass wall (neck) to the parallax correction, which results in a difference between the level L2 and the liquid level L3. This contribution includes the effects of finite glass thickness and the refractive index of glass. As expected, the parallax effect increases with glass thickness. The light refraction in the glass results in a smaller magnitude of the parallax effect; therefore, if we were to neglect the refractive index of glass, i.e., n2 = n1, this would mean overcorrecting the camera readings. According to [3], the flasks and glass gauges are usually made of borosilicate (n2 ≈ 1.48) or soda-lime glass (n2 ≈ 1.52). By comparing the solid and dashed blue curves in Figure 3, it can be seen that if the distance between the measuring scale and liquid remains the same, the glass itself reduces the parallax by approximately 0.4% in the considered case. For the same case, the overall parallax effect amounts to ±0.8 and ±1.5% for glass thicknesses of 3 and 6 mm, respectively. Parallax Correction with Tilted Camera If the centreline of the camera and the measuring scale are not perpendicular, the parallax correction model from Section 2.1 needs to be upgraded with the effect of the Parallax Correction with Tilted Camera If the centreline of the camera and the measuring scale are not perpendicular, the parallax correction model from Section 2.1 needs to be upgraded with the effect of the camera tilt angle. The effect of the tilt angle γ, which is measured in a clockwise direction, is schematically presented in Figure 4. According to Figure 4 and using Equation (4), the liquid level L3 is equal to the following: Parallax Correction with Tilted Camera Since the distance L1 is measured from the centreline of the camera, which is no longer horizontal, we must calculate the viewing angle (α + γ). This can be determined as: Parallax Correction with Tilted Camera where L4 is equal to the following: Parallax Correction with Tilted Camera Inserting Equations (6) and (7) into Equation (5), liquid level L3 can be expressed as: Figure 5 shows the difference between the parallax effect for γ = 0 and the parallax effect for three different tilt angles of the camera in both directions. The observed difference increases with the tilt angle; it is negative for positive tilt angles and positive for negative tilt angles. One can see that the camera tilt effect has small nonlinearity over the range of simulated liquid levels. Additional simulations showed that this nonlinearity becomes more significant with the decreasing distance d. The presented results can be interpreted as a contribution of the tilt angle uncertainty to the uncertainty of the measured According to Figure 4 and using Equation (4), the liquid level L 3 is equal to the following: Parallax Correction with Tilted Camera Since the distance L 1 is measured from the centreline of the camera, which is no longer horizontal, we must calculate the viewing angle (α + γ). This can be determined as: Parallax Correction with Tilted Camera where L 4 is equal to the following: Parallax Correction with Tilted Camera Inserting Equations (6) and (7) into Equation (5), liquid level L 3 can be expressed as: Figure 5 shows the difference between the parallax effect for γ = 0 and the parallax effect for three different tilt angles of the camera in both directions. The observed difference increases with the tilt angle; it is negative for positive tilt angles and positive for negative tilt angles. One can see that the camera tilt effect has small nonlinearity over the range of simulated liquid levels. Additional simulations showed that this nonlinearity becomes more significant with the decreasing distance d. The presented results can be interpreted as a contribution of the tilt angle uncertainty to the uncertainty of the measured liquid level (related to the inability to position the camera ideally perpendicular to the measuring scale). liquid level (related to the inability to position the camera ideally perpendicular to the measuring scale). Measuring System The machine vision system was tested in a laboratory environment. Although the developed measuring system is mainly intended for measurements of liquids other than water, water was chosen as a testing medium to conduct the level detection of more transparent liquids. The measurements were performed on the standard capacity measure with a nominal capacity of 100 L (Aleksander Lozar). The measuring scale division represents 10 mL, which is equal to 0.01% of the nominal capacity, and one scale division is approximately 1 mm. Images were captured using a standard web camera (Razer, Kiyo, resolution: 1920 × 1080 pixels) and processed in LabVIEW Vision Development Module. The camera was fixed and positioned perpendicular to the measuring scale (γ ≈ 0°) with its centre close to the zero-scale mark. The perpendicular position was achieved by ensuring that the vertical distances measured in pixels in the acquired image between the scale mark i(0) in the centre of the image and the scale marks, which are at some given distance ±∆i from i(0), were equal. Figure 6 shows the measuring system with the camera and the capacity measure under tests. All parameters of the measuring system are defined in Table 1. The distances were measured using a measuring tape and a slide gauge. The average distance between the scale marks was determined by dividing the length of the measuring scale by the total number of scale divisions. Measuring System The machine vision system was tested in a laboratory environment. Although the developed measuring system is mainly intended for measurements of liquids other than water, water was chosen as a testing medium to conduct the level detection of more transparent liquids. The measurements were performed on the standard capacity measure with a nominal capacity of 100 L (Aleksander Lozar). The measuring scale division represents 10 mL, which is equal to 0.01% of the nominal capacity, and one scale division is approximately 1 mm. Images were captured using a standard web camera (Razer, Kiyo, resolution: 1920 × 1080 pixels) and processed in LabVIEW Vision Development Module. The camera was fixed and positioned perpendicular to the measuring scale (γ ≈ 0 • ) with its centre close to the zero-scale mark. The perpendicular position was achieved by ensuring that the vertical distances measured in pixels in the acquired image between the scale mark i(0) in the centre of the image and the scale marks, which are at some given distance ±∆i from i(0), were equal. Figure 6 shows the measuring system with the camera and the capacity measure under tests. All parameters of the measuring system are defined in Table 1. The distances were measured using a measuring tape and a slide gauge. The average distance between the scale marks was determined by dividing the length of the measuring scale by the total number of scale divisions. d-distance between the camera and the measuring scale (238 ± 2) mm ds-distance between the measuring scale and the glass (5.0 ± 0.2) mm dg-thickness of the glass (5.0 ± 0.5) mm n1-refractive index of air 1 n1-refractive index of glass 1.52 ± 0.05 k1-distance between the scale marks (1.0100 ± 0.0025) mm k2-measuring scale division 10 ml γ-tilt angle of the camera 0° ± 0.5° Figure 7 shows the operational diagram of the computer program used to determine the liquid level from the captured images, which comprises the following steps. d-distance between the camera and the measuring scale (238 ± 2) mm ds-distance between the measuring scale and the glass (5.0 ± 0.2) mm dg-thickness of the glass (5.0 ± 0.5) mm n1-refractive index of air 1 n1-refractive index of glass 1.52 ± 0.05 k1-distance between the scale marks (1.0100 ± 0.0025) mm k2-measuring scale division 10 ml γ-tilt angle of the camera 0° ± 0.5° Figure 7 shows the operational diagram of the computer program used to determine the liquid level from the captured images, which comprises the following steps. Step 1: Image Capturing and Preprocessing Measuring System The process of liquid level determination is initiated by acquiring the image of the liquid column in the capacity measure with the transparent neck. Once the image is obtained, it is converted into a monochrome image, which is helpful for further processing (edge detection). In the case of transparent liquid, it does not matter which (monochrome) colour plane is used, but with coloured liquids, choosing the right colour plane could provide more reliable and consistent results. Measuring System Step 2: Scale Mark Detection Measuring System The reading of the marks of the measuring scale in the acquired image is carried out in several steps. First, the measuring scale is detected either by using pattern recognition or within the predefined region of interest, if the camera is expected to remain in a fixed position. For the measurements in this paper, we used the second method (see the region of interest marked by the red lines in Figure 8). Next, all the scale marks are read along the selected line (see the green line in Figure 8) using the LabVIEWs built-in Advance Edge Tool edge detection procedure, which is based on finding the maxima and minima of a Fourier transform of the first derivative of grey level intensities along the given direction. Considering the finite thickness of each mark, their centreline is determined as the central position between the detected upper and lower bounds. Scale marks are indexed from the bottom up, starting at the first detected scale mark with index i = 0. The vertical distance of each scale mark from the centre of the image (r i ) is measured in pixels. The uncertainty of the scale mark detection also depends on the vertical image resolution; the scale division equals approximately 5.75 pixels for the present system configuration. Measuring System (edge detection). In the case of transparent liquid, it does not matter which (monochrome) colour plane is used, but with coloured liquids, choosing the right colour plane could provide more reliable and consistent results. Measuring System Step 2: Scale Mark Detection Measuring System The reading of the marks of the measuring scale in the acquired image is carried out in several steps. First, the measuring scale is detected either by using pattern recognition or within the predefined region of interest, if the camera is expected to remain in a fixed position. For the measurements in this paper, we used the second method (see the region of interest marked by the red lines in Figure 8). Next, all the scale marks are read along the selected line (see the green line in Figure 8) using the LabVIEWs built-in Advance Edge Tool edge detection procedure, which is based on finding the maxima and minima of a Fourier transform of the first derivative of grey level intensities along the given direction. Considering the finite thickness of each mark, their centreline is determined as the central position between the detected upper and lower bounds. Scale marks are indexed from the bottom up, starting at the first detected scale mark with index i = 0. The vertical distance of each scale mark from the centre of the image (ri) is measured in pixels. The uncertainty of the scale mark detection also depends on the vertical image resolution; the scale division equals approximately 5.75 pixels for the present system configuration. Step 3: Liquid Level Detection The liquid level is also determined by the above-mentioned LabVIEWs built-in edge detection procedure. The edge detection is carried out on multiple vertical lines across the fluid area (the blue lines in Figure 8), in order to eliminate the outliers that are caused by the effects of discrete air bubbles or droplets that might be present in the observed area. The meniscus is searched for in the bottom-up direction; in this way, the lowest point of the meniscus is detected (the purple line in Figure 8), and the pixel value of that position rliquid is determined. Step 3: Liquid Level Detection The correct reading of the meniscus with the machine vision system was found to be more challenging when the liquid level was significantly below the camera centreline. In Step 3: Liquid Level Detection The liquid level is also determined by the above-mentioned LabVIEWs built-in edge detection procedure. The edge detection is carried out on multiple vertical lines across the fluid area (the blue lines in Figure 8), in order to eliminate the outliers that are caused by the effects of discrete air bubbles or droplets that might be present in the observed area. The meniscus is searched for in the bottom-up direction; in this way, the lowest point of the meniscus is detected (the purple line in Figure 8), and the pixel value of that position r liquid is determined. Step 3: Liquid Level Detection The correct reading of the meniscus with the machine vision system was found to be more challenging when the liquid level was significantly below the camera centreline. In addition, the current tests were carried out with water, for which the detection of the liquid level is generally more difficult and more susceptible to the lighting conditions than in the case of coloured fluids (i.e., motor fuels). However, based on repeated tests also taking into account the camera being positioned at different vertical positions (heights), it was estimated that the uncertainty of the meniscus reading was better than a 0.75 scale interval (≈7.5 mL). Step 4: Lens Correction Lens distortion typically results in changes of the dimensional ratios of the image in the form of a barrel, pincushion distortions or combination of both [6]. Distortion is basically a two-dimensional effect and many algorithms for its correction have already been proposed, e.g., [18,19]. In our case, we describe the lens distortion as one-dimensional, because the lens correction parameters can be calculated using the positions of the scale marks (representing distortion-free values) detected along the given vertical line (see Figure 8). The dependency between the scale mark index (i) and the vertical pixel distance from the image centre (r i ) was found to be well approximated by a cubic polynomial function: Step 4: Lens Correction The difference between the approximated and the detected scale mark indexes versus their pixel positions is, for one case of our experiment, shown in Figure 9. It can be seen that the quality of the applied cubic approximation is approximately 0.1 of the scale interval (about 1 mL). Step 4: Lens Correction Step 4: Lens Correction Lens distortion typically results in changes of the dimensional ratios of the image in the form of a barrel, pincushion distortions or combination of both [6]. Distortion is basically a two-dimensional effect and many algorithms for its correction have already been proposed, e.g., [18,19]. In our case, we describe the lens distortion as one-dimensional, because the lens correction parameters can be calculated using the positions of the scale marks (representing distortion-free values) detected along the given vertical line (see Figure 8). The dependency between the scale mark index (i) and the vertical pixel distance from the image centre (ri) was found to be well approximated by a cubic polynomial function: Step 4: Lens Correction The difference between the approximated and the detected scale mark indexes versus their pixel positions is, for one case of our experiment, shown in Figure 9. It can be seen that the quality of the applied cubic approximation is approximately 0.1 of the scale interval (about 1 mL). Finally, the liquid level L1 (as defined in Figures 1 or 5) is calculated from the detected pixel value of the liquid level rliquid as follows: Step 4: Lens Correction where k1 is the scale division in the length unit. Step 4: Lens Correction Step 5: Parallax Correction Step 4: Lens Correction Since the camera was positioned perpendicular to the measuring scale (γ = 0°), the parallax correction was based on Equation (4). The values of all parameters appearing in Finally, the liquid level L 1 (as defined in Figure 1 or Figure 5) is calculated from the detected pixel value of the liquid level r liquid as follows: Step 4: Lens Correction where k 1 is the scale division in the length unit. Step 4: Lens Correction Step 5: Parallax Correction Step 4: Lens Correction Since the camera was positioned perpendicular to the measuring scale (γ = 0 • ), the parallax correction was based on Equation (4). The values of all parameters appearing in this equation are given in Table 1. The estimated relative uncertainty of the liquid level (L 3 ) related to the measured distances, glass thickness, and its index of refraction is approximately 0.16%, i.e., approximately 0.13 mm (or approximately 1.3 mL) at the boundaries of the measuring range (−800 to 800 mL relative to the nominal capacity of 100 L) covered in the conducted experiment (see Section 4). The effect related to the camera tilt correction given in Equation (8) is, in our case, where tilt is believed to be smaller than 0.5 • , estimated to be at most 0.05 mm across the measuring scale (see also Figure 5). Step 4: Lens Correction Step 6: Zeroing and Unit Conversion Up to this point, we determined the liquid level L 3 as a distance from the image centre. Finally, this result is converted to the (volume) reading of the capacity measure, i.e., the deviation from the nominal capacity ∆V. The computer program allows the user to preliminarily identify the scale mark which corresponds to the nominal volume or ∆V = 0 (index i 0 ). Its distance from the image centre is calculated according to Equation (10), L 0 = (i 0 − i(0))k 1 . Then, the reading of the capacity measures is determined as: Step 4: Lens Correction where k 2 is the measuring scale division. Results and Discussion The validation of the machine vision system was performed in a laboratory environment using the measuring system described earlier. The standard capacity measure was gradually filled with water in the range of scale marks from −800 to 800 mL in steps of approximately 50 mL, where the scale marks represent the deviation relative to its nominal capacity of 100 L. The readings of liquid levels were taken by two operators (operator 1 and 2), as well as by using the machine vision system. The maximum error of the reading of the liquid level by the operator is estimated to be at most half of the scale division (5 mL), which is also in accordance with the observed deviation of the operators' readings shown in Figure 10. correction given in Equation (8) is, in our case, where tilt is believed to be smaller than 0.5°, estimated to be at most 0.05 mm across the measuring scale (see also Figure 5). Results and Discussion Step 6: Zeroing and Unit Conversion Up to this point, we determined the liquid level L3 as a distance from the image centre. Finally, this result is converted to the (volume) reading of the capacity measure, i.e., the deviation from the nominal capacity ∆V. The computer program allows the user to preliminarily identify the scale mark which corresponds to the nominal volume or ∆V = 0 (index i0). Its distance from the image centre is calculated according to Equation (10), Results and Discussion . Then, the reading of the capacity measures is determined as: Results and Discussion where k2 is the measuring scale division. Results and Discussion The validation of the machine vision system was performed in a laboratory environment using the measuring system described earlier. The standard capacity measure was gradually filled with water in the range of scale marks from −800 to 800 mL in steps of approximately 50 mL, where the scale marks represent the deviation relative to its nominal capacity of 100 L. The readings of liquid levels were taken by two operators (operator 1 and 2), as well as by using the machine vision system. The maximum error of the reading of the liquid level by the operator is estimated to be at most half of the scale division (5 mL), which is also in accordance with the observed deviation of the operators' readings shown in Figure 10. The uncertainty of the machine vision measuring system can be estimated from relevant uncertainty components discussed in steps 2 to 5 of Section 3: (i) parallax correction, Figure 10. Deviation between the operators' readings for different liquid levels. Results and Discussion The uncertainty of the machine vision measuring system can be estimated from relevant uncertainty components discussed in steps 2 to 5 of Section 3: (i) parallax correction, (ii) lens distortion, (iii) image resolution and (iv) the reading of the meniscus. The uncertainty of the meniscus reading is at least four times greater than all other contributions; therefore, the overall expanded uncertainty of the machine vision can be estimated to be equal to 7.5 mL (k = 2). Results and Discussion The deviation between the results read by the machine vision system and the operators for different liquid levels are shown in Figure 11. It is evident that only at one measuring point, the deviation between the measurement results of the automated system and the operators exceeded 10 mL. The shown deviations seem random, except maybe in the range ∆V < −400 mL, where the liquid levels detected by the automated system are always higher than those read by the operators, but do not exceed 10 mL. equal to 7.5 mL (k = 2). Results and Discussion The deviation between the results read by the machine vision system and the operators for different liquid levels are shown in Figure 11. It is evident that only at one measuring point, the deviation between the measurement results of the automated system and the operators exceeded 10 mL. The shown deviations seem random, except maybe in the range ∆V < −400 mL, where the liquid levels detected by the automated system are always higher than those read by the operators, but do not exceed 10 mL. Figure 11. Deviations between the readings of the machine vision system and the operators for different liquid levels. Results and Discussion The average value of the deviations shown in Figure 11 is 1.9 mL, and the experimental standard deviation is 4.5 mL. Considering the estimated maximum reading error by the operator of 5 mL (a half-width of the rectangular distribution) and the estimated expanded uncertainty of the automated system of 7.5 mL (a coverage factor k = 2), the standard uncertainty of the deviation can be-according to , which corresponds very well to the actual dispersion of the results. The results show the comparability of the automated system with the human operator and prove that the quality of readings with the machine vision system is certainly good enough for applications in the legal metrology, where the target expanded uncertainties are of the order of 0.1% (see discussion in Section 1), i.e., 100 mL for the 100 L capacity measure. Conclusions The present article focuses on the automation of the reading process of standard capacity measures, which represents commonly used volume standards for the testing and inspection of measuring systems for liquids other than water. We implemented a low-cost machine vision measuring system with a single fixed digital web camera that was positioned laterally to the transparent neck of the capacity measure. The measured quantity was determined by the digital processing algorithm in the LabVIEW programming environment, which includes the detection of the scale marks and the liquid meniscus with Figure 11. Deviations between the readings of the machine vision system and the operators for different liquid levels. Conclusions The average value of the deviations shown in Figure 11 is 1.9 mL, and the experimental standard deviation is 4.5 mL. Considering the estimated maximum reading error by the operator of 5 mL (a half-width of the rectangular distribution) and the estimated expanded uncertainty of the automated system of 7.5 mL (a coverage factor k = 2), the standard uncertainty of the deviation can be-according to JCGM 100:2008 [20]-calculated as 5 mL/ √ 3 2 + (7.5 mL/2) 2 = 4.7 mL, which corresponds very well to the actual dispersion of the results. The results show the comparability of the automated system with the human operator and prove that the quality of readings with the machine vision system is certainly good enough for applications in the legal metrology, where the target expanded uncertainties are of the order of 0.1% (see discussion in Section 1), i.e., 100 mL for the 100 L capacity measure. Conclusions The present article focuses on the automation of the reading process of standard capacity measures, which represents commonly used volume standards for the testing and inspection of measuring systems for liquids other than water. We implemented a low-cost machine vision measuring system with a single fixed digital web camera that was positioned laterally to the transparent neck of the capacity measure. The measured quantity was determined by the digital processing algorithm in the LabVIEW programming environment, which includes the detection of the scale marks and the liquid meniscus with integrated edge detection algorithms, and corrections of the lens distortion and the parallax effects. The theory of the latter was discussed in detail. The testing and validation of the developed measuring system was performed by comparing its reading of the liquid level in a standard capacity measure filled with water with the readings made by the operators. The results showed no significant systematic errors, which confirms the proper setup of the measuring system and adequate treatment of its influential factors. The dispersion of the comparison results was of the same order as the estimated reading uncertainties. The developed measuring system reduces the time needed for measurement compared to the human operator and facilitates the reading of the liquid level in places that are difficult to access. Conclusions The tests confirmed the appropriateness of the presented machine vision measuring system for the field of legal metrology. However, to ensure the quality of the measured values, the tilt of the camera should be set to zero (within permissible deviation for the system under interest), and special care must be taken to provide suitable lighting conditions. These have a significant effect on the edge detection (of the meniscus), which proves important when dealing with transparent fluids and capacity measures with narrow necks, where the surface tension effect is greater, and the related rounding of the meniscus is more pronounced. Even if the measuring object is naturally lit, the use of an artificial light source is recommended, because it can ensure more constant lighting conditions and, therefore, a more stable output from the measuring system. Conclusions The presented machine vision system can also be used with liquids other than water. It was found that it is even less susceptible to lighting conditions if applied to measure the levels of nontransparent liquids, e.g., motor fuels, because a much clearer edge of the liquid can be obtained in such cases, even in suboptimal lighting conditions. Future improvements in the measuring system can be made by automating a detection of the camera tilt angle, which might be possible from its effect on the distortion of the scale mark readings.

섹션 본문 61문단 · 37,112자

Introduction

2Capacity measures are commonly used volume standards for the testing and inspection of measuring systems for liquids other than water. Depending on their nominal volume, the capacity measures can be categorized into the following [1]: standard glass flasks (≤10 L), standard test measures (≤20 L) and prover tanks (up to several thousand liters). Despite the fact that the last two types are made of steel, their neck part is made of a glass tube, or has glass plates or separate and fixed gauge glasses [1]. They are all equipped with scale marks corresponding to their nominal capacity and to at least 1% below and above the nominal capacity [1]. For type approval tests, the requirement for the expanded uncertainty of the determination of errors on the indication of the measured quantity is one-fifth of the maximum permissible error, i.e., 0.1% for measuring systems with an accuracy class of 0.5 [2]. For all capacity measures, the diameter of the neck or of the glass gauge should be large enough to minimize the capillary and meniscus effects; however, the reading of the meniscus (its curvature and fluctuations) represents an important contribution to the uncertainty and repeatability of the volume determined by standard capacity measures [3,4]. The operator needs to be certain that the reading uncertainty is small enough in view of the requirement for the combined expanded uncertainty. Manual (visual) liquid level detection and obtaining readings from the measuring scale can often be time consuming and difficult due to the location of the capacity measure or the nature of the measured liquid. As the capacity measures are calibrated against their scale marks, any automated measuring system also must detect the liquid level with respect to the attached measuring scale. Therefore, it is evident that the automation of such measuring procedures cannot be realized using the traditional techniques for liquid level measurement (such as capacitance or pressure transducers, ultrasonic and radar methods, tuning forks [5]). An alternative utilizes the application of machine vision, where a camera is used for image acquisition, and computer vision techniques are used for processing the Sensors 2021, 21, 2676 2 of 13 acquired images. The aim of this article is to present a simple, configurable and low-cost machine vision system capable of reading the liquid level with respect to the attached measuring scale, which is applicable for the purposes of legal metrology. It consists of a standard web camera and a PC including the LabVIEW software for image processing. The developed system compensates for the lens distortion and parallax effect [6,7], which are consequence of lens imperfections, physical properties of light and some distance between the measuring scale of the capacity measure and the liquid column. The magnitudes of these corrections are dependent on geometrical distances in the measuring system, which means that the machine vision system must be configured and validated for each individual application. Due to this, the presented measuring systems are especially employable for liquid level measurement in fixed applications, such as tank provers.

3In the available literature, we can find some similarly configured machine vision measuring systems with a single camera that are used in other applications requiring the detection of liquid level. Chakravarthy et al. [8] and Gaber et al. [9] employed a light source that illuminated the surface of the liquid, while the corresponding light pattern on the surface of the liquid was imaged by a digital camera. In a similar system, the liquid level detection in a tank is based on the pixel count of the float in the captured image [10]. Another type of measuring system for water levels in rivers uses the image of the level gauge immersed in water, which is captured by a laterally positioned camera [11][12][13]. Refs. [14][15][16][17] present machine vision systems for the detection of liquid levels in applications similar to the one we are interested in. Pithadiya et al. [14] present an application for the detection of under-or overfilled bottles with emphasis on edge detection algorithms, while Eppel and Kachman [15] inspect the applicability of computer vision techniques for the recognition of liquid levels in various transparent containers. A later study suggests that good accuracy of liquid-air boundaries can be achieved with various edge detection methods. Samman [16] presents a LabVIEW based system for liquid level and colour monitoring in glass cylinders during chemical reaction. Liu et al. [17] expose the importance of lighting conditions in machine vision systems used for the detection of a water-oil interface.

4This paper is structured as follows. Section 2 presents the background of the parallax correction model, including the effects of a tilted camera. Section 3 describes the test setup and the signal processing algorithm, which also includes image correction for lens distortion and parallax effects. In Section 4, the measuring system for liquid level detection in standard capacity measures is experimentally tested and validated by comparing the automated measurement results with those taken by two operators.

Parallax Correction

5Due to the distance between the measuring scale of the capacity measure and the liquid column, every optical system is generally susceptible to parallax effects [5]. The parallax is a shift of the apparent position of the liquid level in the background, regarding the measuring scale positioned in the foreground. When the liquid level is not aligned with the central axis of the camera, the parallax error occurs. This effect can be reduced by adjusting the camera so that it remains aligned with the liquid level, or by considering corrections after the image is captured. In this article, we use the camera in a fixed position and perform corrections of the parallax during image processing, which is crucial for achieving the accuracy of the measured values. This section presents the theoretical foundations for the parallax correction of two different cases: (i) parallax correction for the camera with its centreline positioned perpendicular to the measuring scale and (ii) parallax correction for the tilted camera.

Parallax Correction for the Camera Centreline Perpendicular to the Measuring Scale

6Assuming that the camera is positioned perpendicular, as shown in Figure 1, the actual liquid level L 3 is not equal to the apparent position of the liquid level L 1 read by the camera from the measuring scale. The determination of the actual liquid level L 3 is affected Assuming that the camera is positioned perpendicular, as shown in Figure 1, the actual liquid level L3 is not equal to the apparent position of the liquid level L1 read by the camera from the measuring scale. The determination of the actual liquid level L3 is affected by the distance between the camera and the measuring scale (d), the distance between the measuring scale and the glass neck (ds), and by the glass thickness (dg). According to Figure 1, the liquid level L3 can be calculated as follows:

7where L2 can be related to L1 by a similar triangle principle:

8(2) and the angle β is defined according to Snell's law by the ratio between refractive indices of air (n1 ≈ 1) and glass (n2):

9The refraction index of glass is higher than that of air (n2 > n1); therefore, the angle of refraction β is smaller than the angle of incidence α. Expressing the angle α as

10, the liquid level L3 can be expressed as:

11Observe how certain terms in Equation (4) influence the measurement result. Figure 2 shows the influence of the camera distance d on the magnitude of the parallax effect, defined as the difference between the scale reading L1 and the actual liquid level L3. The parallax is more pronounced for smaller distances between the camera and the measuring scale.

12Measuring scale Liquid column According to Figure 1, the liquid level L 3 can be calculated as follows:

13where L 2 can be related to L 1 by a similar triangle principle:

14and the angle β is defined according to Snell's law by the ratio between refractive indices of air (n 1 ≈ 1) and glass (n 2 ): sin β = n 1 n 2 sin α

15The refraction index of glass is higher than that of air (n 2 > n 1 ); therefore, the angle of refraction β is smaller than the angle of incidence α. Expressing the angle α as α = arctan(L 1 /d), the liquid level L 3 can be expressed as:

16Observe how certain terms in Equation (4) influence the measurement result. Figure 2 shows the influence of the camera distance d on the magnitude of the parallax effect, defined as the difference between the scale reading L 1 and the actual liquid level L 3 . The parallax is more pronounced for smaller distances between the camera and the measuring scale. Figure 3 demonstrates a contribution from the glass wall (neck) to the parallax correction, which results in a difference between the level L 2 and the liquid level L 3 . This contribution includes the effects of finite glass thickness and the refractive index of glass. As expected, the parallax effect increases with glass thickness. The light refraction in the glass results in a smaller magnitude of the parallax effect; therefore, if we were to neglect the refractive index of glass, i.e., n 2 = n 1 , this would mean overcorrecting the camera readings. According to [3], the flasks and glass gauges are usually made of borosilicate (n 2 ≈ 1.48) or soda-lime glass (n 2 ≈ 1.52). By comparing the solid and dashed blue curves in Figure 3, it can be seen that if the distance between the measuring scale and liquid remains the same, the glass itself reduces the parallax by approximately 0.4% in the considered case. For the same case, the overall parallax effect amounts to ±0.8 and ±1.5% for glass thicknesses of 3 and 6 mm, respectively. Figure 3 demonstrates a contribution from the glass wall (neck) to the parallax correction, which results in a difference between the level L2 and the liquid level L3. This contribution includes the effects of finite glass thickness and the refractive index of glass. As expected, the parallax effect increases with glass thickness. The light refraction in the glass results in a smaller magnitude of the parallax effect; therefore, if we were to neglect the refractive index of glass, i.e., n2 = n1, this would mean overcorrecting the camera readings. According to [3], the flasks and glass gauges are usually made of borosilicate (n2 ≈ 1.48) or soda-lime glass (n2 ≈ 1.52). By comparing the solid and dashed blue curves in Figure 3, it can be seen that if the distance between the measuring scale and liquid remains the same, the glass itself reduces the parallax by approximately 0.4% in the considered case. For the same case, the overall parallax effect amounts to ±0.8 and ±1.5% for glass thicknesses of 3 and 6 mm, respectively. Figure 3 demonstrates a contribution from the glass wall (neck) to the parallax correction, which results in a difference between the level L2 and the liquid level L3. This contribution includes the effects of finite glass thickness and the refractive index of glass. As expected, the parallax effect increases with glass thickness. The light refraction in the glass results in a smaller magnitude of the parallax effect; therefore, if we were to neglect the refractive index of glass, i.e., n2 = n1, this would mean overcorrecting the camera readings. According to [3], the flasks and glass gauges are usually made of borosilicate (n2 ≈ 1.48) or soda-lime glass (n2 ≈ 1.52). By comparing the solid and dashed blue curves in Figure 3, it can be seen that if the distance between the measuring scale and liquid remains the same, the glass itself reduces the parallax by approximately 0.4% in the considered case. For the same case, the overall parallax effect amounts to ±0.8 and ±1.5% for glass thicknesses of 3 and 6 mm, respectively.

Parallax Correction with Tilted Camera

17If the centreline of the camera and the measuring scale are not perpendicular, the parallax correction model from Section 2.1 needs to be upgraded with the effect of the

18If the centreline of the camera and the measuring scale are not perpendicular, the parallax correction model from Section 2.1 needs to be upgraded with the effect of the camera tilt angle. The effect of the tilt angle γ, which is measured in a clockwise direction, is schematically presented in Figure 4. According to Figure 4 and using Equation (4), the liquid level L3 is equal to the following:

19Since the distance L1 is measured from the centreline of the camera, which is no longer horizontal, we must calculate the viewing angle (α + γ). This can be determined as:

20where L4 is equal to the following:

21Inserting Equations (6) and (7) into Equation (5), liquid level L3 can be expressed as: Figure 5 shows the difference between the parallax effect for γ = 0 and the parallax effect for three different tilt angles of the camera in both directions. The observed difference increases with the tilt angle; it is negative for positive tilt angles and positive for negative tilt angles. One can see that the camera tilt effect has small nonlinearity over the range of simulated liquid levels. Additional simulations showed that this nonlinearity becomes more significant with the decreasing distance d. The presented results can be interpreted as a contribution of the tilt angle uncertainty to the uncertainty of the measured According to Figure 4 and using Equation (4), the liquid level L 3 is equal to the following:

22Since the distance L 1 is measured from the centreline of the camera, which is no longer horizontal, we must calculate the viewing angle (α + γ). This can be determined as:

23where L 4 is equal to the following:

24Inserting Equations (6) and (7) into Equation (5), liquid level L 3 can be expressed as: Figure 5 shows the difference between the parallax effect for γ = 0 and the parallax effect for three different tilt angles of the camera in both directions. The observed difference increases with the tilt angle; it is negative for positive tilt angles and positive for negative tilt angles. One can see that the camera tilt effect has small nonlinearity over the range of simulated liquid levels. Additional simulations showed that this nonlinearity becomes more significant with the decreasing distance d. The presented results can be interpreted as a contribution of the tilt angle uncertainty to the uncertainty of the measured liquid level (related to the inability to position the camera ideally perpendicular to the measuring scale). liquid level (related to the inability to position the camera ideally perpendicular to the measuring scale).

Measuring System

25The machine vision system was tested in a laboratory environment. Although the developed measuring system is mainly intended for measurements of liquids other than water, water was chosen as a testing medium to conduct the level detection of more transparent liquids. The measurements were performed on the standard capacity measure with a nominal capacity of 100 L (Aleksander Lozar). The measuring scale division represents 10 mL, which is equal to 0.01% of the nominal capacity, and one scale division is approximately 1 mm. Images were captured using a standard web camera (Razer, Kiyo, resolution: 1920 × 1080 pixels) and processed in LabVIEW Vision Development Module. The camera was fixed and positioned perpendicular to the measuring scale (γ ≈ 0°) with its centre close to the zero-scale mark. The perpendicular position was achieved by ensuring that the vertical distances measured in pixels in the acquired image between the scale mark i(0) in the centre of the image and the scale marks, which are at some given distance ±∆i from i(0), were equal. Figure 6 shows the measuring system with the camera and the capacity measure under tests. All parameters of the measuring system are defined in Table 1. The distances were measured using a measuring tape and a slide gauge. The average distance between the scale marks was determined by dividing the length of the measuring scale by the total number of scale divisions.

26The machine vision system was tested in a laboratory environment. Although the developed measuring system is mainly intended for measurements of liquids other than water, water was chosen as a testing medium to conduct the level detection of more transparent liquids. The measurements were performed on the standard capacity measure with a nominal capacity of 100 L (Aleksander Lozar). The measuring scale division represents 10 mL, which is equal to 0.01% of the nominal capacity, and one scale division is approximately 1 mm. Images were captured using a standard web camera (Razer, Kiyo, resolution: 1920 × 1080 pixels) and processed in LabVIEW Vision Development Module. The camera was fixed and positioned perpendicular to the measuring scale (γ ≈ 0 • ) with its centre close to the zero-scale mark. The perpendicular position was achieved by ensuring that the vertical distances measured in pixels in the acquired image between the scale mark i(0) in the centre of the image and the scale marks, which are at some given distance ±∆i from i(0), were equal. Figure 6 shows the measuring system with the camera and the capacity measure under tests. All parameters of the measuring system are defined in Table 1. The distances were measured using a measuring tape and a slide gauge. The average distance between the scale marks was determined by dividing the length of the measuring scale by the total number of scale divisions. d-distance between the camera and the measuring scale (238 ± 2) mm ds-distance between the measuring scale and the glass (5.0 ± 0.2) mm dg-thickness of the glass (5.0 ± 0.5) mm n1-refractive index of air 1 n1-refractive index of glass 1.52 ± 0.05 k1-distance between the scale marks (1.0100 ± 0.0025) mm k2-measuring scale division 10 ml γ-tilt angle of the camera 0° ± 0.5° Figure 7 shows the operational diagram of the computer program used to determine the liquid level from the captured images, which comprises the following steps. d-distance between the camera and the measuring scale (238 ± 2) mm ds-distance between the measuring scale and the glass (5.0 ± 0.2) mm dg-thickness of the glass (5.0 ± 0.5) mm n1-refractive index of air 1 n1-refractive index of glass 1.52 ± 0.05 k1-distance between the scale marks (1.0100 ± 0.0025) mm k2-measuring scale division 10 ml γ-tilt angle of the camera 0° ± 0.5° Figure 7 shows the operational diagram of the computer program used to determine the liquid level from the captured images, which comprises the following steps. Step 1: Image Capturing and Preprocessing

27The process of liquid level determination is initiated by acquiring the image of the liquid column in the capacity measure with the transparent neck. Once the image is obtained, it is converted into a monochrome image, which is helpful for further processing (edge detection). In the case of transparent liquid, it does not matter which (monochrome) colour plane is used, but with coloured liquids, choosing the right colour plane could provide more reliable and consistent results.

28Step 2: Scale Mark Detection

29The reading of the marks of the measuring scale in the acquired image is carried out in several steps. First, the measuring scale is detected either by using pattern recognition or within the predefined region of interest, if the camera is expected to remain in a fixed position. For the measurements in this paper, we used the second method (see the region of interest marked by the red lines in Figure 8). Next, all the scale marks are read along the selected line (see the green line in Figure 8) using the LabVIEWs built-in Advance Edge Tool edge detection procedure, which is based on finding the maxima and minima of a Fourier transform of the first derivative of grey level intensities along the given direction. Considering the finite thickness of each mark, their centreline is determined as the central position between the detected upper and lower bounds. Scale marks are indexed from the bottom up, starting at the first detected scale mark with index i = 0. The vertical distance of each scale mark from the centre of the image (r i ) is measured in pixels. The uncertainty of the scale mark detection also depends on the vertical image resolution; the scale division equals approximately 5.75 pixels for the present system configuration.

30(edge detection). In the case of transparent liquid, it does not matter which (monochrome) colour plane is used, but with coloured liquids, choosing the right colour plane could provide more reliable and consistent results.

31Step 2: Scale Mark Detection

32The reading of the marks of the measuring scale in the acquired image is carried out in several steps. First, the measuring scale is detected either by using pattern recognition or within the predefined region of interest, if the camera is expected to remain in a fixed position. For the measurements in this paper, we used the second method (see the region of interest marked by the red lines in Figure 8). Next, all the scale marks are read along the selected line (see the green line in Figure 8) using the LabVIEWs built-in Advance Edge Tool edge detection procedure, which is based on finding the maxima and minima of a Fourier transform of the first derivative of grey level intensities along the given direction. Considering the finite thickness of each mark, their centreline is determined as the central position between the detected upper and lower bounds. Scale marks are indexed from the bottom up, starting at the first detected scale mark with index i = 0. The vertical distance of each scale mark from the centre of the image (ri) is measured in pixels. The uncertainty of the scale mark detection also depends on the vertical image resolution; the scale division equals approximately 5.75 pixels for the present system configuration.

Step 3: Liquid Level Detection

33The liquid level is also determined by the above-mentioned LabVIEWs built-in edge detection procedure. The edge detection is carried out on multiple vertical lines across the fluid area (the blue lines in Figure 8), in order to eliminate the outliers that are caused by the effects of discrete air bubbles or droplets that might be present in the observed area. The meniscus is searched for in the bottom-up direction; in this way, the lowest point of the meniscus is detected (the purple line in Figure 8), and the pixel value of that position rliquid is determined.

34The correct reading of the meniscus with the machine vision system was found to be more challenging when the liquid level was significantly below the camera centreline. In

35The liquid level is also determined by the above-mentioned LabVIEWs built-in edge detection procedure. The edge detection is carried out on multiple vertical lines across the fluid area (the blue lines in Figure 8), in order to eliminate the outliers that are caused by the effects of discrete air bubbles or droplets that might be present in the observed area. The meniscus is searched for in the bottom-up direction; in this way, the lowest point of the meniscus is detected (the purple line in Figure 8), and the pixel value of that position r liquid is determined.

36The correct reading of the meniscus with the machine vision system was found to be more challenging when the liquid level was significantly below the camera centreline. In addition, the current tests were carried out with water, for which the detection of the liquid level is generally more difficult and more susceptible to the lighting conditions than in the case of coloured fluids (i.e., motor fuels). However, based on repeated tests also taking into account the camera being positioned at different vertical positions (heights), it was estimated that the uncertainty of the meniscus reading was better than a 0.75 scale interval (≈7.5 mL).

Step 4: Lens Correction

37Lens distortion typically results in changes of the dimensional ratios of the image in the form of a barrel, pincushion distortions or combination of both [6]. Distortion is basically a two-dimensional effect and many algorithms for its correction have already been proposed, e.g., [18,19]. In our case, we describe the lens distortion as one-dimensional, because the lens correction parameters can be calculated using the positions of the scale marks (representing distortion-free values) detected along the given vertical line (see Figure 8). The dependency between the scale mark index (i) and the vertical pixel distance from the image centre (r i ) was found to be well approximated by a cubic polynomial function:

38The difference between the approximated and the detected scale mark indexes versus their pixel positions is, for one case of our experiment, shown in Figure 9. It can be seen that the quality of the applied cubic approximation is approximately 0.1 of the scale interval (about 1 mL).

39Step 4: Lens Correction Lens distortion typically results in changes of the dimensional ratios of the image in the form of a barrel, pincushion distortions or combination of both [6]. Distortion is basically a two-dimensional effect and many algorithms for its correction have already been proposed, e.g., [18,19]. In our case, we describe the lens distortion as one-dimensional, because the lens correction parameters can be calculated using the positions of the scale marks (representing distortion-free values) detected along the given vertical line (see Figure 8). The dependency between the scale mark index (i) and the vertical pixel distance from the image centre (ri) was found to be well approximated by a cubic polynomial function:

40The difference between the approximated and the detected scale mark indexes versus their pixel positions is, for one case of our experiment, shown in Figure 9. It can be seen that the quality of the applied cubic approximation is approximately 0.1 of the scale interval (about 1 mL). Finally, the liquid level L1 (as defined in Figures 1 or 5) is calculated from the detected pixel value of the liquid level rliquid as follows:

41where k1 is the scale division in the length unit.

42Step 5: Parallax Correction

43Since the camera was positioned perpendicular to the measuring scale (γ = 0°), the parallax correction was based on Equation (4). The values of all parameters appearing in Finally, the liquid level L 1 (as defined in Figure 1 or Figure 5) is calculated from the detected pixel value of the liquid level r liquid as follows:

44where k 1 is the scale division in the length unit.

45Step 5: Parallax Correction

46Since the camera was positioned perpendicular to the measuring scale (γ = 0 • ), the parallax correction was based on Equation (4). The values of all parameters appearing in this equation are given in Table 1. The estimated relative uncertainty of the liquid level (L 3 ) related to the measured distances, glass thickness, and its index of refraction is approximately 0.16%, i.e., approximately 0.13 mm (or approximately 1.3 mL) at the boundaries of the measuring range (−800 to 800 mL relative to the nominal capacity of 100 L) covered in the conducted experiment (see Section 4). The effect related to the camera tilt correction given in Equation (8) is, in our case, where tilt is believed to be smaller than 0.5 • , estimated to be at most 0.05 mm across the measuring scale (see also Figure 5).

47Step 6: Zeroing and Unit Conversion Up to this point, we determined the liquid level L 3 as a distance from the image centre. Finally, this result is converted to the (volume) reading of the capacity measure, i.e., the deviation from the nominal capacity ∆V. The computer program allows the user to preliminarily identify the scale mark which corresponds to the nominal volume or ∆V = 0 (index i 0 ). Its distance from the image centre is calculated according to Equation (10), L 0 = (i 0 − i(0))k 1 . Then, the reading of the capacity measures is determined as:

48where k 2 is the measuring scale division.

Results and Discussion

49The validation of the machine vision system was performed in a laboratory environment using the measuring system described earlier. The standard capacity measure was gradually filled with water in the range of scale marks from −800 to 800 mL in steps of approximately 50 mL, where the scale marks represent the deviation relative to its nominal capacity of 100 L. The readings of liquid levels were taken by two operators (operator 1 and 2), as well as by using the machine vision system. The maximum error of the reading of the liquid level by the operator is estimated to be at most half of the scale division (5 mL), which is also in accordance with the observed deviation of the operators' readings shown in Figure 10. correction given in Equation (8) is, in our case, where tilt is believed to be smaller than 0.5°, estimated to be at most 0.05 mm across the measuring scale (see also Figure 5).

50Step 6: Zeroing and Unit Conversion Up to this point, we determined the liquid level L3 as a distance from the image centre. Finally, this result is converted to the (volume) reading of the capacity measure, i.e., the deviation from the nominal capacity ∆V. The computer program allows the user to preliminarily identify the scale mark which corresponds to the nominal volume or ∆V = 0 (index i0). Its distance from the image centre is calculated according to Equation (10),

51. Then, the reading of the capacity measures is determined as:

52where k2 is the measuring scale division.

53The validation of the machine vision system was performed in a laboratory environment using the measuring system described earlier. The standard capacity measure was gradually filled with water in the range of scale marks from −800 to 800 mL in steps of approximately 50 mL, where the scale marks represent the deviation relative to its nominal capacity of 100 L. The readings of liquid levels were taken by two operators (operator 1 and 2), as well as by using the machine vision system. The maximum error of the reading of the liquid level by the operator is estimated to be at most half of the scale division (5 mL), which is also in accordance with the observed deviation of the operators' readings shown in Figure 10. The uncertainty of the machine vision measuring system can be estimated from relevant uncertainty components discussed in steps 2 to 5 of Section 3: (i) parallax correction, Figure 10. Deviation between the operators' readings for different liquid levels.

54The uncertainty of the machine vision measuring system can be estimated from relevant uncertainty components discussed in steps 2 to 5 of Section 3: (i) parallax correction, (ii) lens distortion, (iii) image resolution and (iv) the reading of the meniscus. The uncertainty of the meniscus reading is at least four times greater than all other contributions; therefore, the overall expanded uncertainty of the machine vision can be estimated to be equal to 7.5 mL (k = 2).

55The deviation between the results read by the machine vision system and the operators for different liquid levels are shown in Figure 11. It is evident that only at one measuring point, the deviation between the measurement results of the automated system and the operators exceeded 10 mL. The shown deviations seem random, except maybe in the range ∆V < −400 mL, where the liquid levels detected by the automated system are always higher than those read by the operators, but do not exceed 10 mL. equal to 7.5 mL (k = 2).

56The deviation between the results read by the machine vision system and the operators for different liquid levels are shown in Figure 11. It is evident that only at one measuring point, the deviation between the measurement results of the automated system and the operators exceeded 10 mL. The shown deviations seem random, except maybe in the range ∆V < −400 mL, where the liquid levels detected by the automated system are always higher than those read by the operators, but do not exceed 10 mL. Figure 11. Deviations between the readings of the machine vision system and the operators for different liquid levels.

57The average value of the deviations shown in Figure 11 is 1.9 mL, and the experimental standard deviation is 4.5 mL. Considering the estimated maximum reading error by the operator of 5 mL (a half-width of the rectangular distribution) and the estimated expanded uncertainty of the automated system of 7.5 mL (a coverage factor k = 2), the standard uncertainty of the deviation can be-according to , which corresponds very well to the actual dispersion of the results. The results show the comparability of the automated system with the human operator and prove that the quality of readings with the machine vision system is certainly good enough for applications in the legal metrology, where the target expanded uncertainties are of the order of 0.1% (see discussion in Section 1), i.e., 100 mL for the 100 L capacity measure.

Conclusions

58The present article focuses on the automation of the reading process of standard capacity measures, which represents commonly used volume standards for the testing and inspection of measuring systems for liquids other than water. We implemented a low-cost machine vision measuring system with a single fixed digital web camera that was positioned laterally to the transparent neck of the capacity measure. The measured quantity was determined by the digital processing algorithm in the LabVIEW programming environment, which includes the detection of the scale marks and the liquid meniscus with Figure 11. Deviations between the readings of the machine vision system and the operators for different liquid levels.

59The average value of the deviations shown in Figure 11 is 1.9 mL, and the experimental standard deviation is 4.5 mL. Considering the estimated maximum reading error by the operator of 5 mL (a half-width of the rectangular distribution) and the estimated expanded uncertainty of the automated system of 7.5 mL (a coverage factor k = 2), the standard uncertainty of the deviation can be-according to JCGM 100:2008 [20]-calculated as 5 mL/ √ 3 2 + (7.5 mL/2) 2 = 4.7 mL, which corresponds very well to the actual dispersion of the results. The results show the comparability of the automated system with the human operator and prove that the quality of readings with the machine vision system is certainly good enough for applications in the legal metrology, where the target expanded uncertainties are of the order of 0.1% (see discussion in Section 1), i.e., 100 mL for the 100 L capacity measure.

60The present article focuses on the automation of the reading process of standard capacity measures, which represents commonly used volume standards for the testing and inspection of measuring systems for liquids other than water. We implemented a low-cost machine vision measuring system with a single fixed digital web camera that was positioned laterally to the transparent neck of the capacity measure. The measured quantity was determined by the digital processing algorithm in the LabVIEW programming environment, which includes the detection of the scale marks and the liquid meniscus with integrated edge detection algorithms, and corrections of the lens distortion and the parallax effects. The theory of the latter was discussed in detail. The testing and validation of the developed measuring system was performed by comparing its reading of the liquid level in a standard capacity measure filled with water with the readings made by the operators. The results showed no significant systematic errors, which confirms the proper setup of the measuring system and adequate treatment of its influential factors. The dispersion of the comparison results was of the same order as the estimated reading uncertainties. The developed measuring system reduces the time needed for measurement compared to the human operator and facilitates the reading of the liquid level in places that are difficult to access.

61The tests confirmed the appropriateness of the presented machine vision measuring system for the field of legal metrology. However, to ensure the quality of the measured values, the tilt of the camera should be set to zero (within permissible deviation for the system under interest), and special care must be taken to provide suitable lighting conditions. These have a significant effect on the edge detection (of the meniscus), which proves important when dealing with transparent fluids and capacity measures with narrow necks, where the surface tension effect is greater, and the related rounding of the meniscus is more pronounced. Even if the measuring object is naturally lit, the use of an artificial light source is recommended, because it can ensure more constant lighting conditions and, therefore, a more stable output from the measuring system.

62The presented machine vision system can also be used with liquids other than water. It was found that it is even less susceptible to lighting conditions if applied to measure the levels of nontransparent liquids, e.g., motor fuels, because a much clearer edge of the liquid can be obtained in such cases, even in suboptimal lighting conditions. Future improvements in the measuring system can be made by automating a detection of the camera tilt angle, which might be possible from its effect on the distortion of the scale mark readings.

참고문헌 13건

  1. Traceability and uncertainty analysis in volume measurements Measurement · Elsevier BV · 2009 10.1016/j.measurement.2009.07.016
  2. Liquid-level measurement using a single digital camera Measurement · Elsevier BV · 2008 10.1016/j.measurement.2008.10.006
  3. Comparison of Optimal Edge Detection Algorithms for Liquid Level Inspection in Bottles 2009 10.1109/icetet.2009.55
  4. Noncontact level sensing technique using computer vision IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2002 10.1109/19.997837
  5. Optical sensor system using computer vision for the level measurement in oil tankers 2008 10.1109/isie.2008.4677246
  6. Correction of image radial distortion based on division model Optical Engineering · SPIE · 2017 10.1117/1.oe.56.1.013108
  7. Automatic water-level detection using single-camera images with varied poses Measurement · Elsevier BV · 2018 10.1016/j.measurement.2018.05.100
  8. Real-time Liquid Level and color Detection system using Image Processing Academic Journal of Nawroz University · Nawroz University · 2018 10.25007/ajnu.v7n4a293
  9. In-situ water level measurement using NIR-imaging video camera Flow Measurement and Instrumentation · Elsevier BV · 2019 10.1016/j.flowmeasinst.2019.04.004
  10. A Visual Measurement of Water Content of Crude Oil Based on Image Grayscale Accumulated Value Difference Sensors · Multidisciplinary Digital Publishing Institute · 2019 10.3390/s19132963
  11. Visual Measurement of Water Level under Complex Illumination Conditions Sensors · Multidisciplinary Digital Publishing Institute · 2019 10.3390/s19194141
  12. Straight lines have to be straight Machine Vision and Applications · Springer Science+Business Media · 2001 10.1007/pl00013269
  13. Computer Vision Texts in computer science · Springer International Publishing · 2010 10.1007/978-1-84882-935-0