Automatic identification and reading method of precision pointer instrument with anti-light interference

By correcting local invariant features in images and improving the Hough line detection algorithm, the problems of complex parameter adjustment and illumination changes in traditional methods are solved, and robustness and accuracy of automatic reading of precision pointer instruments in dynamic environments are achieved.

CN116958950BActive Publication Date: 2026-03-27HANGZHOU DIANZI UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-21
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

When faced with dynamic changes in camera perspective and ambient lighting, existing technologies suffer from complex parameter adjustments in traditional algorithms, making it difficult to cope with external interference. This results in poor automatic reading performance of precision pointer instruments, and machine learning-based methods lack generalization ability.

Method used

A circular dial is corrected based on local invariant features of the image. An improved Hough line detection algorithm is used to detect the pointer and tick marks. The tilted image is corrected by perspective transformation matrix. Adaptive binarization and Canny edge detection are used to filter out the valid pointer and tick mark segments.

Benefits of technology

It can accurately detect pointers and scale lines even under conditions of lighting interference and image distortion, improving the robustness and stability of automatic reading and reducing sensitivity to environmental changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116958950B_ABST
    Figure CN116958950B_ABST
Patent Text Reader

Abstract

The application discloses an automatic identification and reading method of a precise pointer type instrument which is not interfered by light, and comprises the following steps: step A, image pre-processing; step B, correcting a dial image; step C, detecting a pointer direction of the dial; step D, detecting positions of a zero scale line and a full scale line of the dial; and step E, calculating a reading of the instrument. The application indirectly corrects a circular image based on local invariant features of the image, improves the accuracy of the automatic reading method, and detects a pointer line segment based on an improved Hough line detection algorithm, so that the pointer position can be more accurately detected, and the application has high robustness and practicability.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of image processing and computer vision, and particularly relates to an automatic identification and reading method for a precision pointer instrument resistant to light interference. BACKGROUND

[0002] Pointer instruments are common measuring and display instruments, which are used to measure and display various physical quantities, such as pressure, temperature, liquid level, etc., and are widely used in petrochemical industry, electric power, pharmaceutical industry, metallurgy, aerospace, etc., to ensure the normal operation and safety of the system. The accurate measurement of pointer instruments is crucial to ensure the normal operation of production equipment, the stability of product quality, and the safety of the process. Therefore, the inspection of pointer instruments is a necessary part of industrial production management.

[0003] In the traditional industrial inspection process, the inspection personnel usually manually read the values on the precision instruments and record them in the inspection table or document. However, this manual reading method has poor real-time performance, increases the time cost, and limits the work efficiency; at the same time, the manual reading of precision instrument values is easily affected by the vision and subjective factors of the inspection personnel, resulting in reading errors; and in some high-risk environments, manual reading may also threaten the safety of workers. With the development of machine vision technology, more and more factories use inspection robots, drones, and other autonomous devices with machine vision technology to automatically measure and monitor instrument equipment. Therefore, the automatic reading of precision pointer instruments based on machine vision has become an important key technology, which is of great significance to improve the safety management level, improve the production efficiency, and reduce the labor cost.

[0004] At present, most of the automatic reading methods of pointer instruments based on machine vision are realized by using traditional algorithms such as Hough circle detection and Hough line detection. However, these traditional algorithms have many parameters, and for different working environments, the parameters need to be adjusted manually repeatedly, which is difficult to cope with the changes in the viewing angle of dynamic cameras and the changes in environmental light. These existing methods are usually greatly affected by input images, so that the effect of automatic reading is easily affected by external factors, including image distortion, light disturbance, and viewing angle change. At the same time, there are also some pointer instrument reading methods based on machine learning, but these methods need a large amount of data set to train the neural network model weight, and have poor generalization ability for different instruments.

[0005] Therefore, it is particularly important to study a precision pointer instrument automatic reading method that can well resist the interference of external factors and has strong practicability and stability. SUMMARY

[0006] The technical problem solved by the present application is to provide an automatic identification and reading method of a precision pointer instrument resistant to light interference, which can accurately complete the automatic reading of the precision pointer instrument.

[0007] The technical solution adopted by the present application is as follows:

[0008] In a first aspect, the present application provides an automatic identification and reading method of a precision pointer instrument resistant to light interference, comprising the following steps:

[0009] Step A: pre-processing the precision instrument image captured by the camera to obtain a dial RGB image, and obtaining the coordinates of the four vertices A, B, C and D of the minimum circumscribed rectangle thereof;

[0010] Step B: correcting the circular dial region of the dial RGB image of step A by using an image-based local invariant feature;

[0011] Step C: detecting the pointer direction of the precision instrument image corrected in step B;

