Image-based pointer-type instrument reading recognition method and related device thereof
By using image processing technology to identify target pointer lines from instrument images, the problems of low reliability and poor stability of manual readings are solved, and high-precision and efficient automatic identification of instrument readings is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-03-27
AI Technical Summary
In existing technologies, manually obtaining instrument readings suffers from low reliability, poor stability, and slow speed, making it difficult to detect parameter changes in a timely manner, which restricts the improvement of industrial automation levels.
Using image processing technology, OpenCV and line detection algorithms are used to identify the target pointer line from the instrument image. The pointer angle is calculated by combining the center of the dial and the start and end points of the range to obtain the instrument reading.
It improves the accuracy and recognition efficiency of pointer instrument readings, enhances the stability of readings, and enables timely detection of parameter changes.
Smart Images

Figure CN121392858B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular to a pointer instrument reading recognition method based on images and a related device thereof. BACKGROUND
[0002] Instruments and meters are very common measurement tools in the industrial field, and are important basis for monitoring, adjusting and controlling the running state of industrial production. In order to understand the working condition of equipment at any time, the readings of these instruments and meters need to be obtained in real time.
[0003] At present, the data displayed on the instruments and meters is generally obtained manually by workers during equipment operation. However, due to the influence of subjective factors such as human eye resolution and fatigue, the reliability of the instrument reading is low, the stability is poor, the speed is slow, and it is difficult to discover parameter mutation in operation in time. In fact, this has become one of the key factors restricting the improvement of industrial automation level. SUMMARY
[0004] To solve or partially solve the problems in the related art, the present application provides a pointer instrument reading recognition method based on images and a related device thereof, which can determine a target pointer line from an instrument image, obtain an instrument reading according to the relative angle between the target pointer line, the center of a circle and the start and end points of a range, and improve the accuracy, recognition efficiency and stability of the pointer instrument reading.
[0005] The first aspect of the present application provides a pointer instrument reading recognition method based on images, comprising: obtaining an instrument image of a pointer instrument to be recognized; wherein the instrument image at least includes a dial circle corresponding to the pointer instrument and a center of the dial circle; determining at least one candidate pointer line from the instrument image based on a preset straight line detection algorithm; taking a connecting line between a first intersection point between the candidate pointer line and the dial circle and the center of the dial circle as a candidate line segment, and determining a target pointer line from the candidate line segment; wherein the target pointer line is the line segment with the most edge points in the candidate line segment; determining a pointer angle of the target pointer line and an instrument reading corresponding to the pointer angle according to a second intersection point between the target pointer line and the dial circle, the center of the dial circle, a start point of a range of the pointer instrument and an end point of the range.
[0006] With reference to the first aspect, in a possible implementation manner of the first aspect, before the at least one candidate pointer line is determined from the instrument image based on the preset straight line detection algorithm, the method further includes: identifying the instrument image by using OpenCV to obtain a current direction of the dial circle; calculating an angle difference between the current direction and a preset reference direction, and performing rotation correction on the instrument image according to the angle difference, so that the current direction of the dial circle is aligned with the preset reference direction.
[0007] With reference to the first aspect, in a possible implementation manner of the first aspect, the at least one candidate pointer line is determined from the instrument image based on the preset straight line detection algorithm, including: performing edge detection on the instrument image based on an edge detection operator or a LSD straight line detection algorithm to obtain an edge feature map; performing Hough transform on the edge feature map to obtain at least one candidate straight line; and determining a candidate straight line with a distance from the center of the pointer instrument being less than a preset distance threshold as the candidate pointer line.
[0008] With reference to the first aspect, in a possible implementation manner of the first aspect, the method further includes: performing an inflation operation on the edge feature map.
[0009] With reference to the first aspect, in a possible implementation manner of the first aspect, the candidate straight line with the distance from the center of the pointer instrument being less than the preset distance threshold is determined as the candidate pointer line, including: calculating a perpendicular distance from the center to each of the candidate straight lines; and determining a candidate straight line with the perpendicular distance being less than the preset distance threshold as the candidate pointer line.
[0010] With reference to the first aspect, in a possible implementation manner of the first aspect, the pointer angle of the target pointer line and an instrument reading corresponding to the pointer angle are determined according to the second intersection point between the target pointer line and the dial circle, the center of the dial circle, a range start point and a range end point of the pointer instrument, including: calculating the pointer angle of the target pointer line according to the following formula:
[0011]
[0012] wherein, is the pointer angle of the target pointer line; , is a coordinate of the second intersection point; , is a coordinate of the center of the circle; a pointer angle of the target pointer line is normalized to obtain a normalized value corresponding to the pointer angle; wherein the normalized value ranges from 0 to 1; and an instrument reading corresponding to the pointer angle is determined according to the normalized value, a range start point and a range end point of the pointer instrument.
[0013] With reference to the first aspect, in a possible implementation form of the first aspect, the normalized value corresponding to the pointer angle is calculated according to the following formula:
[0014]
[0015] wherein, is the normalized value corresponding to the pointer angle; is the pointer angle of the target pointer line; is an angle corresponding to the range start point; is an angle corresponding to the range end point.
[0016] The second aspect of the present application provides an image-based pointer instrument reading recognition device, comprising: an acquisition module configured to acquire an instrument image of a pointer instrument to be recognized; wherein the instrument image comprises at least a dial circle corresponding to the pointer instrument and a center of the dial circle; a first determination module configured to determine at least one candidate pointer line from the instrument image based on a preset straight line detection algorithm; a second determination module configured to take a connecting line between a first intersection point between the candidate pointer line and the dial circle and the center of the dial circle as a candidate line segment, and determine a target pointer line from the candidate line segment; wherein the target pointer line is a line segment with the most edge points in the candidate line segment; and a processing module configured to determine a pointer angle of the target pointer line and an instrument reading corresponding to the pointer angle according to a second intersection point between the target pointer line and the dial circle, the center of the dial circle, a range start point and a range end point of the pointer instrument.
[0017] The third aspect of the present application provides an electronic device, comprising:
[0018] a processor; and
[0019] a memory having executable code stored thereon, which, when executed by the processor, causes the processor to perform the method described above.
[0020] The fourth aspect of the present application provides a computer-readable storage medium having executable code stored thereon, which, when executed by a processor of an electronic device, causes the processor to perform the method described above.
[0021] The technical solution provided by the present application can have the following beneficial effects:
[0022] An image-based pointer type instrument reading recognition method and related device thereof are provided. The method includes: obtaining an instrument image of a pointer type instrument to be recognized; wherein the instrument image at least includes a dial circle corresponding to the pointer type instrument and a center of the dial circle; determining at least one candidate pointer line from the instrument image based on a preset straight line detection algorithm; taking a connecting line between a first intersection point between the candidate pointer line and the dial circle and the center of the dial circle as a candidate line segment, and determining a target pointer line from the candidate line segment; wherein the target pointer line is a line segment with the most edge points in the candidate line segment; determining a pointer angle of the target pointer line and an instrument reading corresponding to the pointer angle according to a second intersection point between the target pointer line and the dial circle, the center of the dial circle, a range start point and a range end point of the pointer type instrument. In this way, the target pointer line can be determined from the instrument image, and the instrument reading can be obtained according to the relative angle between the target pointer line, the center of the dial circle and the range start and end points, thereby improving the accuracy, recognition efficiency and stability of the pointer type instrument reading.
[0023] It should be understood that the general description above and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0024] The above and other objects, features and advantages of the present application will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings in which like reference characters refer to like parts throughout the several views.
[0025] Figure 1 is a flowchart of an image-based pointer type instrument reading recognition method according to an embodiment of the present application;
[0026] Figure 2 is a structural diagram of an image-based pointer type instrument reading recognition device according to an embodiment of the present application;
[0027] Figure 3 is a structural diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0028] The embodiments of the present application will be described in detail with reference to the drawings. Although the embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.
[0029] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting. As used in this application and the appended claims, the singular forms "a," "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "and / or," as used herein, refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0030] It should be understood that although the terms "first," "second," "third," etc. can be used in this application to describe various information, the information should not be limited to these terms. These terms are only used to distinguish one piece of information from another piece of information. For example, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as the first information without departing from the scope of the application. Therefore, the features defined with "first," "second" can explicitly or implicitly include one or more of the features. In the description of the application, the meaning of "a plurality of" is two or more, unless otherwise specifically limited.
[0031] Instruments and meters are widely used in the industrial field as a measuring tool, and are an important basis for monitoring, adjusting and controlling the running state of industrial production. In order to understand the working condition of the equipment at any time, it is necessary to obtain the readings of these instruments and meters in real time.
[0032] At present, the data displayed on the instruments and meters is generally obtained manually by the workers during the operation of the equipment. However, due to the influence of subjective factors such as the resolution ability of the human eye and fatigue, the reliability of the meter reading is low, the stability is poor, the speed is slow, and it is difficult to discover the parameter mutation in time. In fact, this has become one of the key factors restricting the improvement of the level of industrial automation.
[0033] In view of the above problems, the embodiments of the present application provide an image-based pointer-type instrument reading recognition method and related device, which can determine a target pointer line from the instrument image, obtain the instrument reading according to the relative angle between the target pointer line, the center of the circle and the start and end points of the range, and improve the accuracy, recognition efficiency and stability of the pointer-type instrument reading.
[0034] The technical solutions of the embodiments of the present application are described in detail below with reference to the drawings.
[0035] Figure 1 is a flowchart of the image-based pointer-type instrument reading recognition method according to the embodiments of the present application.
[0036] Referring to Figure 1 An image-based pointer-type instrument reading recognition method, comprising:
[0037] S110: Obtain an instrument image of the pointer instrument to be recognized; wherein the instrument image at least includes a dial circle corresponding to the pointer instrument and a center of the dial circle.
[0038] Specifically, the instrument image of the pointer instrument can be obtained by an image acquisition device, for example, the pointer instrument can be photographed by a camera on an automatic robot to obtain a corresponding instrument image. The instrument image includes the entire pointer instrument, the dial circle is the peripheral contour of the dial area of the pointer instrument, and the center is the center of the pointer instrument.
[0039] In a possible implementation, the instrument image is recognized by using OpenCV to obtain a current direction of the dial circle; an angle difference between the current direction and a preset reference direction is calculated, and the instrument image is rotated and corrected according to the angle difference, so that the current direction of the dial circle is aligned with the preset reference direction.
[0040] Specifically, the actual orientation of the dial circle is first recognized by OpenCV, and then the recognized current direction is compared with a preset standard reference direction, and an angle difference between the two is calculated. The entire instrument image is rotated and corrected according to the angle difference, so that the orientation of the dial circle is completely aligned with the preset reference direction. This can standardize the original instrument image to a unified and positive image even if the original instrument image is inclined, thereby ensuring that the dial circle is always aligned with the preset reference direction, and further ensuring accurate recognition of the target pointer line, and finally making the determination of the instrument reading more accurate and reliable.
[0041] S120: Determine at least one candidate pointer line from the instrument image based on a preset straight line detection algorithm.
[0042] Specifically, after obtaining the instrument image, the instrument image can be detected by a preset straight line detection algorithm to obtain a plurality of candidate pointer lines. The candidate pointer line is a straight line obtained by preliminary recognition. Since there can be scale lines, characters and other interference in the image, further judgment is required. For example, the instrument image can be subjected to local contrast enhancement, and then a straight line extraction method based on a pixel gradient direction is used to extract a straight line from the instrument image to obtain the candidate pointer line.
[0043] In a possible implementation, at least one candidate pointer line is determined from the instrument image based on a preset straight line detection algorithm, including: performing edge detection on the instrument image based on an edge detection operator or an LSD straight line detection algorithm to obtain an edge feature map; performing Hough transformation on the edge feature map to obtain at least one candidate straight line; and determining a candidate straight line with a distance from the center of the pointer instrument less than a preset distance threshold as a candidate pointer line.
[0044] Specifically, the edge detection operator is used to identify the regions with sharp changes in brightness in the image, which usually correspond to the boundaries or contours of the objects, so as to extract the structural information in the image and obtain an edge feature map, for example, the Canny operator is used for edge detection. The LSD line detection algorithm can directly output the straight line segments in the image, including their positions, lengths and directions. After obtaining the edge feature map, the discrete edge points in the edge feature map can be connected into potential straight lines through the Hough transform, and the candidate straight lines are obtained. The preset distance can be used to determine whether the distance between the candidate straight line and the center of the circular pointer is close enough, and the obtained candidate pointer lines can be multiple, which can eliminate the straight lines obviously not belonging to the pointer, and is beneficial to improving the efficiency and accuracy of the entire recognition process.
[0045] For example, the instrument image can be processed by the Canny edge detection operator to obtain a binary edge feature map including the scale lines of the instrument panel, the contour of the pointer and other features, and then the Hough transform is performed on the edge feature map to identify the straight line segments in the image, and the line segments are used as candidate straight lines. Then, the candidate straight lines with a distance less than a preset distance threshold from the center of the circular pointer are determined as the candidate pointer lines.
[0046] In a possible implementation, the method further includes: performing an inflation operation on the edge feature map.
[0047] Specifically, the inflation operation is a morphological image processing technique, and the inflation operation on the edge feature map can enhance the connectivity and integrity of the edges, and can more effectively identify complete and continuous straight lines, thereby improving the detection success rate and accuracy of the candidate pointer lines.
[0048] In a possible implementation, the candidate straight lines with a distance less than a preset distance threshold from the center of the circular pointer are determined as the candidate pointer lines, including: calculating the perpendicular distance from the center of the circular pointer to each candidate line segment; and determining the candidate straight line with a perpendicular distance less than the preset distance threshold as the candidate pointer line.
[0049] Specifically, the perpendicular distance from the center of the circular pointer to each candidate line segment can be obtained by performing perpendicularity on each candidate line segment with respect to the center of the circular pointer, the foot of the perpendicularity being the intersection point of the center of the circular pointer and the candidate line segment, and the distance between the center of the circular pointer and the foot of the perpendicularity being calculated. In this way, the shortest distance between each straight line and the center of the circular pointer is obtained. By determining the candidate straight line with a perpendicular distance less than the preset distance threshold as the candidate pointer line, the selection process of the candidate pointer line can be more accurate, and the non-pointer lines can be avoided from being identified as the candidate pointer lines, thereby improving the reliability of the reading.
[0050] S130: connecting the first intersection point between the candidate pointer line and the dial circle and the center of the dial circle as a candidate line segment, and determining the target pointer line from the candidate line segment; wherein the target pointer line is the line segment with the most edge points in the candidate line segment.
[0051] Specifically, the candidate line segment refers to the line segment connecting the first intersection point between the candidate pointer line and the dial circle and the center of the dial circle. There will be edge points on the candidate line segment. The edge point is a point of pixel gray scale mutation in the image, which can be used to determine whether the direction is the position of the pointer. Then, the line segment with the most edge points is determined as the target pointer line from the candidate line segment. The target pointer line is the line segment of the actual pointer.
[0052] S140: determining the pointer angle of the target pointer line and the instrument reading corresponding to the pointer angle according to the second intersection point between the target pointer line and the dial circle, the center of the dial circle, the range start point and the range end point of the pointer instrument.
[0053] Specifically, the pointer angle of the target pointer line can be determined according to the second intersection point between the target pointer line and the dial circle and the center of the dial circle. The pointer angle refers to the angle formed by the target pointer line relative to the range start point of the instrument. The range start point refers to the position point indicating the minimum measurement value on the instrument dial, which usually corresponds to the "0" scale or the lowest scale value. The range end point refers to the position point indicating the maximum measurement value on the instrument dial, which usually corresponds to the full-scale value. After obtaining the pointer angle, the instrument reading can be calculated according to the range of the pointer instrument. This instrument reading acquisition method can reduce the influence of the environment, such as reflection and shadow, and improve the accuracy, recognition efficiency and stability of the reading of the pointer instrument.
[0054] For example, in an industrial scenario, an automatic reading of a thermometer with a range of 0-100℃ is required, which can be achieved by an automatic robot. First, the automatic robot is moved to a preset position, and then an instrument image of the thermometer is captured by a camera, which at least includes a dial circle corresponding to the thermometer and a center of the dial circle. Then, the obtained instrument image can be preprocessed, such as local contrast enhancement, to highlight the pointer area. Then, each pixel point in the image is scanned and the intensity change of the surrounding pixels is analyzed. If a series of consecutive pixel points with consistent intensity change direction and forming a straight line are found, the straight line is identified as a candidate pointer line. In this way, a plurality of candidate pointer lines are obtained, which can be the edges of the pointer, the scale lines of the dial, and the pseudo straight lines formed by the reflection area, etc. Then, the first intersection between the candidate pointer line and the dial circle and the connecting line between the center are taken as candidate line segments, and the number of edge points contained in each line segment is counted, for example, 50 edge points are counted on the first candidate line segment, 10 on the second candidate line segment, and 60 on the third candidate line segment. Then, the third candidate line segment is taken as the target pointer line. After obtaining the target pointer line, the second intersection between the target pointer line and the dial circle and its coordinates are obtained, and the pointer angle of the target pointer line is calculated according to the second intersection and the center, for example, the calculated pointer angle is 270 degrees. Meanwhile, it is known that the angle corresponding to the range start point (0℃) of the thermometer is 210 degrees, and the angle corresponding to the range end point (100℃) is 330 degrees. Therefore, the actual instrument reading can be converted from the pointer angle.
[0055] In a possible implementation, the pointer angle of the target pointer line and the instrument reading corresponding to the pointer angle are determined according to the second intersection between the target pointer line and the dial circle, the center of the dial circle, the range start point and the range end point of the pointer instrument, which includes:
[0056] The pointer angle of the target pointer line is calculated according to the following formula:
[0057]
[0058] wherein, the pointer angle of the target pointer line; (the , ) is the coordinate of the second intersection; (the , ) is the coordinate of the center; the pointer angle is normalized to obtain a normalized value corresponding to the pointer angle; wherein the normalized value ranges from 0 to 1; and the instrument reading corresponding to the pointer angle is determined according to the normalized value, the range start point and the range end point of the pointer instrument.
[0059] Specifically, after the target pointer line is determined, a rectangular coordinate system can be made in the instrument image, and the coordinates corresponding to the second intersection point and the center of the dial circle are obtained, and then the pointer angle of the target pointer line is calculated, and then the normalized value of the pointer angle is calculated according to the angle corresponding to the range start point and the angle corresponding to the range end point, and then the actual instrument reading can be obtained through the normalized value, for example, the instrument reading can be calculated through the formula: instrument reading = range start point value + normalized value × (range end point value - range start point value).
[0060] For example, the center coordinates of the dial circle are (300, 300), and the second intersection point coordinates of the target pointer line and the dial circle are (400, 200), and then the pointer angle of the target pointer line can be calculated as -45 degrees, and then the normalized value is calculated according to the angle corresponding to the range start point and the angle corresponding to the range end point, and then the instrument reading is calculated through the range end point value and the range start point value.
[0061] In a possible implementation, the normalized value corresponding to the pointer angle is calculated according to the following formula:
[0062]
[0063] wherein, the normalized value corresponding to the pointer angle; the pointer angle of the target pointer line; the angle corresponding to the range start point; the angle corresponding to the range end point.
[0064] Specifically, the normalized value corresponding to the pointer angle of the target pointer line can be calculated through the angle corresponding to the range start point and the angle corresponding to the range end point, which can better identify the actual instrument reading from the image. For example, the angle corresponding to the range start point of the pointer instrument is 30 degrees, the angle corresponding to the range end point is 270 degrees, and the pointer angle of the target pointer line is 150 degrees, which can be calculated to obtain the normalized value corresponding to the pointer angle as 0.5, that is, the current pointer is located at 50% of the entire range, and then the final instrument reading can be determined according to the normalized value combined with the actual range value of the instrument (for example, if the range is 0-100 units, the reading is 50 units).
[0065] The image-based pointer instrument reading recognition method of the present application comprises: acquiring an instrument image of a pointer instrument to be recognized; wherein the instrument image comprises at least a dial circle corresponding to the pointer instrument and a center of the dial circle; determining at least one candidate pointer line from the instrument image based on a preset straight line detection algorithm; taking a connecting line between a first intersection point between the candidate pointer line and the dial circle and the center as a candidate line segment, and determining a target pointer line from the candidate line segment; wherein the target pointer line is a line segment with the most edge points in the candidate line segment; and determining a pointer angle of the target pointer line and an instrument reading corresponding to the pointer angle according to a second intersection point between the target pointer line and the dial circle, the center of the dial circle, a range start point and a range end point of the pointer instrument. In this way, the target pointer line can be determined from the instrument image, and the instrument reading can be obtained according to the relative angle between the target pointer line, the center, and the range start and end points, thereby improving the accuracy, recognition efficiency, and stability of the pointer instrument reading.
[0066] Corresponding to the foregoing application function implementation method embodiments, the present application also provides a pointer instrument reading recognition device, an electronic device, and corresponding embodiments.
[0067] Figure 2 FIG. 1 is a structural schematic diagram of an image-based pointer instrument reading recognition device according to an embodiment of the present application.
[0068] Referring to Figure 2 An image-based pointer instrument reading recognition device 200 comprises:
[0069] An acquisition module 210 is configured to acquire an instrument image of a pointer instrument to be recognized; wherein the instrument image comprises at least a dial circle corresponding to the pointer instrument and a center of the dial circle.
[0070] In a possible implementation, the acquisition module 210 is further configured to identify the instrument image by using OpenCV to obtain a current direction of the dial circle; calculate an angle difference between the current direction and a preset reference direction, and rotate and correct the instrument image according to the angle difference, so as to align the current direction of the dial circle with the preset reference direction.
[0071] A first determination module 220 is configured to determine at least one candidate pointer line from the instrument image based on a preset straight line detection algorithm.
[0072] In a possible implementation, the first determination module 220 is further configured to perform edge detection on the instrument image based on an edge detection operator or an LSD straight line detection algorithm to obtain an edge feature map; perform Hough transformation on the edge feature map to obtain at least one candidate straight line; and determine a candidate straight line with a distance from the center of the pointer instrument less than a preset distance threshold as a candidate pointer line.
[0073] In a possible implementation, the first determining module 220 is further configured to perform an expansion operation on the edge feature map.
[0074] In a possible implementation, the first determining module 220 is further configured to calculate a vertical distance from the center of the circle to each candidate line segment; and determine a candidate straight line corresponding to a vertical distance less than a preset distance threshold as the candidate pointer line.
[0075] The second determining module 230 is configured to determine, as a candidate line segment, a connecting line between a first intersection point between the candidate pointer line and the dial circle and the center of the circle, and determine the target pointer line from the candidate line segment; and the target pointer line is a line segment with the most edge points in the candidate line segment.
[0076] The processing module 240 is configured to determine, according to a second intersection point between the target pointer line and the dial circle, the center of the dial circle, a range start point and a range end point of the pointer instrument, a pointer angle of the target pointer line and an instrument reading corresponding to the pointer angle.
[0077] In a possible implementation, the processing module 240 is further configured to calculate the pointer angle of the target pointer line according to the following formula:
[0078]
[0079] wherein, is the pointer angle of the target pointer line; , is a coordinate of the second intersection point; , is a coordinate of the center of the circle; normalize the pointer angle of the target pointer line to obtain a normalized value corresponding to the pointer angle; wherein the normalized value ranges from 0 to 1; and determine the instrument reading corresponding to the pointer angle according to the normalized value, the range start point and the range end point of the pointer instrument.
[0080] In a possible implementation, the processing module 240 is further configured to calculate the normalized value corresponding to the pointer angle according to the following formula:
[0081]
[0082] wherein, is the normalized value corresponding to the pointer angle; is the pointer angle of the target pointer line; is an angle corresponding to the range start point; is an angle corresponding to the range end point.
[0083] The image-based pointer instrument reading recognition device of the present application comprises: an acquisition module configured to acquire an instrument image of a pointer instrument to be recognized; wherein the instrument image comprises at least a dial circle corresponding to the pointer instrument and a center of the dial circle; a first determination module configured to determine at least one candidate pointer line from the instrument image based on a preset straight line detection algorithm; a second determination module configured to take a connecting line between a first intersection between the candidate pointer line and the dial circle and the center of the dial circle as a candidate line segment, and determine a target pointer line from the candidate line segment; wherein the target pointer line is a line segment with the most edge points in the candidate line segment; and a processing module configured to determine a pointer angle of the target pointer line and an instrument reading corresponding to the pointer angle according to a second intersection between the target pointer line and the dial circle, the center of the dial circle, a range start point and a range end point of the pointer instrument. In this way, the target pointer line can be determined from the instrument image, and the instrument reading can be obtained according to the relative angle between the target pointer line, the center of the dial circle and the range start and end points, thereby improving the accuracy, recognition efficiency and stability of the pointer instrument reading.
[0084] As to the device in the above-described embodiments, the specific manners in which various modules perform operations have been described in detail in the embodiments of the method, and thus will not be described in detail here.
[0085] The present application also provides an electronic device. Figure 3 A hardware structure schematic diagram of an embodiment of the electronic device of the present application is shown in FIG. 3. The electronic device comprises a memory 320 and at least one processor 310, the memory 320 is electrically connected to the at least one processor 310, the memory 320 stores instructions, and the at least one processor 310 invokes the instructions in the memory 320 to enable the electronic device to perform the image-based pointer instrument reading recognition method according to any one of the preceding embodiments of the present application.
[0086] Specifically, the processor 310 described above can comprise a central processing unit (CPU), or an application specific integrated circuit (ASIC), or can be configured as one or more integrated circuits that implement the embodiments of the present application.
[0087] The memory 320 can include mass storage for data or instructions. By way of example, and not limitation, the memory 320 can include a hard disk drive (HDD), floppy disk drive, flash memory, compact disk, digital versatile disk, optical disk, tape, or other storage device, two or more of the same, or a combination of some of the same, as suitable for a given implementation. The memory 320 can be removable or non-removable (or fixed) as suitable for a given implementation. The memory 320 can be internal or external to the integrated gateway disaster recovery device as suitable for a given implementation. In a particular embodiment, the memory 320 is non-volatile solid state memory. In a particular embodiment, the memory 320 includes read-only memory (ROM). The ROM can be mask programmed ROM, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), electrically alterable ROM (EAROM), or flash memory, or a combination of two or more of the same, as suitable for a given implementation.
[0088] In one example, the control device also includes a communication interface 330 and a bus 340. The processor 310, the memory 320, and the communication interface 330 are connected by the bus 340 and accomplish communication with each other.
[0089] The communication interface 330 is mainly used to realize the communication between the modules, devices, units and / or equipment in the embodiments of the application.
[0090] The bus 340 includes hardware, software, or both, that couples components of the online data traffic metering device to each other. By way of example, and not limitation, the bus can include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand (IB) interconnect, a Low Pin Count (LPC) bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or some other suitable bus or interconnect, or a combination of two or more of the same, as suitable for a given implementation. The bus 340 can include one or more buses, as suitable for a given implementation. Although the embodiments of the application describe and show a particular bus, the application contemplates any suitable bus or interconnect.
[0091] In addition, in combination with the image-based pointer-type instrument reading recognition method in the above-mentioned embodiments, the embodiments of the application can provide a computer readable storage medium to implement. The computer readable storage medium has an executable code stored thereon, and the executable code is executed by a processor to implement any one of the image-based pointer-type instrument reading recognition methods in the above-mentioned embodiments.
[0092] The present application is not limited to the particular configurations and processes described above and shown in the drawings. For the sake of brevity and clarity, detailed descriptions of well-known methods are omitted. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present application are not limited to the specific steps described and shown, and various changes, modifications and additions can be made thereto by those skilled in the art without departing from the spirit of the present application and the steps can be executed in different order.
[0093] The functional blocks shown in the above block diagrams can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, and the like. When implemented in software, the elements of the present application are program or code segments that are used to perform the required tasks. The program or code segments can be stored in a machine-readable medium or transmitted through a data signal carried in a carrier wave over a transmission medium or communication link. The "machine-readable medium" can include any medium that can store or transfer information. Examples of the machine-readable medium include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic medium, radio frequency (RF) links, and the like. The code segments can be downloaded via computer networks such as the Internet, intranet, and the like.
[0094] It is also noted that the exemplary embodiments mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above steps, that is, the steps can be executed in the order mentioned in the embodiments, or in an order different from the embodiments, or several steps can be executed simultaneously.
[0095] The above is merely specific embodiments of the present application, and those skilled in the art can clearly understand that, for the sake of brevity and conciseness, the specific working processes of the above-described systems, modules and units can refer to the corresponding processes in the foregoing method embodiments, which will not be described here. It should be understood that the protection scope of the present application is not limited thereto, and any skilled person in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be covered within the protection scope of the present application.
Claims
1. A method for recognizing pointer-type instrument readings based on images, characterized in that, include: Obtain an image of the pointer-type instrument to be identified; wherein the instrument image includes at least the dial circle corresponding to the pointer-type instrument and the center of the dial circle; Based on a preset line detection algorithm, at least one candidate pointer line is determined from the instrument image; this includes performing edge detection on the instrument image based on an edge detection operator or an LSD line detection algorithm to obtain an edge feature map; Perform a Hough transform on the edge feature map to obtain at least one candidate straight line; Candidate straight lines whose distance from the center of the pointer instrument is less than a preset distance threshold are identified as candidate pointer lines; The line connecting the first intersection point between the candidate pointer line and the dial circle and the center of the circle is taken as a candidate line segment, and the target pointer line is determined from the candidate line segments; wherein, the target pointer line is the line segment with the most edge points among the candidate line segments; Based on the second intersection point between the target pointer line and the dial circle, the center of the dial circle, the starting point and ending point of the range of the pointer instrument, the pointer angle of the target pointer line and the instrument reading corresponding to the pointer angle are determined.
2. The method according to claim 1, characterized in that, Before determining at least one candidate pointer line from the instrument image using the preset line detection algorithm, the method further includes: The current orientation of the dial circle is obtained by using OpenCV to recognize the instrument image. Calculate the angle difference between the current direction and the preset reference direction, and perform rotation correction on the instrument image based on the angle difference so that the current direction of the dial circle is aligned with the preset reference direction.
3. The method according to claim 1, characterized in that, Also includes: The edge feature map is dilated.
4. The method according to claim 1, characterized in that, The step of determining candidate straight lines whose distance from the center of the pointer instrument is less than a preset distance threshold as candidate pointer lines includes: Calculate the vertical distance from the center of the circle to each of the candidate line segments; Candidate straight lines whose vertical distance is less than the preset distance threshold are identified as candidate pointer lines.
5. The method according to claim 1, characterized in that, Based on the second intersection point between the target pointer line and the dial circle, the center of the dial circle, and the start and end points of the range of the pointer instrument, the pointer angle of the target pointer line and the corresponding instrument reading are determined, including: The pointer angle of the target pointer line is calculated using the following formula: in, The pointer angle of the target pointer line; , () represents the coordinates of the second intersection point; , () represents the coordinates of the center of the circle; The pointer angle of the target pointer line is normalized to obtain the normalized value corresponding to the pointer angle; wherein the normalized value ranges from 0 to 1. The instrument reading corresponding to the pointer angle is determined based on the normalized value, the starting point of the range, and the ending point of the range of the pointer instrument.
6. The method according to claim 5, characterized in that, Also includes: The normalized value corresponding to the pointer angle is calculated using the following formula: in, This is the normalized value corresponding to the pointer angle; The pointer angle of the target pointer line; The angle corresponding to the starting point of the range; The angle corresponding to the end point of the range.
7. An image-based pointer-type instrument reading recognition device, characterized in that, include: An acquisition module is used to acquire an image of a pointer-type instrument to be identified; wherein the instrument image includes at least the dial circle corresponding to the pointer-type instrument and the center of the dial circle; The first determining module is used to determine at least one candidate pointer line from the instrument image based on a preset line detection algorithm; including performing edge detection on the instrument image based on an edge detection operator or an LSD line detection algorithm to obtain an edge feature map; performing a Hough transform on the edge feature map to obtain at least one candidate line; and determining the candidate line whose distance from the center of the pointer instrument is less than a preset distance threshold as the candidate pointer line. The second determining module is used to take the connecting line between the first intersection point between the candidate pointer line and the dial circle and the center of the circle as a candidate line segment, and determine the target pointer line from the candidate line segments; wherein, the target pointer line is the line segment with the most edge points among the candidate line segments; The processing module is used to determine the pointer angle of the target pointer line and the instrument reading corresponding to the pointer angle based on the second intersection point between the target pointer line and the dial circle, the center of the dial circle, the starting point of the range and the ending point of the range of the pointer instrument.
8. An electronic device, characterized in that, include: processor; as well as A memory having executable code stored thereon, which, when executed by the processor, causes the processor to perform the method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, It stores executable code that, when executed by a processor of an electronic device, causes the processor to perform the method as described in any one of claims 1-6.
Citation Information
Patent Citations
Reading recognition method of pointer meter based on machine vision
CN109117720A