An image processing method for automatic reading of pointer pressure gauge
Through the polar coordinate transformation method based on image processing technology, the pressure gauge reading is directly calculated from the image information of the pointer and the scale line, which solves the problem of low reading accuracy and efficiency in the prior art, and achieves efficient and accurate automatic reading.
Patent Information
- Application Number
- CN202210554435.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-19
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2042-05-19
AI Technical Summary
In the automatic reading of a pointer pressure gauge, it is necessary to obtain the position information of the pointer rotation center or the center of the dial, resulting in low reading accuracy and efficiency, and greatly affected by artificial factors.
Using an image processing technology method, the pressure gauge reading is calculated based on image binarization, detecting the arc connected to the scale line, obtaining local pointer and scale line images, polar coordinate transformation, calculating the pointer center abscisor and the scale line center abscisor, and finally calculating the pressure gauge reading based on the index value and the lower range limit value.
No need to obtain the center position of the pointer, simplifying the reading process, improving reading efficiency and accuracy, and reducing manual interference.
Smart Images

Figure CN114898198B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a pointer type pressure gauge reading method, in particular to an automatic reading method of a pointer type pressure gauge based on image processing technology in the field of computer vision. Background Art
[0002] As a pressure measuring device, pointer pressure gauges are widely used in pipelines and pressure vessels in aviation, aerospace, energy, special equipment, transportation and other industrial fields due to their simple structure, high reliability, immunity to electromagnetic interference, and low price. In order to ensure the uniformity of pressure measurement units and accurate and reliable values in scientific research and production systems, periodic calibration is required according to the pressure gauge calibration procedures.
[0003] There are a large number of pointer pressure gauges subject to mandatory inspection, and they are of various types. Currently, pressure is mainly generated by manual pressurizing devices, and the pressure indication is read by the human eye. The average time required to inspect a pressure gauge is about 10 minutes. Long-term and high-intensity manual inspection can easily cause visual fatigue, increase the probability of errors in manual estimation of data, and the labor cost is huge. Furthermore, when estimating data, it is affected by factors such as human eye resolution, observation distance, observation angle, and the psychological state of the inspector, resulting in dispersion of measurement results.
[0004] Today's world requires more intelligent measurement methods, reducing human interference, and improving automation and measurement efficiency. Using machine vision technology to identify the readings of pointer pressure gauges has become mainstream. For example, Xu Guanghua of Hunan Wuling Electric Power Engineering Co., Ltd. determined the dial center and dial radius through contour scanning and least squares fitting, and then obtained the angle position of the scale line and the pointer through circular scanning to calculate the corresponding indication size; He Wen of Hubei University of Technology used edge extraction and circular fitting to obtain the pointer rotation center and dial circle fitting information, and used the center projection method to extract the pointer and scale line information to obtain the pointer reading; Li Zuhe of Zhengzhou Institute of Light Industry located the dial center based on Hough principle detection, and then used the three-frame difference method to detect the pointer center of mass, and finally connected the pointer center of mass and the dial center to calculate the pointer deflection angle and identify the reading.
[0005] Judging from the current research on using machine vision technology to identify the readings of pointer pressure gauges, most methods need to extract the position information of the pointer's rotation center or the dial center, and finally obtain the pressure gauge's reading value by determining the pointer's pointing position through the pointer's rotation center or the dial center. Summary of the invention
[0006] In view of the deficiencies in the background technology, the purpose of the present invention is to provide a method for automatically reading pointer-type pressure indication numbers based on image processing technology, so as to improve reading efficiency and reading accuracy.
[0007] To achieve the above object, the technical solution adopted by the present invention is a method for visual reading of a pointer pressure gauge, which is specifically implemented according to the following steps:
[0008] Step 1: Binarize the original image;
[0009] Step 2: Detect the arc connected to the scale line and obtain the image of the region of interest;
[0010] Step 3: Get the local scale line and local pointer image;
[0011] Step 4: Perform polar coordinate transformation on the pointer and scale line images;
[0012] Step 5: Obtain the central abscissa of the pointer and the central abscissas of the two scale lines closest to the pointer in the polar coordinate transformation result image;
[0013] Step 6: Calculate the pressure gauge reading based on the pressure gauge graduation value, the lower limit of the pressure gauge range, and the positional relationship between the pointer and each scale line.
[0014] Compared with the background technology, the gain effect of the present invention is:
[0015] 1. The present invention does not need to obtain the center of the pointer on the pressure gauge dial, nor does it need to calculate the angle between the pointer and the scale line. It only needs to obtain the local image of the pointer and the scale line and perform polar coordinate transformation on it, and convert the angular proportional relationship between the pointer and the scale lines into the proportional relationship between the pointer and the spacing between the scale lines. This can effectively solve the problem that the scale line angle caused by the inaccurate positioning of the pointer rotation center and the large error of the pointer angle have a great influence on the pressure gauge reading result, thereby improving the reading accuracy.
[0016] 2. The present invention only needs to provide the lower limit value of the pressure gauge range, that is, the scale value of the first main scale line and the graduation value of the pressure gauge. The pressure indication of the pressure gauge can be read without character recognition of the scale value, which can simplify the process of the reading method and improve the reading efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 The present invention is a flowchart of a method for identifying a reading of a pointer type pressure gauge.
[0018] Figure 2 This is the original image of the pointer-type pressure gauge to be subjected to reading recognition according to the present invention.
[0019] Figure 3 It is the preprocessed binary image of the pointer type pressure gauge of the present invention.
[0020] Figure 4 It is the arc and endpoint image of the present invention.
[0021] Figure 5 It is the region of interest image of the present invention.
[0022] Figure 6 It is the preliminary scale line image of the present invention.
[0023] Figure 7 It is a partial image of the scale line of the present invention.
[0024] Figure 8 It is the local pointer line segment image of the present invention.
[0025] Fig. 9 It is the pointer and scale line image of the present invention.
[0026] Fig.10 It is the polar coordinate transformation result image of the present invention.
[0027] Fig.11 It is the center line of the pointer and the center line of the left and right scale lines of the present invention.
[0028] Fig.12 It is the pressure gauge reading result image of the present invention. DETAILED DESCRIPTION
[0029] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods (examples), but they are not intended to limit the present invention.
[0030] like Figure 1 As shown, the steps of the method of the present invention are:
[0031] Step 1: Binarize the original image
[0032] Read as Figure 2 As shown in FIG. 1 , the original image src including the dial and pointer of the pointer pressure gauge collected in advance is subjected to binary segmentation processing using a fixed threshold determined experimentally to obtain a binary image bw, as shown in FIG. Figure 3 shown.
[0033] Step 2: Detect the arcs connected to the scale lines and obtain the region of interest image
[0034] 21) In the binary image bw, the arc connected to the scale line is detected by Hough transform, and the two endpoints of the arc are determined. The arc arc and the endpoint images are as follows: Figure 4 shown.
[0035] 22) Create an image with the same size as the binary image bw, with a black background and a foreground with an arc centered at Cen. arc The center of the circle is the radius r of the arc arc. arc The white circle is subtracted from the arc centered at Cenarc The center of the circle, the left and right endpoints of the arc, and the center of the arc Cen arc The line connecting the two edges is a sector drawn by the two edge lines, and finally a sector mask image mask1 corresponding to the arc arc is obtained.
[0036] 23) Use the mask image mask1 to perform a mask operation on the binary image bw to obtain a new binary image bw2. In the image bw2, the image within the white sector-shaped circumscribed rectangular area in the mask image is intercepted to obtain the region of interest image roiImg, as shown in Figure 5 shown.
[0037] Step 3: Get the local scale line and local pointer image
[0038] 31) Extract the contour of the image of interest roiImg and calculate each contour C i The height H of the minimum bounding rectangle i and contour C i Height H i and width W i The ratio of height to width R i , i=1,2,3,…,n1, n1 is the number of contours. i The minimum aspect ratio of the bounding rectangle R i Greater than the threshold R low And the height H of the contour i In the interval [H low , H high ], then the contour C is determined i The area corresponding to the image of interest roiImg is the primary scale line, and the contour C i The minimum bounding rectangle height H i Then the length L of the initial scale line i , R low , H low and H high Through experiments, it is found that R low =5, H low =20 and H high = 200. After all contours are determined, the initial scale lines are as follows Figure 6 Sort all the preliminary scale lines in ascending order by length, and calculate the average length of the first 30% to 70% of the total number of preliminary scale lines. This average length is the length of the short scale line L short , calculate the average length of the three longest scale lines of the preliminary scale line, and this average length is the length of the long scale line L long .
[0039] 32) Create an image mask2 with the same size as the region of interest image roiImg, with a black background and a foreground with an arc centered at Cen. arc The center of the circle is the radius r of the arc with an outer diameter value of arc arc , the inner diameter value is the arc radius r arc Subtract the short scale line length L short The mask image mask2 is used to perform a mask operation on the region of interest image roiImg to obtain a scale line local image slImg containing the scale line local area, such as Figure 7 shown.
[0040] 33) Create an image mask3 with the same size as the binary image bw, with a black background and a foreground with an arc centered at Cen. arc The center of the circle is the radius r of the arc arc. arc The white circle is used, and the mask image mask3 is used to perform a bitwise AND operation on the binary image bw to obtain a local image bw3 of the pressure gauge containing the entire pointer.
[0041] 34) In image bw3, use cumulative probability Hough transform to detect line segments and calculate the length of each line segment. The longest line segment is the pointer line segment. Create an image with a black background and the same size as the binary image bw, draw the pointer line segment in white, and obtain the pointer line segment image nlImg.
[0042] 35) Create an image mask4 with the same size as the binary image bw, with a black background and a foreground with an arc centered at Cen. arc The center of the circle is the radius r of the arc with an outer diameter value of arc arc Subtract the length of the long scale line L long , the inner diameter value is the radius r of the arc arc Subtract the length of the long scale line L long Then subtract a white ring from a, where a is determined according to experiments, and in this embodiment, a=50. Use the mask image mask4 to perform a bitwise AND operation on the pointer line segment image nlImg to obtain a local pointer line segment image pnlImg containing only the local pointer line segment, as shown in FIG. Figure 8 shown.
[0043] Step 4: Perform polar coordinate transformation on the pointer and scale line images
[0044] Perform image summation operation on the scale line local image slImg obtained in step 32 and the local pointer line segment image pnlImg obtained in step 35 to obtain the pointer and scale line image nsImg, as shown in FIG. Fig. 9As shown. If the scale lines of the upper and lower limits of the pressure range on the pressure gauge dial in the original image src are not located on the upper and lower sides of the horizontal line at the center of the dial, the pointer and scale line image nsImg needs to be rotated. In this embodiment, since the scale lines of the upper and lower limits of the pressure range on the pressure gauge dial are located on the upper and lower sides of the horizontal line at the center of the dial, the pointer and scale line image nsImg is rotated 90° counterclockwise. With the center of the pointer and scale line image nsImg as the origin and half of the height of the pointer and scale line image nsImg as the radius of the boundary circle, a polar coordinate transformation is performed on the pointer and scale line image nsImg so that the pointer and scale lines change from pointing to the center of the dial to being distributed parallel to the upper edge of the polar coordinate transformation result image ploarImg, as shown in FIG. Fig.10 shown.
[0045] Step 5: Obtain the horizontal coordinate of the center of the pointer and the horizontal coordinate of the center of the two scale lines closest to the pointer in the polar coordinate transformation result image
[0046] 51) In the polar coordinate transformation result image ploarImg of the pointer and scale line image nsImg, extract the first b rows of pixel areas from top to bottom, where b is the length L of the long scale line obtained in step 31 long , obtain the scale line area image slAreaImg containing only the scale lines.
[0047] 52) Count the number of non-zero pixels in each column of the scale line area image slAreaImg from left to right and store them in an array, search the values of each array element in ascending order according to the array element index number. If the array element value is greater than the short scale line length L obtained in step 31, short Half of , then the index number of this array element is the left horizontal coordinate of the first scale line, and continue searching backward until the array element value is equal to 0. Then the index number corresponding to the previous element of this array element is the right coordinate of the first scale line. The average of the left and right horizontal coordinates of the first scale line is obtained to obtain the central horizontal coordinate of the first scale line. The method of obtaining the central horizontal coordinate of the first scale line is used to search backward in sequence until all elements of the array are traversed to obtain the central horizontal coordinates of each scale line.
[0048] 53) In the polar coordinate transformation result image ploarImg of the pointer and scale line image nsImg, extract the pixel area from the bth row to the last row in order from top to bottom, where b is the length L of the long scale line obtained in step 31 long , obtain the pointer area image needleAreaImg containing only the pointer.
[0049] 54) Perform contour screening on the needle area image needleAreaImg, wherein the contour with the largest area is determined to be the pointer contour, obtain the circumscribed rectangle of the pointer contour, and calculate the average of the horizontal coordinates of the upper left corner vertex and the lower right corner vertex of the circumscribed rectangle of the pointer contour, which is the horizontal coordinate of the pointer center.
[0050] 55) Compare the horizontal coordinate of the center of the pointer with the horizontal coordinate of the center of the scale line. The scale line whose horizontal coordinate is smaller than the horizontal coordinate of the center of the pointer and closest to the horizontal coordinate of the center of the pointer is the left scale line 1, and the scale line whose horizontal coordinate is larger than the horizontal coordinate of the center of the pointer and closest to the horizontal coordinate of the center of the pointer is the right scale line 2. The schematic diagram of the center line of the pointer and the center line of the left and right scale lines is as follows: Fig.11 shown.
[0051] Step 6: Calculate the pressure gauge reading based on the pressure gauge graduation value, the pressure gauge range lower limit, and the position relationship between the pointer and each scale line.
[0052] The pressure gauge reading p can be calculated by the following formula:
[0053] p=sv+dv×(pIp+pDp)
[0054] Among them, sv is the lower limit of the pressure gauge range, dv is the pressure gauge graduation value, pIp is the position number difference between the left scale line line1 closest to the pointer and the scale line line0 corresponding to the lower limit of the pressure gauge range; pDp is the ratio of the difference between the horizontal coordinate of the center of the pointer and the horizontal coordinate of the left scale line line1 to the difference between the horizontal coordinates of the center of the two scale lines line2 and line1 closest to the pointer. The pressure gauge reading result of superimposing the read pressure representation value on the original image is as follows Fig.12 shown.
[0055] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. An image processing method for automatic reading of a pointer pressure gauge, characterized in that: Processing the acquired pointer pressure gauge image includes the following steps: Step 1: Binarize the original image; Step 2: Detect the arc connected to the scale line and obtain the image of the region of interest; Step 3: Obtain the local scale line and local pointer image; Step 4: Perform polar coordinate transformation on the pointer and scale line images; Step 5: Obtain the central abscissa of the pointer and the central abscissas of the two scale lines closest to the pointer in the polar coordinate transformation result image; Step 6: Calculate the pressure gauge reading based on the pressure gauge's graduation value, the pressure gauge's range lower limit, and the positional relationship between the pointer and each scale line; The step 2 comprises the following steps: 21) using Hough transform to detect the circular arc arc connected to the scale line in the binary processed image bw; 22) constructing a sector mask image mask1 corresponding to the circular arc arc; 23) using the mask image mask1 to obtain the region of interest image roiImg in the image bw; The step 3 comprises the following steps: 31) initially selecting scale lines in the region of interest image roiImg according to the geometric features of the scale lines, and calculating the length L of the short scale lines respectively. short and the length of the long scale line L long ; 32) construct a mask image mask2, and use the mask image to obtain a local scale line image slImg containing a local scale line in the region of interest image roiImg; 33) construct a mask image mask3, and use the mask image to obtain an image bw3 containing the entire pointer in the image bw; 34) use Hough transform to perform line segment detection in the image bw3, and the longest line segment is the pointer line segment, and redraw the pointer line segment in white in a black background image nlImg of the same size as the image bw; 35) construct a mask image mask4, and use the mask image to obtain a local pointer line segment image pnlImg containing a local pointer line segment in the image nlImg; 36) from the local pointer line segment image pnlImg, cut out a sub-image with the same position and size as the region of interest image roiImg in the image bw, and superimpose it with the scale line local image slImg, to obtain an image containing the local scale line and the local pointer line segment, that is, the pointer and scale line image nsImg; Before performing polar coordinate transformation on the pointer and scale line image nsImg in step 4, it is necessary to ensure that the scale lines of the upper and lower limits of the pressure range in the original image are located on the upper and lower sides of the horizontal line of the center of the dial. If this condition cannot be met, the pointer and scale line image nsImg needs to be rotated; The step 5 specifically includes the following steps: 51) obtaining a scale line area image slAreaImg containing only scale lines in the image ploarImg resulting from the polar coordinate transformation of the pointer and scale line image nsImg; 52) obtaining the central horizontal coordinates of each scale line in the scale line area image slAreaImg by a projection method; 53) obtaining a pointer area image needleAreaImg containing only the pointer in the image ploarImg resulting from the polar coordinate transformation of the pointer and scale line image nsImg; 54) obtaining the central horizontal coordinate of the pointer by searching for the maximum contour in the pointer area image needleAreaImg; 55) obtaining the central horizontal coordinate of the two scale lines line1 and line2 closest to the pointer according to the size relationship between the central horizontal coordinate of the pointer and the central horizontal coordinate of each scale line; The pressure gauge reading p in step 6 can be calculated by the following formula: p=sv+dv×(pIp+pDp) Among them, sv is the lower limit of the pressure gauge range; dv is the pressure gauge graduation value; pIp is the position number difference between the left scale line line1 closest to the pointer and the scale line line0 corresponding to the lower limit of the pressure gauge range; pDp is the ratio of the difference between the abscissa of the center of the pointer and the left scale line line1 to the difference between the abscissas of the centers of the two scale lines line2 and line1 closest to the pointer.
2. The image processing method for automatic reading of a pointer pressure gauge according to claim 1, characterized in that: In step 3, the size of the mask image mask2 is the same as the region of interest image roiImg, the background is red, and the foreground is a circle with arc arc as the center Cen arc The center of the circle is the radius r of the arc with an outer diameter value of arc arc , the inner diameter value is the arc radius r arc Subtract the short scale line length L short The size of the mask image mask3 is the same as that of the image bw, the background is black, and the foreground is a circle with arc arc as the center Cen arc The radius r of the arc with the center and radius value as arc arc The size of the mask image mask4 is the same as that of the image bw, the background is black, and the foreground is a circle with the center of the arc Cen. arc The center of the circle is the radius r of the arc with an outer diameter value of arc arc Subtract the length of the long scale line L long , the outer diameter value is the radius r of the arc arc Subtract the length of the long scale line L long Subtract a white ring from a, and the value of a will be between 30 and 60.
Citation Information
Patent Citations
Meter pointer angle identification method based on image processing
CN102799867A
Automatic reading method of pointer type pressure gauge
CN110991233A