[0012] Step D: detecting the zero scale line and full scale line directions of the precision instrument image corrected in step B;

[0013] Step E: calculating the reading.

[0014] The steps C and D have no limitation in execution sequence, and step C can be executed first and then step D, or step D can be executed first and then step C, or steps C and D can be executed simultaneously. Steps C and D are only for the convenience of description, and do not constitute a limitation on the execution sequence of the steps in the technical solution of the present application.

[0015] Further, the specific processing process of step A is as follows:

[0016] Step A1: first, obtain the H, S and V channel data of the outer frame of the precision instrument in the input image, and then find the maximum values of the three groups of data 、 and ;

[0017] Step A2: taking the three maximum values obtained in step A1 as threshold values, performing HSV color threshold segmentation on the RGB image captured by the camera to obtain a binary image of the instrument dial; specifically:

[0018] For any pixel point in the RGB image, if the H m , S m and V m pixel value components corresponding to the pixel point are all less than the corresponding threshold values, then the pixel value of the point is 255; otherwise, set the pixel value of the point to 0 255; otherwise, set the pixel value of the point to 0

[0019] Step A3: using morphological operations such as erosion, dilation, etc. to process the binary image obtained in step A2, so that the outer frame of the precision instrument in the binary image is more complete; then filter processing, remove the miscellaneous points outside the ROI region;

[0020] Step A4: obtain the dial image of the precision instrument by screening the contour; specifically:

[0021] First, use the Canny edge detection algorithm to obtain all the contours in the binary image processed in step A3, frame the circumscribed rectangle of all the contours, and screen out the contours whose aspect ratio of the circumscribed rectangle is within a given range. The contour with the largest area of the circumscribed rectangle is the contour corresponding to the outer frame of the precision instrument. In the original RGB image, the circumscribed rectangle corresponding to the contour is cropped out, and the dial RGB image of the precision instrument is obtained.

[0022] Further, the specific processing process of step B is as follows:

[0023] Step B1: perform grayscale processing on the dial RGB image of step A to obtain its grayscale image;

[0024] Step B2: use an adaptive binarization algorithm to process the grayscale image obtained in step B1 to obtain a binary image of the precision instrument;

[0025] Step B3: take the center point of the dial RGB image of step A as the center of the dial;

[0026] Step B4: crop out the lower half of the binary image obtained in step B2, detect the local invariant feature therein, and detect the four vertices of the minimum circumscribed rectangle thereof; specifically including the following steps:

[0027] B4-1: crop out the lower half of the binary image obtained in step B2; perform erosion processing on the lower half of the binary image obtained in step B2, and then use the Canny edge detection algorithm to detect the edge features in the image; then find all the contours in the image and draw the minimum circumscribed rectangle of all the contours;

[0028] B4-2: for each minimum circumscribed rectangle, calculate its length, width and area, and detect the corresponding local invariant feature by detecting its aspect ratio, area and whether it is located in the middle position; thereby obtaining the four vertices of the minimum circumscribed rectangle of the local invariant feature;

[0029] Step B5: According to the principle of similar triangles, four vertices of the circular dial image to be corrected are obtained, so as to calculate the perspective transformation matrix, and the circular dial image is corrected.

[0030] Further, the step B5 specifically comprises the following steps:

[0031] B5-1: For the minimum circumscribed rectangle of the local invariant features obtained in step B4, two right triangles are respectively constructed with the upper and lower edges of the minimum circumscribed rectangle as the hypotenuse; meanwhile, two right triangles are respectively constructed with the upper and lower edges of the dial image in step A as the right angle edges; the right triangle a1 is similar to the right triangle b1, and the right triangle a2 is similar to the right triangle b2; then, the similar ratios of the two groups of similar right triangles are calculated, and the unknown vertices A1 and D1 of the right triangles b1 and b2 in step A dial image are calculated according to the similar ratios; the perpendicular lines are drawn from the two vertices A1 and D1 to the hypotenuse of the other right triangle, respectively, so as to obtain a square with the same inclination as the dial image in step A, and the four vertices of the square are taken as the four vertices of the dial image before correction;

[0032] B5-2: The four vertices obtained in step B5-1 and the four vertices of the dial image in step A constitute four pairs of point coordinates, and the perspective transformation matrix from the inclined circular dial image to the corrected circular dial image is calculated according to the four groups of point coordinates;

[0033] B5-3: The perspective transformation matrix obtained in step B5-2 is used to process the inclined circular dial image, so as to obtain the corrected dial image.

[0034] Further, the step C specifically comprises the following process:

[0035] Step C1: For the corrected dial image obtained in step B, a grayscale processing is performed, and then an adaptive binarization algorithm is used for processing, so as to obtain a corrected dial binary image;

