Method, system and device for reading metering information of a liquid level meter
By performing adaptive binarization, HSV color space conversion, and masking on the liquid level gauge image, the adaptability of the liquid level gauge measurement information reading method in complex environments is solved, the accuracy of the measurement information is improved, and automatic robot inspection is supported.
Patent Information
- Application Number
- CN202210917159.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-01
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-08-01
AI Technical Summary
Existing methods for reading liquid level gauge measurement information are poorly adapted to changes in lighting and the cleanliness of the liquid level gauge surface in complex industrial environments, resulting in low accuracy of measurement information reading.
Image processing methods are employed, including acquiring RGB images and converting them to grayscale, adaptive binarization and erosion processing, followed by HSV color space conversion and masking, and finally obtaining the metering information of the level gauge through curve fitting.
This improved the adaptability and accuracy of liquid level gauge reading methods in complex industrial environments, and enhanced the quality of reading measurement information during automated robot inspections.
Smart Images

Figure CN115273052B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of machine vision measurement, and particularly relates to a metering information reading method, system and device of a liquid level meter. BACKGROUND
[0002] The liquid level meter is a measuring instrument frequently used in industrial production, has the advantages of high measurement accuracy, stable use, strong durability, etc., and is widely used in the fields of electric power, petroleum, chemical industry, ship, etc. In recent years, with the improvement of the degree of automation of industrial production, more and more industries begin to use robots to replace manual work to complete daily inspection, which includes automatic reading of the liquid level meter. The inspection robot processes the camera collected images through the existing mainstream target detection method (such as Faster R-CNN, YOLO, SSD, etc.), detects the liquid level meter, and crops the RGB image containing only the liquid level meter from the original camera collected image, and then reads the metering result from the image using the image processing method, wherein reading the metering result from the cropped RGB image containing only the liquid level meter is a key link. In the actual complex industrial environment, due to the change of light, combined with the possible significant difference in the neatness of the liquid level meter surface, it is challenging to accurately read the metering information of the liquid level meter. How to improve the adaptability of the liquid level meter metering information reading method to the change of light and the neatness of the liquid level meter surface by means of image processing still needs further research.
[0003] Therefore, how to propose a solution to the above problems is a problem that those skilled in the art need to solve at present. SUMMARY
[0004] In order to solve the above problems in the prior art, that is, in order to solve the problem that the adaptability of the existing liquid level meter metering information reading method to the change of light and the neatness of the liquid level meter surface is poor in the actual complex industrial environment, resulting in low accuracy of the read metering information, the present application proposes a liquid level meter metering information reading method in the first aspect, comprising the following steps:
[0005] Step S100, acquiring an RGB image containing only the liquid level meter as a first image;
[0006] Step S200, acquiring a gray image corresponding to the first image as a second image;
[0007] Step S300, sequentially performing adaptive binarization and image erosion processing on the second image, and taking the processed image as a third image;
[0008] Step S400, performing color space conversion processing on the first image, and acquiring an image in the HSV color space as a fourth image;
[0009] Step S500, performing mask processing on the fourth image to obtain a metering mask;
[0010] Step S600, obtaining coordinates of non-zero value elements in the metering mask in a pre-constructed first image coordinate system to form a first coordinate set, and taking non-repeated horizontal coordinates in the first coordinate set as first horizontal coordinates, all of which form a first horizontal coordinate set; for each first horizontal coordinate in the first horizontal coordinate set, taking the average of vertical coordinates of all coordinates with the horizontal coordinate in the first coordinate set as a first vertical coordinate, and then constructing a second coordinate set based on each first horizontal coordinate and its corresponding first vertical coordinate; performing curve fitting on the coordinates in the second coordinate set to obtain a first straight line;
[0011] Step S700, combining the coordinates in the second coordinate set, the third image and the first straight line, and obtaining a horizontal coordinate length currently metered by the liquid level meter through a preset horizontal coordinate length calculation method;
[0012] Step S800, obtaining metering information of the liquid level meter according to the horizontal coordinate length currently metered by the liquid level meter, in combination with the width of the first image and the range of the liquid level meter.
[0013] In some preferred embodiments, an RGB image containing only the liquid level meter is obtained as the first image, and the method is as follows:
[0014] The RGB image containing only the liquid level meter is cropped from the collected image, and if the liquid level meter is vertically placed, the RGB image is right-rotated by 90 degrees to obtain the first image, otherwise, the RGB image is directly taken as the first image.
[0015] In some preferred embodiments, the method for obtaining the metering mask after mask processing on the fourth image is as follows:
[0016] The fourth image is copied to obtain a fifth image, and pixels in the fourth image with H channel pixel value in [160, 180], S channel pixel value in [5, 255] and V channel pixel value in [20, 255] are set to 1, and the rest are set to 0 to obtain a first mask;
[0017] Pixels in the fifth image with H channel pixel value in [0, 6], S channel pixel value in [5, 255] and V channel pixel value in [20, 255] are set to 1, and the rest are set to 0 to obtain a second mask;
[0018] The first mask and the second mask are subjected to bitwise AND operation to obtain a third mask;
[0019] Detecting all connected domains in the third mask, selecting the maximum connected domain in the third mask to keep the element value as 1, and setting the element values of the rest connected domains as 0 to obtain a metering mask.
[0020] In some preferred embodiments, a first straight line is obtained by curve fitting on the coordinates in the second coordinate set, and the method is as follows:
[0021] In combination with the coordinates in the second coordinate set A first straight line y=ax+b is obtained by using a Hough fitting algorithm; wherein a represents the slope of the first straight line, and b represents the intercept of the first straight line.
[0022] In some preferred embodiments, in combination with the coordinates in the second coordinate set, the third image and the first straight line, a horizontal coordinate length currently metered by the liquid level meter is obtained by using a preset horizontal coordinate length calculation method, and the method is as follows:
[0023] In step S701, the second coordinate set is used to obtain a starting coordinate (x1, ax1+b) by taking x1 as the starting horizontal coordinate and ax1+b as the starting vertical coordinate.
[0024] In step S702, the horizontal coordinate of the coordinate (x1, ax1+b) is changed to x1-C n , and a third coordinate (x1-C n , a(x1-C n )+b) is obtained, wherein C n is the cycle number and is initialized as 1.
[0025] In step S703, if the pixel value corresponding to the third coordinate in the third image is 1 or the horizontal coordinate value of the third coordinate is 0, the third coordinate at this time is marked as the starting coordinate (x s , y s ) of the liquid level meter, and the step S704 is jumped to, otherwise, C n =C n +1, and the step S702 is jumped to.
[0026] In step S704, the horizontal coordinate of the coordinate (x1, ax1+b) is changed to x1+z n , and a fourth coordinate (x1+z n , a(x1+z n )+b) is obtained, wherein z n is the cycle number and is initialized as 1.
[0027] In step S705, if the pixel value corresponding to the fourth coordinate in the third image is 1 or the horizontal coordinate value of the fourth coordinate is W, the fourth coordinate at this time is marked as the terminal coordinate (x e , ye ), jump to step S706, otherwise, let z n = z n + 1, jump to step S704;
[0028] Step S706, obtain the horizontal coordinate length w = |x s -x e | of the current measurement of the liquid level meter.
[0029] In some preferred embodiments, the measurement information of the liquid level meter is obtained according to the horizontal coordinate length of the current measurement of the liquid level meter, in combination with the width of the first image and the measurement range of the liquid level meter, and the method is as follows: wherein w represents the horizontal coordinate length of the current measurement of the liquid level meter, W represents the width of the first image, and S represents the measurement range of the liquid level meter.
[0030] In a second aspect, the present application provides a measurement information reading system of a liquid level meter, which comprises a first image acquisition module, a second image acquisition module, a third image acquisition module, a fourth image acquisition module, a mask processing module, a curve fitting module, a horizontal coordinate length calculation module, and a measurement information acquisition module.
[0031] The first image acquisition module is configured to acquire an RGB image containing only the liquid level meter as the first image.
[0032] The second image acquisition module is configured to acquire a grayscale image corresponding to the first image as the second image.
[0033] The third image acquisition module is configured to sequentially perform adaptive binarization and image erosion processing on the second image, and take the processed image as the third image.
[0034] The fourth image acquisition module is configured to perform color space conversion processing on the first image, and take the image in the HSV color space as the fourth image.
[0035] The mask processing module is configured to obtain a measurement mask by performing mask processing on the fourth image.
[0036] The curve fitting module is configured to obtain the coordinates of the non-zero value elements in the measurement mask in a pre-constructed first image coordinate system to form a first coordinate set, take the non-repeated horizontal coordinates in the first coordinate set as first horizontal coordinates, and take all the first horizontal coordinates as a first horizontal coordinate set; for each first horizontal coordinate in the first horizontal coordinate set, take the average of the vertical coordinates of all the coordinates with the horizontal coordinate in the first coordinate set as a first vertical coordinate, and then construct a second coordinate set based on each first horizontal coordinate and its corresponding first vertical coordinate; and perform curve fitting on the coordinates in the second coordinate set to obtain a first straight line.
[0037] The abscissa length calculation module is configured to obtain the abscissa length currently measured by the liquid level meter by a preset abscissa length calculation method in combination with the coordinates in the second coordinate set, the third image and the first straight line.
[0038] The measurement information acquisition module is configured to acquire the measurement information of the liquid level meter according to the abscissa length currently measured by the liquid level meter in combination with the width of the first image and the range of the liquid level meter.
[0039] In a third aspect, the present application provides a storage device, which stores a plurality of programs, and the programs are suitable for being loaded by a processor and implementing the above-mentioned liquid level meter measurement information reading method.
[0040] In a fourth aspect, the present application provides a processing device, which comprises a processor and a storage device, the processor is suitable for executing each program, and the storage device is suitable for storing a plurality of programs, and the programs are suitable for being loaded by the processor and implementing the above-mentioned liquid level meter measurement information reading method.
[0041] The present application has the following beneficial effects:
[0042] The present application solves the adaptability problem of the liquid level meter measurement information reading method to light and the change of the cleanliness of the surface of the liquid level meter in the actual complex industrial environment, improves the quality of the liquid level meter measurement information reading method, and provides technical support for the automatic inspection operation of the robot. BRIEF DESCRIPTION OF DRAWINGS
[0043] Figure 1 FIG. 1 is a flowchart of the liquid level meter measurement information reading method according to an embodiment of the present application.
[0044] Figure 2 FIG. 2 is a schematic diagram of the framework of the liquid level meter measurement information reading system according to an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme of the embodiments of the present application will be described clearly and completely below with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0046] The application will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the related application, and not to limit the application. It should be noted that the embodiments in the application and the features in the embodiments can be combined with each other without conflict.
[0047] A metering information reading method of a liquid level meter according to the present application, as shown in the figure, comprises the following steps: Figure 1
[0048] Step S100, acquiring an RGB image containing only the liquid level meter as a first image;
[0049] Step S200, acquiring a gray image corresponding to the first image, and taking it as a second image;
[0050] Step S300, sequentially performing adaptive binarization and image erosion processing on the second image, and taking the processed image as a third image;
[0051] Step S400, performing color space conversion processing on the first image, and acquiring an image in the HSV color space as a fourth image;
[0052] Step S500, performing mask processing on the fourth image to obtain a metering mask;
[0053] Step S600, acquiring the coordinates of the non-zero value elements in the metering mask in the pre-constructed first image coordinate system to form a first coordinate set, and taking the non-repeated horizontal coordinates in the first coordinate set as first horizontal coordinates, and all the first horizontal coordinates form a first horizontal coordinate set; for each first horizontal coordinate in the first horizontal coordinate set, taking the average of the vertical coordinates of all coordinates with the horizontal coordinates in the first coordinate set as the first vertical coordinate, and then constructing a second coordinate set based on each first horizontal coordinate and its corresponding first vertical coordinate; performing curve fitting on the coordinates in the second coordinate set to obtain a first straight line;
[0054] Step S700, combining the coordinates in the second coordinate set, the third image and the first straight line, and calculating the horizontal coordinate length of the current metering of the liquid level meter through a pre-set horizontal coordinate length calculation method;
[0055] Step S800, according to the horizontal coordinate length of the current metering of the liquid level meter, combining the width of the first image and the range of the liquid level meter, and acquiring the metering information of the liquid level meter.
[0056] In order to more clearly describe the metering information reading method of the liquid level meter, the steps in an embodiment of the method will be described in detail below.
[0057] Step S100, acquire the RGB image containing only the liquid level meter as the first image;
[0058] In the embodiment, the RGB image containing only the liquid level meter is cropped from the image captured by the camera, and if the liquid level meter is placed vertically, the RGB image is right-rotated by 90 degrees as the first image, otherwise, the RGB image is directly taken as the first image. The upper left corner of the first image is taken as the origin of the first image coordinate system, the x-axis is horizontal to the right, and the y-axis is vertical downward, and the width and height of the first image are denoted as W and H, which are preferably set to 2000 and 300 in the embodiment.
[0059] Step S200, acquire the gray image corresponding to the first image as the second image;
[0060] In the embodiment, the first image is processed by a color space conversion algorithm to obtain a gray image as the second image, and the color space conversion algorithm specifically refers to cv2.cvtColor() in the cv2 library of python.
[0061] Step S300, sequentially perform adaptive binarization and image erosion processing on the second image, and take the processed image as the third image;
[0062] In the embodiment, the second image is sequentially processed by an adaptive binarization algorithm and an image erosion algorithm, and the processed result is taken as the third image, and the adaptive binarization algorithm and the image erosion algorithm specifically refer to cv2.adaptiveThreshold() and cv2.erode() in the cv2 library of python.
[0063] Step S400, perform color space conversion processing on the first image to obtain an image in the HSV color space as the fourth image;
[0064] In the embodiment, the first image is processed by a color space conversion algorithm, and the image in the HSV color space is taken as the fourth image, and the color space conversion algorithm specifically refers to cv2.cvtColor() in the cv2 library of python.
[0065] Step S500, obtain a meter mask after performing mask processing on the fourth image;
[0066] In the embodiment, the fourth image is copied to obtain a fifth image, pixels with H channel pixel value in [160, 180], S channel pixel value in [5, 255] and V channel pixel value in [20, 255] in the fourth image are set to 1, and the rest of the pixels are set to 0 to obtain a first mask; pixels with H channel pixel value in [0, 6], S channel pixel value in [5, 255] and V channel pixel value in [20, 255] in the fifth image are set to 1, and the rest of the pixels are set to 0 to obtain a second mask; the first mask and the second mask are subjected to a bitwise AND operation to obtain a third mask; all connected domains in the third mask are detected, the element value corresponding to the largest connected domain in the third mask is selected and retained as 1, and the element values of the rest of the connected domains are set to 0 to obtain a measurement mask, where the connected domain detection algorithm specifically refers to cv2.findContours() in the python cv2 library.
[0067] In step S600, coordinates of non-zero value elements in the measurement mask in a pre-constructed first image coordinate system are obtained to form a first coordinate set, and non-repeated horizontal coordinates in the first coordinate set are taken as first horizontal coordinates, and all first horizontal coordinates form a first horizontal coordinate set; for each first horizontal coordinate in the first horizontal coordinate set, the mean value of the vertical coordinates of all coordinates with the horizontal coordinate in the first coordinate set is taken as a first vertical coordinate, and then a second coordinate set is constructed based on each first horizontal coordinate and the corresponding first vertical coordinate; and curve fitting is performed on the coordinates in the second coordinate set to obtain a first straight line.
[0068] In the embodiment, coordinates of non-zero value elements in the measurement mask in the first image coordinate system are obtained to form a first coordinate set where (x j,0 , y j,0 ) represents the coordinates of the jth non-zero value element in the measurement mask in the first image coordinate system, and m represents the number of non-zero value elements in the measurement mask; all non-repeated horizontal coordinates in the first coordinate set are taken as first horizontal coordinates to form a first horizontal coordinate set where n represents the number of all non-repeated horizontal coordinates; for each first horizontal coordinate x i in the first horizontal coordinate set , the mean value of the vertical coordinates of all coordinates with x i as the horizontal coordinate in the first coordinate set is taken as a first vertical coordinate, denoted as y i ; based on each first horizontal coordinate x i and the corresponding first vertical coordinate y i , a second coordinate set is obtained The first straight line y=ax+b is fitted by using a Hough fitting algorithm, where a represents the slope of the first straight line, and b represents the intercept of the first straight line. The Hough fitting algorithm is specifically referred to as cv2.HoughLines() in the cv2 library of Python.
[0069] In step S700, the horizontal coordinate length currently measured by the liquid level meter is obtained by combining the coordinates in the second coordinate set, the third image, and the first straight line, and by using a preset horizontal coordinate length calculation method.
[0070] In this embodiment, the horizontal coordinate length currently measured by the liquid level meter is obtained by using the preset horizontal coordinate length calculation method, and specifically as follows:
[0071] In step S701, x1 in the second coordinate set is taken as the starting horizontal coordinate, and ax1+b is taken as the starting vertical coordinate to obtain a starting coordinate (x1, ax1+b).
[0072] In step S702, the horizontal coordinate of the coordinate (x1, ax1+b) is changed to x1-C n , to obtain a third coordinate (x1-C n , a(x1-C n )+b), where C n is the number of cycles and is initialized as 1.
[0073] In step S703, if the pixel value corresponding to the third coordinate in the third image is 1 or the horizontal coordinate value of the third coordinate is 0, the third coordinate at this time is marked as the starting coordinate (x s , y s ) of the liquid level meter, and the process jumps to step S704; otherwise, C n =C n +1, and the process jumps to step S702.
[0074] In step S704, the horizontal coordinate of the coordinate (x1, ax1+b) is changed to x1+z n , to obtain a fourth coordinate (x1+z n , a(x1+z n )+b), where z n is the number of cycles and is initialized as 1.
[0075] In step S705, if the pixel value corresponding to the fourth coordinate in the third image is 1 or the horizontal coordinate value of the fourth coordinate is W, the fourth coordinate at this time is marked as the terminal coordinate (x e , y e ) of the liquid level meter, and the process jumps to step S706; otherwise, z n =z n +1, and the process jumps to step S704.
[0076] Step S706: Obtain the current horizontal axis length w = |x s -x e |
[0077] Step S800: Based on the horizontal axis length currently measured by the level gauge, combined with the width of the first image and the range of the level gauge, obtain the measurement information of the level gauge.
[0078] In this embodiment, based on the horizontal coordinate length w currently measured by the level gauge, combined with the width W of the first image and the range S of the level gauge, the measurement information of the level gauge is obtained as follows: The range S of the level gauge can be obtained directly from the level gauge's instruction manual.
[0079] A liquid level gauge metering information reading system according to a second embodiment of the present invention, such as... Figure 2 As shown, it includes: a first image acquisition module 100, a second image acquisition module 200, a third image acquisition module 300, a fourth image acquisition module 400, a mask processing module 500, a curve fitting module 600, a horizontal coordinate length calculation module 700, and a measurement information acquisition module 800.
[0080] The first image acquisition module 100 is configured to acquire an RGB image containing only the level gauge as the first image;
[0081] The second image acquisition module 200 is configured to acquire the grayscale image corresponding to the first image and use it as the second image;
[0082] The third image acquisition module 300 is configured to sequentially perform adaptive binarization and image erosion processing on the second image, and use the processed image as the third image.
[0083] The fourth image acquisition module 400 is configured to perform color space conversion processing on the first image and acquire its image in the HSV color space as the fourth image.
[0084] The mask processing module 500 is configured to perform mask processing on the fourth image to obtain a measurement mask.
[0085] The curve fitting module 600 is configured to obtain coordinates of non-zero value elements in the metering mask in a pre-constructed first image coordinate system, to form a first coordinate set, and to take non-repeated abscissas in the first coordinate set as first abscissas, all of which form a first abscissa set; for each first abscissa in the first abscissa set, to take the mean value of ordinates of all coordinates with the abscissa as the first ordinate, and to further construct a second coordinate set based on each first abscissa and the corresponding first ordinate; and to perform curve fitting on the coordinates in the second coordinate set to obtain a first straight line.
[0086] The abscissa length calculation module 700 is configured to combine the coordinates in the second coordinate set, the third image and the first straight line, and to obtain the abscissa length currently metered by the liquid level meter through a preset abscissa length calculation method.
[0087] The metering information acquisition module 800 is configured to obtain the metering information of the liquid level meter according to the abscissa length currently metered by the liquid level meter, in combination with the width of the first image and the range of the liquid level meter.
[0088] The skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process and related description of the system described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0089] It should be noted that the liquid level meter metering information reading system provided in the foregoing embodiments is only exemplified by the division of the above functional modules, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the modules or steps in the embodiments of the present application can be further decomposed or combined, for example, the modules in the foregoing embodiments can be combined into one module, or can be further split into multiple sub-modules to complete all or part of the functions described above. The names of the modules and steps involved in the embodiments of the present application are only for distinguishing the modules and steps, and should not be considered as an improper limitation of the present application.
[0090] A storage device of a third embodiment of the present application, wherein a plurality of programs are stored, the programs are suitable for being loaded by a processor and implementing the liquid level meter metering information reading method described above.
[0091] A processing device of a fourth embodiment of the present application, comprising a processor and a storage device; the processor is suitable for executing each program; the storage device is suitable for storing a plurality of programs; the programs are suitable for being loaded by the processor and executed to implement the liquid level meter metering information reading method described above.
[0092] Those skilled in the art of the technical field can clearly understand that, for the convenience and brevity of description, the specific working processes of the storage device, the processing device and the related descriptions described above can refer to the corresponding processes in the foregoing method examples, and will not be repeated here.
[0093] Those skilled in the art should be aware that the modules and method steps of each example described in connection with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both, and the software modules or method steps corresponding to the program can be stored in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. In order to clearly illustrate the interchangeability of electronic hardware and software, the components and steps of each example have been described in the foregoing description in a general manner. Whether the functions are performed in electronic hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0094] The terms "first", "second", "third", and the like are used to distinguish similar objects, not to describe or indicate a particular order or sequence.
[0095] So far, the technical solutions of the present application have been described in combination with the preferred embodiments shown in the drawings, but those skilled in the art can easily understand that the protection scope of the present application is obviously not limited to these specific embodiments. Those skilled in the art can make equivalent changes or replacements to the related technical features without departing from the principles of the present application, and the technical solutions after such changes or replacements will all fall within the protection scope of the present application.
Claims
1. A method of reading metering information of a liquid level meter, characterized by, The method comprises the following steps: Step S100, acquiring an RGB image containing only the liquid level meter as a first image; Step S200, acquiring a gray image corresponding to the first image as a second image; Step S300, sequentially performing adaptive binarization and image erosion processing on the second image, and taking the processed image as a third image; Step S400, performing color space conversion processing on the first image, and acquiring an image in the HSV color space as a fourth image; Step S500, performing mask processing on the fourth image to obtain a metering mask; Step S600, acquiring the coordinates of non-zero value elements in the metering mask in a pre-constructed first image coordinate system to form a first coordinate set, taking the non-repeated horizontal coordinates in the first coordinate set as first horizontal coordinates, and all first horizontal coordinates forming a first horizontal coordinate set; for each first horizontal coordinate in the first horizontal coordinate set, taking the average of the vertical coordinates of all coordinates with the same first horizontal coordinate in the first coordinate set as a first vertical coordinate, and then constructing a second coordinate set based on each first horizontal coordinate and its corresponding first vertical coordinate; and performing curve fitting on the coordinates in the second coordinate set to obtain a first straight line; Step S700, combining the coordinates in the second coordinate set, the third image, and the first straight line, and acquiring the horizontal coordinate length of the current metering of the liquid level meter through a preset horizontal coordinate length calculation method; Step S800, acquiring the metering information of the liquid level meter according to the horizontal coordinate length of the current metering of the liquid level meter, in combination with the width of the first image and the range of the liquid level meter.
2. The method of reading the metering information of a liquid level meter according to claim 1, characterized by, The method for acquiring an RGB image containing only the liquid level meter as a first image is as follows: The RGB image containing only the liquid level meter is cropped from the collected image, and if the liquid level meter is vertically placed, the RGB image is right-rotated by 90 degrees to serve as the first image, otherwise, the RGB image is directly taken as the first image.
3. The method of reading the metering information of a liquid level meter according to claim 1, characterized by, The method for obtaining a metering mask after performing mask processing on the fourth image is as follows: The fourth image is copied to obtain a fifth image, the pixels in the fourth image with H channel pixel values located in [160, 180], S channel pixel values located in [5, 255], and V channel pixel values located in [20, 255] are set to 1, and the remaining pixels are set to 0 to obtain a first mask; The pixels in the fifth image with H channel pixel values located in [0, 6], S channel pixel values located in [5, 255], and V channel pixel values located in [20, 255] are set to 1, and the remaining pixels are set to 0 to obtain a second mask; The first mask and the second mask are subjected to a bitwise AND operation to obtain a third mask; All connected domains in the third mask are detected, the element value corresponding to the largest connected domain in the third mask is retained as 1, and the element values of the remaining connected domains are set to 0 to obtain a metering mask.
4. The method of reading metering information of a liquid level meter according to claim 1, characterized by, The method for performing curve fitting on the coordinates in the second coordinate set to obtain a first straight line is as follows: combining the second coordinate set a first straight line y=ax+b is fitted using a hough fitting algorithm; wherein a represents a slope of the first straight line, and b represents an intercept of the first straight line.
5. The method of reading the metering information of a liquid level meter according to claim 4, characterized by, The method for acquiring the horizontal coordinate length of the current metering of the liquid level meter in combination with the coordinates in the second coordinate set, the third image, and the first straight line through a preset horizontal coordinate length calculation method is as follows: Step S701, using the second coordinate set Using x1 as the initial x-coordinate and ax1+b as the initial y-coordinate, we obtain the initial coordinates (x1, ax1+b). Step S702, the abscissa of the coordinate (x1, ax1+b) is changed to x1-C n , obtaining the third coordinate (x1-C n , a(x1-C n )+b), wherein C n is the number of cycles, initialized to 1; Step S703, if the pixel value corresponding to the third coordinate in the third image is 1 or the horizontal coordinate value of the third coordinate is 0, mark the third coordinate at this time as the starting coordinate (x s , y s ) of the liquid level meter, jump to step S704, otherwise, let C n = C n + 1, jump to step S702; Step S704, the abscissa of the coordinate (x1, ax1+b) is changed to x1+z n , obtaining the fourth coordinate (x1+z n , a(x1+z n )+b), wherein z n is the number of loops, initialized to 1; Step S705, if the pixel value corresponding to the fourth coordinate in the third image is 1 or the horizontal coordinate value of the fourth coordinate is W, mark the fourth coordinate at this time as the terminal coordinate (x e , y e ) of the liquid level meter, jump to step S706, otherwise, let z n = z n + 1, jump to step S704; Step S706, the liquid level gauge current measurement of the abscissa length w = |x s -x e |.
6. The method of reading the metering information of a liquid level meter according to claim 5, wherein According to the abscissa length currently measured by the liquid level meter, combined with the width of the first image and the range of the liquid level meter, the measurement information of the liquid level meter is obtained, and the method is: Wherein, w represents the abscissa length currently measured by the liquid level meter, W represents the width of the first image, and S represents the range of the liquid level meter.
7. A metering information reading system for a liquid level meter, characterized by The system comprises a first image acquisition module, a second image acquisition module, a third image acquisition module, a fourth image acquisition module, a mask processing module, a curve fitting module, a horizontal coordinate length calculation module, and a measurement information acquisition module. The first image acquisition module is configured to acquire an RGB image containing only the liquid level meter as a first image. The second image acquisition module is configured to acquire a gray image corresponding to the first image as a second image. The third image acquisition module is configured to sequentially perform adaptive binarization and image erosion processing on the second image, and take the processed image as a third image. The fourth image acquisition module is configured to perform color space conversion processing on the first image, and acquire an image in the HSV color space as a fourth image. The mask processing module is configured to obtain a measurement mask by performing mask processing on the fourth image. The curve fitting module is configured to acquire the coordinates of non-zero value elements in the measurement mask in a pre-constructed first image coordinate system to form a first coordinate set, take the non-repeated horizontal coordinates in the first coordinate set as first horizontal coordinates, and form a first horizontal coordinate set; for each first horizontal coordinate in the first horizontal coordinate set, take the average of the vertical coordinates of all coordinates with the same horizontal coordinate as the first horizontal coordinate in the first coordinate set as a first vertical coordinate, and then construct a second coordinate set based on each first horizontal coordinate and its corresponding first vertical coordinate; and perform curve fitting on the coordinates in the second coordinate set to obtain a first straight line. The horizontal coordinate length calculation module is configured to acquire the current measurement horizontal coordinate length of the liquid level meter by a preset horizontal coordinate length calculation method in combination with the coordinates in the second coordinate set, the third image, and the first straight line. The measurement information acquisition module is configured to acquire the measurement information of the liquid level meter according to the current measurement horizontal coordinate length of the liquid level meter, in combination with the width of the first image and the range of the liquid level meter.
8. A storage device in which a plurality of programs are stored, characterized by The program is suitable for being loaded and executed by a processor to implement the measurement information reading method of the liquid level meter according to any one of claims 1-6.
9. A processing device comprising a processor, a storage device; the processor is adapted to execute each program; the storage device is adapted to store a plurality of programs; characterized in that, The program is suitable for being loaded and executed by a processor to implement the measurement information reading method of the liquid level meter according to any one of claims 1-6.
Citation Information
Patent Citations
Liquid level meter reading recognition method based on inspection robot
CN108764234A
Reading identification method and device for liquid level meter
CN112036409A