Metering device convenient for reading metering data
Technical Field
The invention relates to the technical field of metering devices, in particular to a metering device convenient for reading metering data.
Background
Metering devices are a type of equipment used for calculating and measuring objects or substances, and common metering devices comprise a scale used for measuring weight, a length scale used for measuring liquid volume, a measuring cup used for measuring liquid volume and the like, wherein when the measuring cup is used for metering data, the liquid is poured into the measuring cup, then the metering data are read through scale marks on the measuring cup, the accuracy of the metering device is extremely important, and the accuracy of related experimental and research results is often determined.
Through searching, the invention patent with the Chinese patent number of CN118464144A discloses a measuring cup;
compared with the prior art, when the measuring cup is required to be transferred in the medical clinical research process, the Chinese patent No. CN118464144A can fold the lower plate body onto the locking plate body, so that the occupied space of the measuring cup is reduced, and the measuring cup is convenient to store and carry. Simple structure, easy implementation, being suitable for use in the current clinical research process of medical treatment, and the cost of use is lower, can promote the benefit.
However, in the actual use process of the device, when the liquid data in the measuring cup is read, the liquid data is often difficult to read if the user is in a bottom view and a top view state, and the liquid data is difficult to accurately read if the liquid is in a use scene with higher accuracy requirements between two scale marks, so that the metering device convenient for reading the metering data is provided.
Disclosure of Invention
The invention aims to solve the defects that liquid data is difficult to read when the liquid is in a bottom view and a top view state and the liquid data is difficult to accurately read when the liquid is between two scale marks in the prior art, and provides a metering device convenient for reading metering data.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
the metering device convenient for reading metering data comprises a measuring cup, wherein a sliding rail is arranged on the outer side of the measuring cup, a supporting frame is arranged on the inner side of the sliding rail in a sliding manner, a reading system for the measuring cup is arranged on the supporting frame, and the reading system comprises;
The camera module is used for capturing images of scale marks on the measuring cup in real time;
The horizontal detection module is used for detecting the inclination angle of the measuring cup and judging the horizontal state of the measuring cup;
the image processing module is used for preprocessing the image captured by the camera module and improving the definition and contrast of the scale mark;
the machine vision module is used for identifying scale marks from the processed image and calculating scale values corresponding to the liquid level;
The data analysis module is used for calculating the volume data of the liquid according to the scale value corresponding to the liquid level;
the accurate calculation module is used for accurately calculating the volume data of the liquid between the two graduation marks;
And the user interface module is used for displaying the volume data and the liquid level change image of the liquid and providing user interaction.
The technical scheme further comprises the following steps:
The level detection module comprises an inclination sensor unit, a data processing and judging unit and a feedback output unit, wherein the inclination sensor unit is used for measuring the inclination angle of the measuring cup in real time through the inclination sensor, the data processing and judging unit is used for receiving data of the inclination sensor unit and judging the level state of the measuring cup, and the feedback output unit is used for transmitting the level state of the measuring cup to the user interface module.
The image processing module comprises a graying unit, a filtering denoising unit and a binarization processing unit, wherein the graying unit converts a color image into a gray image, complexity and processing time of image data are reduced, the filtering denoising unit removes noise in the image, image quality is improved, interference of the noise on subsequent processing steps is reduced, and the binarization processing unit converts the gray image into a binary image, so that the image is simplified, and edge detection and contour extraction are easier.
The machine vision module comprises an edge detection unit, a contour extraction unit and a position calculation unit, wherein the edge detection unit is used for identifying the scale marks and the edge information of the liquid level in the image, the contour extraction unit is used for separating the contours of the liquid level and the scale marks, and the position calculation unit is used for determining the position of the liquid level on the scale marks.
The edge detection unit detects through a Roberts operator, and the algorithm formula of the Roberts operator is as follows:
G(x,y)=\text{abs}(f(x,y)-f(x+1,y+1))+\text{abs}(f(x+1,y)-f(x,y+1))
where f (a, b) represents the gray value of the image at point (a, b).
The contour extraction unit extracts a contour through findContours, and the extraction process of findContours is as follows:
Contour marking, in which a contour is defined as the boundary of a connected region having the same pixel value in an image, findContours functions pass through pixels in the image, and mark the connected region and its boundary;
Contour extraction, namely determining a connected region and a boundary thereof, findContours extracting the boundary as a contour, and returning in a point set mode;
The outline grading is carried out, namely, the outline grading is carried out according to the nesting relation of the outline, namely, the outer outline and the inner outline are identified;
The calculation process of the position calculation unit is as follows:
Geometric transformation, namely converting pixel positions in an image into coordinates in an actual space;
calculating a scale, namely calculating the proportional relation between pixels in the image and the actual size according to the object with the known size in the image;
and analyzing the contour position, namely analyzing the extracted contour position, finding out the contour corresponding to the liquid level, and calculating the scale value corresponding to the liquid level according to the position of the scale line.
The data analysis module comprises a scale calibration unit and a scale matching unit, wherein the scale calibration unit is used for measuring and calibrating the corresponding relation between the scale lines and the volumes in advance, and the scale matching unit is used for finding the scale line closest to the liquid level and determining the corresponding volume value.
The scale matching unit searches the scale line with the closest liquid level through a linear interpolation algorithm, and the formula of the linear interpolation is as follows:
f(x)≈f(x0)+x-xf(x)-f(x)(x-x0)
Where x0 and x1 are two known data points, f (x 0) and f (x 1) are corresponding function values, and x is the interpolated point.
The calculation steps of the accurate calculation module are as follows:
determining scale values, namely determining scale values corresponding to two adjacent scale lines A and B, wherein A is 10mL, and B is 20mL;
Measuring the relative position:
measuring the relative position between the liquid and the graduation marks A and B, wherein the ratio of the distance of the liquid to the distance A to the total distance of the liquid to the graduation marks A and B is p (p is more than or equal to 0 and less than or equal to 1);
Calculating the volume of the liquid is calculated using a linear interpolation formula:
V=VA+p×(VB-VA)
Wherein V is the volume of the liquid, and VA and VB are the volumes corresponding to graduation marks A and B, respectively.
The image display unit displays images captured by the camera module in real time, visual feedback is provided, a user can observe the change of liquid level and scale marks, the information display unit displays the liquid level position, the scale values, the volume information and the horizontal state of the measuring cup on a user interface, and the user interaction unit controls the operation of opening and closing of the camera module, parameter adjustment and liquid level data storage.
The invention has the following beneficial effects:
1. According to the invention, the liquid position on the measuring cup is detected and converted into the volume data of the liquid in real time for display, so that a user can easily read the data without looking up, the operation difficulty is reduced, the user experience is improved, errors possibly generated when the scale is read manually are avoided, and the accuracy of measurement is improved.
2. According to the invention, by calculating the accurate position of the liquid level between the two scale marks, a measurement result with higher accuracy than that of the traditional scale reading can be provided, the common data of the liquid level close to the scale marks can be obtained, and various data can be output according to the needs, so that a user can select a proper data output mode according to different application scenes or needs.
3. According to the invention, the measuring cup can be ensured to be in a horizontal state through the horizontal detection module, the accuracy of measurement is ensured, and calculation errors caused by the inclination of the measuring cup are avoided.
4. According to the invention, the liquid data and the corresponding time information can be stored, a detailed history record is provided for a user, and subsequent data analysis and tracing are facilitated.
Drawings
FIG. 1 is a schematic diagram of an overall structure of a metering device for facilitating reading of metering data according to the present invention;
fig. 2 is a schematic diagram of a system frame in the present invention.
In the figure, 1, a camera module, 2, a horizontal detection module, 3, an image processing module, 4, a machine vision module, 5, a data analysis module, 6, an accurate calculation module, 7, a measuring cup, 8, a sliding rail, 9, a supporting frame, 10 and a user interface module.
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
As shown in fig. 1-2, the metering device convenient for reading metering data provided by the invention comprises a measuring cup 7, wherein a sliding rail 8 is arranged at the outer side of the measuring cup 7, a supporting frame 9 is arranged at the inner side of the sliding rail 8 in a sliding manner, a reading system for the measuring cup 7 is arranged on the supporting frame 9, and the reading system comprises;
The camera module 1 is used for capturing images of scale marks on the measuring cup 7 in real time;
the horizontal detection module 2 is used for detecting the inclination angle of the measuring cup 7 and judging the horizontal state of the measuring cup 7;
the image processing module 3 is used for preprocessing the image captured by the camera module 1;
The machine vision module 4 is used for identifying scale marks from the processed image and calculating scale values corresponding to the liquid level;
the data analysis module 5 calculates the volume data of the liquid according to the scale value corresponding to the liquid level;
An accurate calculation module 6 for accurately calculating volume data of the liquid between the two graduation marks;
a user interface module 10 for displaying volumetric data of the liquid and a level change image, providing user interaction.
In this embodiment, when data measurement is needed, the support frame 9 is slid on the slide rail 8 according to the position of the support frame 9, so that the support frame 9 is at a position convenient to view, then liquid is poured into the measuring cup 7, at this time, the camera module 1 can be started through the user interface module 10, at this time, the camera module 1 captures images of scale marks on the measuring cup 7 in real time, meanwhile, the inclination angle of the measuring cup 7 is measured in real time through the level detection module 2, the level state of the measuring cup 7 is judged, and then the level state of the measuring cup 7 is transmitted to the user interface module 10 for display, so that the measuring cup 7 is ensured to be in the level state during measurement, then the camera module 1 transmits the images to the image processing module 3 after acquiring the images of the scale marks on the measuring cup 7, and the image processing module 3 performs preprocessing including graying, filtering denoising and binarization, so that complexity and processing time of the image data are reduced, image quality is improved, interference of the subsequent processing steps is reduced, and the image is simplified, so that recognition of the machine vision module 4 is easier;
The machine vision module 4 is used for identifying the scale marks in the image and the edge information of the liquid level, separating the liquid level and the outline of the scale marks, determining the position of the liquid level on the scale marks, then, finding the scale mark closest to the liquid level according to the corresponding relation calibrated in advance through the data analysis module 5, determining the corresponding volume value, and calculating the accurate data when the liquid level is between the two scale marks through the accurate calculation module 6 according to the use scene, so that the volume data of the liquid are displayed, a user can easily read the data without looking up, errors possibly generated when the scale is read manually are avoided, the metering accuracy is improved, and a proper data output mode can be selected according to different application scenes or requirements by the user according to the flexibility.
When the detection is carried out, the image captured by the camera module 1 can be displayed in real time through the user interface module 10, visual feedback is provided, a user can observe the change of the liquid level and the scale mark, the liquid level position, the scale value, the volume information and the horizontal state of the measuring cup 7 are displayed, meanwhile, the liquid level data and the corresponding time of each time can be stored, a detailed history record is provided for the user, and the subsequent data analysis and the tracing are facilitated.
In one embodiment, the level detection module 2 includes a tilt sensor unit that measures the tilt angle of the measuring cup 7 in real time through the tilt sensor, a data processing and judging unit that receives data of the tilt sensor unit, judges the level state of the measuring cup 7, and a feedback output unit that transmits the level state of the measuring cup 7 to the user interface module 10.
In one embodiment, the image processing module 3 includes a graying unit that converts a color image into a gray image, a filtering denoising unit that removes noise in the image, and a binarization processing unit that converts the gray image into a binary image.
In one embodiment, the machine vision module 4 includes an edge detection unit that identifies the graduation marks in the image and edge information of the liquid level, a contour extraction unit that separates the liquid level and the contour of the graduation marks, and a position calculation unit that determines the position of the liquid level on the graduation marks.
In one embodiment, the edge detection unit detects through a Roberts operator, and the algorithm formula of the Roberts operator is as follows:
G(x,y)=\text{abs}(f(x,y)-f(x+1,y+1))+\text{abs}(f(x+1,y)-f(x,y+1))
where f (a, b) represents the gray value of the image at point (a, b).
7. In one embodiment, the contour extraction unit extracts the contour through findContours, and the extraction process of findContours is:
Contour marking, in which a contour is defined as the boundary of a connected region having the same pixel value in an image, findContours functions pass through pixels in the image, and mark the connected region and its boundary;
Contour extraction, namely determining a connected region and a boundary thereof, findContours extracting the boundary as a contour, and returning in a point set mode;
The outline grading is carried out, namely, the outline grading is carried out according to the nesting relation of the outline, namely, the outer outline and the inner outline are identified;
The calculation procedure of the position calculation unit is as follows:
Geometric transformation, namely converting pixel positions in an image into coordinates in an actual space;
calculating a scale, namely calculating the proportional relation between pixels in the image and the actual size according to the object with the known size in the image;
and analyzing the contour position, namely analyzing the extracted contour position, finding out the contour corresponding to the liquid level, and calculating the scale value corresponding to the liquid level according to the position of the scale line.
In one embodiment, the data analysis module 5 includes a scale calibration unit and a scale matching unit, the scale calibration unit pre-measures and calibrates the correspondence between the scale lines and the volumes, the scale matching unit finds the scale line closest to the liquid level, and determines the corresponding volume value.
In one embodiment, the scale matching unit finds the scale line with the closest liquid level by a linear interpolation algorithm, and the formula of the linear interpolation is:
f(x)≈f(x0)+x-xf(x)-f(x)(x-x0)
Where x0 and x1 are two known data points, f (x 0) and f (x 1) are corresponding function values, and x is the interpolated point.
In one embodiment, the calculation steps of the accurate calculation module are as follows:
determining scale values, namely determining scale values corresponding to two adjacent scale lines A and B, wherein A is 10mL, and B is 20mL;
Measuring the relative position:
measuring the relative position between the liquid and the graduation marks A and B, wherein the ratio of the distance of the liquid to the distance A to the total distance of the liquid to the graduation marks A and B is p (p is more than or equal to 0 and less than or equal to 1);
Calculating the volume of the liquid is calculated using a linear interpolation formula:
V=VA+p×(VB-VA)
Wherein V is the volume of the liquid, and VA and VB are the volumes corresponding to graduation marks A and B, respectively.
In one embodiment, the image display unit displays the image captured by the camera module 1 in real time, the information display unit displays the liquid level position, the scale value, the volume information and the horizontal state of the measuring cup 7 on the user interface, and the user interaction unit controls the opening and closing of the camera module 1, adjusts parameters and stores liquid level data.
Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.