[0036] Step C2: For the binary image obtained in step C1, an edge feature in the image is detected by using a Canny edge detection algorithm; and a pointer line segment in the image is detected by using an improved Hough line detection algorithm;

[0037] Further, the step C2 specifically comprises the following steps:

[0038] C2-1: The line segments in the corrected dial binary image are detected by using an existing Hough line detection algorithm, so as to obtain a line segment set;

[0039] C2-2: For any line segment in the line segment set obtained in step C2-1, the distance from the two end points of the line segment to the center of the circle is calculated respectively, and the maximum distance and the minimum distance from the line segment to the center of the circle are recorded; by traversing the line segment set, the distance from all line segment end points to the center of the circle can be obtained; sort all the minimum distances from the line segment end points to the center of the circle to obtain the shortest distance from all the line segment end points to the center of the circle;

[0040] C2-3: Take n times of the shortest distance from the line segment end point to the center of the circle obtained in step C2-2 as the threshold, compare the minimum distance from all line segment end points to the center of the circle in the line segment set with the threshold, if the minimum distance from a line segment end point to the center of the circle is less than the threshold, put it into the new line segment set, otherwise do not put it in;

[0041] C2-4: For the new line segment set obtained in step C2-3, sort the maximum distance from all line segment end points to the center of the circle in the set, and the longest distance is the line segment corresponding to the precision instrument pointer;

[0042] Step C3: For the line segment detected in step C2-4, obtain the coordinate of the end point far away from the center of the circle, and then use the center coordinate to obtain the deflection angle of the pointer;

[0043] Further, the step D specifically processes as follows:

[0044] Step D1: For the corrected dial image obtained in step B, perform mean filtering, and then use Canny edge detection algorithm for processing to detect all edge features in the image;

[0045] Step D2: Detect all contours and their corresponding maximum circumscribed rectangles of the image obtained in step D1, calculate the area, aspect ratio, and length of the line connecting the center of the rectangle and the center of the circle of all maximum circumscribed rectangles;

[0046] Step D3: Set the area threshold, aspect ratio threshold, and length threshold of the line connecting the center of the rectangle and the center of the circle of the maximum circumscribed rectangle of the contour, if the area, aspect ratio, and length of the line connecting the center of the rectangle and the center of the circle of a certain contour all meet the set threshold, put the edge contour into the scale line set;

[0047] Step D4: For the scale line set in step D3, calculate the angle of the line connecting the center of all circumscribed rectangles and the center of the circle, sort the angles from small to large, and the contour corresponding to the minimum angle of the circumscribed rectangle is the zero scale line, and the contour corresponding to the maximum angle of the circumscribed rectangle is the full scale line;

[0048] Step D5: After detecting the zero scale line and the full scale line, take the center points of their maximum circumscribed rectangles as their direction points, then the deflection angle of the line connecting the two points and the center of the circle can be calculated.

[0049] Further, the specific processing procedure of step E is as follows:

[0050] Step E1: according to the known instrument scale, the zero scale line and full scale line deflection angle obtained in step D, and the pointer deflection angle obtained in step C, the reading of the precision instrument at this time can be calculated by using geometric relationship.

[0051] Further, the automatic identification and reading device of the anti-light interference precision pointer instrument further comprises an image acquisition module, the acquisition of the instrument image is controlled by using the program, the automatic reading of the precision instrument is realized by using the automatic identification and reading method of the anti-light interference precision pointer instrument.

[0052] In the case that the input image is not ideal, the reading of the precision instrument can still be accurately detected by using the image correction algorithm to correct the inclined circular dial image, and the task of automatic reading is effectively completed.

[0053] In the second aspect, the present application provides a precision pointer instrument automatic identification and reading system, comprising:

[0054] The data acquisition and preprocessing module pre-processes the precision instrument image shot by the camera, obtains the dial RGB image, and acquires the coordinates of the four vertices A, B, C and D of the minimum circumscribed rectangle;

[0055] The correction module corrects the dial RGB image based on the local invariant features of the image;

[0056] The first calculation module detects the pointer direction of the corrected dial RGB image, and calculates the pointer deflection angle .

[0057] The second calculation module detects the zero scale line deflection angle and the full scale line deflection angle .

[0058] The third calculation module calculates the reading according to the instrument scale , the zero scale line deflection angle , the full scale line deflection angle and the pointer deflection angle .

[0059] In the third aspect, the present application provides a computer readable storage medium, which stores a computer program, when the computer program is executed in the computer, the computer executes the method.

[0060] In the fourth aspect, the present application provides a computing device, comprising a memory and a processor, the memory stores executable code, and the processor executes the executable code to realize the method.

[0061] Compared with the prior art, the present application has the advantages of:

[0062] 1) The present application proposes to correct the circular dial image based on the local invariant feature, and the minimum circumscribed rectangle of the local invariant feature is detected to indirectly reflect the degree of inclination of the circular dial image, so as to correct the inclined circular dial image and improve the anti-interference and stability of the automatic reading method.

[0063] 2) The present application proposes to detect the pointer based on the improved Hough line detection algorithm. After all line segments are detected by using the existing Hough line algorithm, the maximum distance and the minimum distance between each line segment endpoint and the dial center are compared, so that the interference line segments caused by light and the like can be better excluded, and the pointer line segment can be accurately detected, and the robustness is high.

[0064] In summary, the method of the present application can simultaneously meet the accuracy and robustness, and can better complete the identification and automatic reading task of the precision instrument in the uncertain environment such as industrial inspection, and has strong practicability. BRIEF DESCRIPTION OF DRAWINGS

[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0066] Fig. 1 is a flow chart of the automatic identification and reading method of the precision pointer instrument with anti-light interference in the present application.

[0067] Fig. 2 is a schematic diagram of correcting the left-inclined circular image.

[0068] Fig. 3 is a schematic diagram of correcting the right-inclined circular image.

[0069] Fig. 4 is a schematic diagram of screening the pointer line segment.

[0070] Fig. 5 is a circular image correction experimental result graph, (a) original image, (b) image after correction by the improved Hough line detection algorithm of the present application.

[0071] Fig. 6 is an experimental result graph of screening the pointer line segment by using different Hough line detection algorithms, (a) existing Hough line detection algorithm, (b) improved Hough line detection algorithm. DETAILED DESCRIPTION

[0072] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative effort belong to the protection scope of the present application.

[0073] The following embodiment is to automatically read the precision pressure gauge, and the complete process is as shown in Figure 1 .

[0074] Embodiment 1

[0075] The embodiment provides an automatic identification and reading method of a precision pointer instrument which is not interfered by light, comprising the following steps.

[0076] Step A: pre-processing the precision instrument image photographed by the camera to obtain a dial RGB image, and obtaining the coordinates of four vertices A, B, C and D of the circumscribed rectangle of the dial RGB image;

[0077] Step B: correcting the circular dial region of the dial RGB image in step A by using an image-based local invariant feature;

[0078] Step C: detecting the pointer direction of the precision instrument image corrected in step B;

[0079] Step D: detecting the zero scale line and the full scale line direction of the precision instrument image corrected in step B;

[0080] Step E: calculating the reading.

[0081] Embodiment 2

[0082] The embodiment is based on Embodiment 1, and the specific processing process of step A is as follows.

[0083] Step A1: first, obtaining the data of the H, S and V channels of the outer frame of the precision instrument in the input image, and then finding the maximum values of the three groups of data 、 and ;

[0084] Step A2: taking the three maximum values obtained in step A1 as threshold values, performing HSV color threshold segmentation on the RGB image photographed by the camera to obtain a binary image of the instrument dial; specifically,

[0085] for any pixel point in the RGB image, if the H m , S m and V mIf all three pixel value components are less than the corresponding threshold, the pixel value of the point is set to 255; otherwise, the pixel value of the point is set to 0, and a binary image of the instrument dial image is obtained by traversing all the pixel points in the RGB image.

[0086]

[0087] Step A3: morphological operations such as erosion and dilation are used to process the binary image obtained in step A2, so that the outer frame of the precision instrument in the binary image is more complete; then filtering processing is performed to remove the noise points outside the ROI region;

[0088] Step A4: the dial RGB image of the precision instrument is obtained by screening the contour; specifically:

[0089] First, the Canny edge detection algorithm is used to obtain the set of all contours in the binary image processed in step A3 , the circumscribed rectangle of all contours is framed and the aspect ratio is calculated , the contours whose aspect ratio of the circumscribed rectangle is within a given range are screened out, and the contour with the largest area of the circumscribed rectangle among these contours is the contour corresponding to the outer frame of the precision instrument; the circumscribed rectangle corresponding region in the original RGB image is cropped, and the dial RGB image of the precision instrument , and the four vertex coordinates of the circumscribed rectangle are obtained.

[0090]

[0091]

[0092]

[0093] wherein, represents the circumscribed rectangle of the contour , represents the set of all contour circumscribed rectangles , represents the length and width of the circumscribed rectangle , and represents the contour set whose aspect ratio is within a certain range.

[0094]

[0095] wherein, represents the area of the contour circumscribed rectangle, ​​​​The circumscribed rectangle of the corresponding contour of the outer frame of the precision instrument is a circumscribed rectangle of the corresponding contour of the outer frame of the precision instrument The four vertices of the circumscribed rectangle are A, B, C, and D, as shown in the accompanying drawings. Figure 2

[0096] Example 3

[0097] This embodiment is based on Example 2, and the specific processing procedure of Step B is as follows:

[0098] Step B1: Perform grayscale processing on the dial RGB image obtained in Step A to obtain a grayscale image The calculation formula of the pixel value S of each pixel point in the grayscale image is as follows:

[0099]

[0100] wherein R, G, and B are three components of the pixel value of the corresponding pixel point in the dial RGB image;

[0101] Step B2: Perform processing on the grayscale image obtained in Step B1 using an adaptive binarization algorithm to obtain a binary image of the precision pressure gauge ;

[0102] Step B3: Take the center point of the dial RGB image obtained in Step A as the center of the dial ;

[0103]

[0104] wherein W represents the width of the dial RGB image, and H represents the height of the dial RGB image.

[0105] Step B4: Crop the lower half of the binary image obtained in Step B2 , detect the local invariant feature therein, and detect the four vertices of the minimum circumscribed rectangle thereof; the specific steps include the following steps:

[0106] B4-1: Crop the lower half of the binary image obtained in Step B2 ; perform erosion processing on the lower half of the binary image obtained in Step B2, and then use the Canny edge detection algorithm to detect the edge features in the image, and then find all the contours in the image and draw the minimum circumscribed rectangle of all the contours;

[0107] B4-2: For each minimum circumscribed rectangle, calculate its length, width, and area, and detect the corresponding local invariant feature by detecting its aspect ratio, area, and whether it is located in the middle position, thereby obtaining the four vertices of the minimum circumscribed rectangle of the local invariant feature.​​

[0108] B4-3: Set the image All contour sets ,in Indicates the first Each contour. The length, width, and area of ​​its minimum bounding rectangle are respectively , and Simultaneously define a threshold. and ,in Minimum aspect ratio, Define the maximum aspect ratio; and simultaneously define a threshold. and ,in To minimize the area, This represents the maximum area.

[0109] For the minimum bounding rectangle of each contour If the following conditions are met, then the corresponding contour is considered to be the contour of the local invariant feature:

[0110]

[0111] in, For small non-negative real numbers, Represents the minimum bounding rectangle of each contour. The x-coordinate of the center point.

[0112] B4-4: Extract the four vertices of the minimum bounding rectangle of the locally invariant feature contour, namely A2, B2, C2, and D2, as shown in the attached diagram. Figure 2 As shown in the image.

[0113] Step B5: Obtain the four vertices of the circular dial image to be corrected based on the principle of similar triangles, and then calculate the perspective transformation matrix to correct the circular dial image.

[0114] Example 4:

[0115] Based on Example 3, step B5 in this embodiment specifically includes the following steps:

[0116] B5-1: As attached Figure 2As shown, for the minimum bounding rectangle A2B2C2D2 with locally invariant features obtained in step B4, two right triangles △A2B2W2 and △C2D2Q2 are constructed using the upper edge A2B2 and the lower edge C2D2 of this minimum bounding rectangle as hypotenuses; simultaneously, two right triangles △A1BA and △CDD1 are constructed using the upper edge AB and the lower edge CD of the RGB image of the dial in step A as legs; right triangle △A2B2W2 is similar to right triangle △A1BA, and right triangle △C2D2Q2 is similar to right triangle △CDD1; then, the similarity ratio of the two sets of similar right triangles is calculated. According to the similarity ratio Calculate the coordinates of the unknown vertices A1 and D1 of the right triangles △A1BA and △CDD1 in the RGB image of the dial in step A. Draw perpendicular lines from these two vertices A1 and D1 to the hypotenuses CD1 and A1B of another right triangle, respectively. This will yield a square A1B1C1D1 with the same tilt as the RGB image of the dial in step A. Use the four vertices of square A1B1C1D1 as the four vertices A1, B1, C1, and D1 of the original RGB image of the dial.

[0117] like Figure 2 Right triangle C2D2Q2 with line segment C2D2 as its hypotenuse is similar to right triangle CDD1, where the similarity ratio is... for:

[0118]

[0119] Based on this similarity ratio, the coordinates of point D1 can be calculated:

[0120]

[0121] Similarly, the coordinates of point A1 can be calculated. Draw a perpendicular line from D1 to line segment A1B. The intersection of this perpendicular line and line segment A1B is B1. Similarly, the intersection of the perpendicular line drawn from A1 to line segment CD1 and the line segment is C1. .

[0122] B5-2: The four vertices A1, B1, C1, and D1 obtained in step B5-1 and the four vertices A, B, C, and D of the RGB image of the dial in step A constitute four pairs of point coordinates. Based on these four sets of point coordinates, the perspective transformation matrix from the tilted circular dial image to the corrected circular dial image can be calculated.

[0123] B5-3: Use the perspective transformation matrix obtained in step B5-2 to process the tilted circular dial image to obtain the corrected dial image. The correction principle and result diagram are attached. Figure 2 and attached Figure 3 As shown.

[0124] Example 5:

[0125] Based on Example 4, the specific processing procedure of step C in this embodiment is as follows:

[0126] Step C1: For the corrected dial image obtained in step B53 The image is converted to grayscale and then processed using an adaptive binarization algorithm to obtain a binary image of the corrected dial. ;

[0127] Step C2: For the binary image obtained in step C1 The Canny edge detection algorithm is used to detect edge features in the image; an improved Hough line detection algorithm is used to detect the corrected dial image. The pointer line segment in the middle;

[0128] Example 6:

[0129] Based on Example 5, step C2 in this embodiment specifically includes the following steps:

[0130] S1: Detect images using the existing Hough line detection algorithm. From the line segments in the equation, we obtain a set of line segments;

[0131] S2: For any line segment in the set of line segments obtained in step S1, calculate the distance from its two endpoints to the center of the circle. The distances from the endpoints of the line segments to the center of the circle are denoted as the maximum and minimum distances from the line segments to the center. By traversing the set of line segments, the distances from all endpoints of the line segments to the center of the circle can be calculated. The minimum distances from all endpoints of the line segments to the center of the circle are sorted to obtain the shortest distances from all endpoints of the line segments to the center of the circle.

[0132] Let the set of line segments obtained in step S1 be... ,in Indicates the first Given a set of line segments, where m is the number of line segments in the set, find the maximum distance from the line segment to the center of the circle. and minimum distance It can be represented as:

[0133]

[0134]

[0135] in, They represent the first The start and end point coordinates of the i-th line segment The maximum distance of the i-th line segment to the circle center And the minimum distance The calculation schematic diagram is shown in the accompanying Figure 4 The minimum distance set of all line segments to the circle center Can be expressed as:

[0136]

[0137] The shortest distance of all line segment end points to the circle center Can be expressed as:

[0138]

[0139] The final shortest distance Is shown in the accompanying Figure 4

[0140] S3: Take the shortest distance of the line segment end points to the circle center obtained in step S2 Times as the threshold value, compare the minimum distance of all line segment end points to the circle center in the line segment set With the size of the threshold value, if the minimum distance of a line segment end point to the circle center is less than the threshold value, put it into the new line segment set , otherwise do not put it in;

[0141]

[0142] S4: For the new line segment set obtained in step S3 , sort the maximum distance of all line segment end points to the circle center in the set , and the longest distance is the line segment corresponding to the precision instrument pointer;

[0143] Let the new line segment set Be , where Indicates the i-th line segment; the maximum distance set of all line segments to the circle center in the set Can be expressed as:

[0144]

[0145] The longest distance of all line segment end points to the circle center in the new line segment set Can be expressed as:

[0146] ​​​​​

[0147] wherein represents the new set of line segments , the first line segment in , the final longest distance Figure 4 is obtained.As shown in the accompanying drawings, the corresponding line segment is the detected precision instrument pointer.

[0148] S5: For the line segment detected in step S4, obtain the coordinate of the endpoint far from the center of the circle , and the deflection angle of the pointer can be obtained according to the point and the center of the circle ;

[0149]

[0150] Example 7:

[0151] This embodiment is based on example 6, and the specific processing process of step D is as follows:

[0152] Step D1: For the corrected dial image obtained in step B , mean filtering is performed, and then Canny edge detection algorithm is used for processing to detect all edge features in the image;

[0153] Step D2: Find all contours in the image and draw the corresponding maximum circumscribed rectangle, calculate the area, aspect ratio, and length of the line connecting the center of the rectangle and the center of the circle of all maximum circumscribed rectangles;

[0154] Suppose the detected contour set is , where is the number of contours. For each contour , let the length and width of its maximum circumscribed rectangle be and , let the center coordinates of the maximum circumscribed rectangle be , and the area , aspect ratio , and the length of the line connecting the center of the rectangle and the center of the circle be respectively:

[0155]

[0156] Step D3: Set the area threshold range , aspect ratio threshold range , and threshold value of the length of the line connecting the center of the rectangle and the center of the circle If the area, aspect ratio, and length of the line connecting the center of the rectangle and the center of the circle of a certain contour all meet the set thresholds, then the edge contour is added to the scale line set. middle;

[0157]

[0158] Finally, the set of scale lines. It stores all edge contours that meet the conditions.

[0159] Step D4: For the set of tick marks from step D3 Calculate the centers of all bounding rectangles corresponding to the contour. and the center Angle of the line Sort the angles from smallest to largest, and the outline of the circumscribed rectangle with the smallest angle is the zero mark. The outline of the circumscribed rectangle with the largest angle is the full-scale line. ;

[0160]

[0161]

[0162] Step D5: Detect the zero mark and full scale line Then, the center point of the corresponding largest bounding rectangle is respectively... and Using these two points as its direction points, the angle of deflection between these two points and the center of the circle can be calculated. and .

[0163]

[0164]

[0165] Example 8:

[0166] Based on Example 7, the specific processing procedure of step E in this embodiment is as follows:

[0167] Step E1: Based on the known instrument range The zero-degree line deflection angle obtained in step D Angle of full scale line and the pointer deflection angle obtained in step C The reading of the precision instrument can then be calculated using geometric relationships. The calculation formula is as follows:

[0168]

[0169] Example 9:

[0170] This embodiment provides an automatic identification and reading device for a precision pointer instrument resistant to light interference, including an image acquisition module. The acquisition of instrument images is controlled by a program, and the automatic identification and reading method for the precision pointer instrument resistant to light interference is used to realize the automatic reading of the precision pointer instrument.

[0171] The effectiveness of this invention was verified using experimental samples, compared with traditional algorithms. The experimental results are attached. Figure 5 and 6 As shown. (Attached) Figure 5 In Figure (a), the local features within the bounding box of the original image show a noticeable tilt, indicating that the original circular dial image is tilted. After correcting the circular dial image based on local invariant features of the image, the local features within the bounding box in Figure (b) are significantly corrected, demonstrating the good effect of the circular dial image correction based on local invariant features proposed in this invention. (Appendix) Figure 6 In Figure (a), the result detected by the existing Hough line detection algorithm contains many interfering line segments. In Figure (b), the result detected by the improved Hough line detection algorithm of this invention can effectively eliminate interfering line segments and thus accurately detect the pointer line segments. Experimental results show that this invention can still accurately complete the pointer detection and reading tasks even when the input image is interfered with (the captured image is tilted, there is lighting interference, etc.), and has strong resistance to lighting interference and stability.

[0172] In summary, the method of the present invention can simultaneously meet the requirements of robustness, accuracy, and the elimination of the need for strict control of auxiliary information such as illumination conditions and imaging angles in image imaging, making it highly practical.

Claims

1. An automatic identification and reading method for a precision pointer instrument resistant to light interference, characterized in that... Includes the following steps: Step A: Preprocess the image of the precision instrument captured by the camera to obtain the RGB image of the dial, and obtain the coordinates of the four vertices A, B, C, and D of its smallest bounding rectangle; Step B: For the RGB image of the dial from Step A, correct its circular dial area using image-based local invariant features; Step C: For the precision instrument image corrected in Step B, detect its pointer direction; Step D: For the precision instrument image calibrated in Step B, detect the direction of its zero mark and full-scale mark; Step E: Calculate the reading; The specific processing procedure for step B is as follows: Step B1: Convert the RGB image of the dial from Step A to grayscale to obtain its grayscale image. ; Step B2: Process the grayscale image obtained in Step B1 using an adaptive binarization algorithm to obtain the binary image of the precision instrument. ; Step B3: Use the center point of the RGB image of the dial from Step A as the center of the dial circle. ; (1) in This indicates the width of the RGB image on the dial. Indicates the height of the RGB image on the dial; Step B4: Crop the lower half of the binary image obtained in step B2. Detect the local invariant features and identify the four vertices A2, B2, C2, and D2 of its minimum bounding rectangle; Step B5: Obtain the four vertices of the original RGB image of the dial based on the principle of similar triangles, and then calculate the perspective transformation matrix to perform correction processing on the circular dial image; specifically including the following steps: B5-1: For the minimum bounding rectangle of the locally invariant features obtained in step B4, construct two right triangles a1 and a2 using the top and bottom edges of the minimum bounding rectangle as hypotenuses respectively; simultaneously, construct two right triangles b1 and b2 using the top and bottom edges of the RGB image of the dial in step A as legs respectively; right triangle a1 is similar to right triangle b1, and right triangle a2 is similar to right triangle b2; then calculate the similarity ratio for the two sets of similar right triangles. According to the similarity ratio Calculate the unknown vertices A1 and D1 of right triangles b1 and b2 in the RGB image of the dial in step A respectively; draw perpendicular lines from these two vertices A1 and D1 to the hypotenuse of another right triangle to obtain a square with the same tilt as the RGB image of the dial in step A. Use the four vertices of this square as the four vertices A1, B1, C1, and D1 of the RGB image of the dial before correction. B5-2: The four vertices A1, B1, C1, and D1 obtained in step B5-1 and the four vertices A, B, C, and D of the RGB image of the dial in step A constitute four pairs of point coordinates. Based on these four sets of point coordinates, the perspective transformation matrix from the tilted circular dial image to the corrected circular dial image can be calculated. B5-3: Use the perspective transformation matrix obtained in step B5-2 to process the tilted circular dial image to obtain the corrected dial image. ; The specific processing procedure for step C is as follows: Step C1: For the corrected dial image obtained in step B5-3 The image is converted to grayscale and then processed using an adaptive binarization algorithm to obtain a binary image of the corrected precision instrument dial. ; Step C2: For the binary image obtained in step C1 The Canny edge detection algorithm is used to detect edge features in the image; an improved Hough line detection algorithm is used to detect the corrected dial image. The pointer segment in the text is specifically: S1: Detecting images using the Hough line detection algorithm The line segments in the set are obtained by taking the line segments from the set of line segments. ; S2: For the set of line segments obtained in step S1 For any line segment in the circle, calculate the distance from its two endpoints to the center of the circle. The distances are denoted as the maximum and minimum distances from the line segment to the center of the circle; this is achieved by traversing the set of line segments. Find the distance from the endpoints of all line segments to the center of the circle; sort the minimum distances from the endpoints of all line segments to the center of the circle to obtain the shortest distance from the endpoints of all line segments to the center of the circle. S3: The shortest distance from the endpoint of the line segment to the center of the circle, obtained in step S2. of Using a multiple as a threshold, compare the set of line segments. The minimum distance from the endpoints of all line segments to the center of the circle is compared with a threshold. If the minimum distance from the endpoint of a line segment to the center of the circle is less than the threshold, then the line segment is added to a new set of line segments. Otherwise, do not put it in; S4: For the new set of line segments obtained in step S3 , will set Sort all line segments by the maximum distance from their endpoints to the center of the circle, and the line segment with the longest distance corresponds to the pointer of the precision instrument. S5: For the line segments detected in step S4, obtain the coordinates of the endpoints that are farther from the center of the circle. According to the point and the center The deflection angle of the pointer can then be determined. ; (2)。 2. The method according to claim 1, characterized in that, The specific processing procedure for step D is as follows: Step D1: For the corrected dial image obtained in step B The image is then subjected to mean filtering and processed using the Canny edge detection algorithm to detect all edge features in the image. Step D2: Find all contours in the image and draw the corresponding maximum bounding rectangles. Calculate the area, aspect ratio, and length of the line connecting the center of the rectangle to the center of the circle for all maximum bounding rectangles. Step D3: Add the outlines whose area, aspect ratio, and length of the line connecting the center of the rectangle and the center of the circle all meet the set thresholds to the scale line set. middle; Step D4: For the set of tick marks Calculate the centers of all bounding rectangles corresponding to the contour. and the center Angle of the line Sort the angles from smallest to largest, and the outline of the circumscribed rectangle with the smallest angle is the zero mark. The outline of the circumscribed rectangle with the largest angle is the full-scale line. ; Step D5: Set the zero mark and full scale line The center point of the corresponding largest bounding rectangle and Using these two points as direction points, the distance between them and the center of the circle can be calculated. The zero-degree line deflection angle of the connecting line Angle of full scale line .

3. The method according to claim 1, characterized in that, The specific processing procedure for step E is as follows: According to the instrument range Zero mark deflection angle Angle of full scale line and pointer deflection angle The reading of the precision instrument at this time is calculated using geometric relationships. .

4. A precision pointer-type instrument automatic identification and reading system that implements the method of any one of claims 1-3, characterized in that... include: The data acquisition and preprocessing module acquires and preprocesses images of precision instruments, and simultaneously acquires the four vertices of the minimum bounding rectangle. The correction module uses image-based local invariant features to correct the RGB image of the dial. The first calculation module detects the pointer direction of the corrected RGB image of the dial and calculates the pointer deflection angle. The second calculation module detects the zero-scale line deviation angle and the full-scale line deviation angle of the calibrated dial RGB image; The third calculation module calculates the reading based on the instrument's range, the zero-scale deflection angle, the full-scale deflection angle, and the pointer deflection angle.

5. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-3.

6. A computing device comprising a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of any one of claims 1-3.

Citation Information

Patent Citations

  • Round pointer type instrument automatic reading method based on deep learning

    CN115546795A