Method for reading a pointer gauge and products associated therewith
By correcting and preprocessing the binarized image of the pointer instrument, and combining conditional filtering and angle calculation, accurate readings are achieved in noisy and interference environments, solving the problem of inaccurate readings in existing technologies.
Patent Information
- Application Number
- CN202210022168.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-10
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2042-01-10
AI Technical Summary
Existing pointer-type instrument reading methods struggle to accurately extract pointer features in the presence of noise and interference, resulting in low reading accuracy.
By acquiring the binary image of the pointer instrument, image correction and preprocessing are performed. Pointer feature information is extracted using conditional filtering and morphological operations. The pointer deflection angle is calculated and compared with the scale angle to determine the reading result.
It enables accurate extraction of pointer features even in the presence of noise and interference, improving the accuracy and versatility of pointer-type instrument readings.
Smart Images

Figure CN114663681B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates generally to the field of instrument reading. More particularly, the present application relates to a method, apparatus and computer readable storage medium for reading a pointer instrument. BACKGROUND
[0002] As a kind of measuring instrument, pointer instrument has the characteristics of anti-electromagnetic interference, anti-seismic, oil stain resistance, anti-freezing and waterproof, low price and is widely used in the fields of electric power, finance, chemical industry, machinery and electronics. However, the traditional use method of pointer instrument is to rely on manual visual identification, which has the disadvantages of easy error, heavy workload and low efficiency. Therefore, by using camera to collect image information for automatic reading operation of pointer instrument, compared with manual reading, it has the advantages of high reading efficiency, all-weather and not affected by bad environment. At present, the existing method for reading pointer instrument considers that the collected pointer image is extracted in normal conditions, and the pointer feature can be extracted by a simple method. However, in some cases of actual scene, due to the reasons of camera shooting angle, light, dial pollution and the like, there will be much noise and interference information in the dial image collected by the camera. Therefore, when the pointer feature is extracted by the conventional simple method, it is easy to make mistakes, and thus the accuracy of reading the pointer value of pointer instrument is reduced. In view of this, a technical solution is needed in the prior art to accurately extract the pointer feature in the pointer instrument image with noise and interference information. SUMMARY
[0003] In order to solve at least one or more technical problems in the above background, the present application provides a method for reading a pointer instrument and related products thereof. Through the scheme of the present application, the pointer feature information in the pointer instrument image with noise and interference information can be accurately extracted, and thus the accurate reading of the pointer instrument is realized. For this purpose, the present application provides solutions in the following aspects.
[0004] In a first aspect, the present application discloses a method for reading a pointer instrument, characterized in that it comprises: acquiring a binary image of the pointer instrument; performing conditional screening on the binary image for extracting pointer feature information in the pointer instrument; calculating a deflection angle of the pointer according to the pointer feature information; and determining a reading result of the pointer instrument according to the deflection angle of the pointer and a scale deflection angle of the pointer instrument.
[0005] In one embodiment, wherein the acquiring the binarized image of the pointer gauge comprises acquiring the pointer gauge image, and performing image correction on the pointer gauge image; and performing image pre-processing on the corrected pointer gauge image to obtain the binarized image.
[0006] In yet another embodiment, wherein the acquiring the pointer gauge image comprises acquiring a template image of the pointer gauge, and calculating image features of the template image; acquiring a panorama image of the pointer gauge, and calculating image features of the panorama image; matching the image features of the template image with the image features of the panorama image to obtain a projection matrix, wherein the projection matrix is used to project and transform the panorama image into the template image; and projecting and transforming the panorama image into the template image using the projection matrix to obtain the pointer gauge image.
[0007] In yet another embodiment, wherein the performing image correction on the pointer gauge image comprises correcting a tilted and / or distorted reading dial in the pointer gauge image into a regular circular reading dial.
[0008] In yet another embodiment, wherein the performing image pre-processing on the processed pointer gauge image comprises one or more of image filtering smoothing, histogram equalization, adaptive threshold binarization, and morphological operation.
[0009] In yet another embodiment, wherein the performing conditional screening on the binarized image comprises performing area screening on first feature blocks in the binarized image to screen out first feature blocks satisfying a predetermined area as second feature blocks; performing center of gravity distance screening on the second feature blocks to screen out second feature blocks satisfying a predetermined distance as third feature blocks, wherein the center of gravity distance is the distance between the center of the dial of the pointer gauge and the center of gravity of the second feature blocks; and performing quantity screening on the third feature blocks to screen out third feature blocks satisfying a predetermined quantity as fourth feature blocks, wherein the fourth feature blocks are arranged in descending order of feature block area and are collected into the pointer feature information.
[0010] In yet another embodiment, wherein the calculating the deflection angle of the pointer according to the pointer feature information comprises performing morphological thinning operation on the fourth feature blocks in the pointer feature information to obtain image skeletons of the fourth feature blocks; and performing straight line detection on the image skeletons using a conventional method to calculate the deflection angle of the pointer, wherein the value of the deflection angle is recorded with the center of the dial of the pointer gauge as the starting point.
[0011] In yet another embodiment, wherein determining the reading result of the pointer gauge according to the deflection angle of the pointer and the deflection angle of the scale of the pointer gauge comprises obtaining the deflection angle of the smallest scale in the pointer gauge; obtaining the deflection angle of the largest scale in the pointer gauge; and comparing the deflection angle of the pointer with the deflection angle of the smallest scale and the deflection angle of the largest scale to calculate the reading result of the pointer gauge.
[0012] In a second aspect, the present application discloses a device for reading a pointer gauge, comprising: a processor; a memory storing program instructions for reading a pointer gauge, which, when executed by the processor, implement the method steps described above.
[0013] In a third aspect, the present application discloses a computer-readable storage medium storing program instructions for reading a pointer gauge, which, when executed by a processor, implement the method steps described above.
[0014] By using the method discussed in the above and the embodiments of the present application, the present application can perform a series of screening on the feature blocks in the binary image through conditional screening, and thus can effectively remove the noise feature blocks and interference feature blocks existing in the pointer gauge image. Further, by performing a morphological thinning operation on the screened pointer feature blocks, the deflection angle of the pointer in the pointer gauge can be obtained, and by comparing the deflection angle of the pointer with the deflection angle of the largest scale and the deflection angle of the smallest scale in the pointer gauge, the final reading of the pointer gauge can be obtained. Therefore, by using the method of the present application and the related products, the accurate and effective reading of the pointer gauge can be realized. BRIEF DESCRIPTION OF DRAWINGS
[0015] 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 a number of embodiments of the present application are shown by way of example, and wherein like reference numerals refer to like elements throughout. In the drawings:
[0016] Figure 1 is a simplified flowchart showing a method for reading a pointer gauge according to an embodiment of the present application;
[0017] Figure 2 is a detailed flowchart showing a method for reading a pointer gauge according to an embodiment of the present application;
[0018] Figure 3 is a schematic diagram exemplarily showing a binary pointer gauge image for gauge reading according to an embodiment of the present application; and
[0019] Figure 4 is a schematic block diagram showing an apparatus for reading a pointer instrument according to an embodiment of the present application. DETAILED DESCRIPTION
[0020] Embodiments will now be described with reference to the drawings. It should be understood that the drawings are diagrammatic and schematic and that for purposes of illustration the elements of the drawings are shown on a larger scale than they would be in actual use. It should be understood that, for the sake of clarity, the drawing figures are not necessarily drawn to scale and that, in actual practice, relative sizes and shapes of the components shown in the figures can be varied. In addition, the present application describes numerous specific details of the embodiments described herein to provide a thorough understanding of the embodiments described herein. However, it will be apparent to one ordinarily skilled in the art that the embodiments described herein can be practiced without these specific details. In other instances, well-known methods, procedures and components have not been described in detail to avoid obscuring aspects of the embodiments described herein. Also, this description is not to be taken as limiting the scope of the embodiments described herein.
[0021] Figure 1 is a simplified flow chart showing a method 100 for reading a pointer instrument according to an embodiment of the present application. First, at step S102, an operation of acquiring a binarized image of the pointer instrument is performed. Next, at step S104, by performing a conditional screening operation on the binarized image, pointer feature information in the pointer instrument can be extracted, where the conditional screening can include area screening, barycenter distance screening and / or number screening. After the pointer feature information is acquired at step S104, the flow proceeds to step S106. At step S106, a deflection angle of the pointer is calculated according to the pointer feature information. Next, at step S108, a reading result of the pointer instrument is determined according to the calculated pointer deflection angle and a scale deflection angle of the pointer instrument.
[0022] To facilitate understanding of the above-mentioned method for reading a pointer instrument, the following will be described in detail in conjunction with Figure 2 the method. Figure 2 is a detailed flow chart showing a method for reading a pointer instrument according to an embodiment of the present application.
[0023] As Figure 2As shown in the figure, first, in step S202, a panoramic image about a pointer instrument is collected and a template image about the pointer instrument is prepared, wherein the pointer instrument template image can adopt different template images according to different pointer instruments. In one application scenario, the panoramic image about the pointer instrument can be collected by using a camera, for example, and can be used to pass the panoramic image outwards. Then, in step S204, the image features of the obtained panoramic image are matched with the image features of the pointer instrument template image to obtain a pointer instrument image. In one application scenario, one or more of a scale-invariant feature transform algorithm (“SIFT”), a speeded up robust features algorithm (“SURF”), and / or a fast and rotated BRIEF algorithm (“ORB”) can be used to obtain the image features of the panoramic image and the pointer instrument template image.
[0024] Further, by matching the features of the two images, a projection matrix M transformed from the panoramic image to the template image can be obtained, wherein the matrix M can have the following expression:
[0025]
[0026] Then, by projecting and transforming the panoramic image into the pre-prepared pointer instrument template image by using the obtained projection matrix M, the pointer instrument image to be recognized can be further obtained, and the specific calculation formula is as follows:
[0027]
[0028] wherein (x p ,y p ) represents the panoramic image; (x t ,y t ) represents the pointer instrument image to be recognized; (x t ′,y t ′) represents the image coordinates after the projection transformation without scaling; and k represents a scaling factor.
[0029] After that, in step S206, an image correction operation is performed on the acquired pointer instrument image. It needs to be understood that due to the image shooting angle and other reasons, the instrument dial image in the pointer instrument image acquired via the projection transformation can have abnormal problems such as tilting and / or deformation. Therefore, the instrument dial needs to be corrected to a relatively regular circular dial, so as to facilitate the extraction of the subsequent pointer feature information and the precision reading of the instrument dial. In one application scenario, the specific correction steps are as follows:
[0030] 1. Calibrate n (n≥6) coordinates of the instrument dial edge in the pointer instrument image to be recognized, wherein the n coordinates are uniformly distributed on the instrument dial edge;
[0031] 2. Fit the obtained n coordinates of the instrument dial edge into an ellipse using the least square method, wherein the center coordinates of the ellipse are (x c ,y c ), the diagonal length of the minimum circumscribed rectangle is 2p, and the angle between the diagonal and the X axis is α. Further, according to the conditions of the above-mentioned ellipse, the four vertex coordinates of the minimum circumscribed rectangle of the ellipse are respectively: (x c +pcosα,y c -psinα), (x c +pcos(π-α),y c -psin(π-α)), (x c -pcosα,y c +psinα), and (x c -pcos(π-α),y c +psin(π-α)).
[0032] 3. It is specified that the graph of the instrument dial in the pointer instrument image becomes a circle after correction, wherein the radius of the circle is set as r, and the specific calculation formula of the radius r is as follows:
[0033] r=t·p (3)
[0034] Wherein t is the size adjustment ratio of the circumscribed rectangle, for example, t=1.0 can be taken.
[0035] Therefore, the four vertex coordinates of the corrected circle can be determined as: (x c +r,y c -r), (x c +r,y c +r), (x c -r,y c +r), and (x c -r,y c -r).
[0036] 4. Calculate the projection transformation matrix M when the four vertex coordinates of the minimum circumscribed rectangle of the ellipse (i.e. the dial pattern before correction) are projected and transformed to the four vertex coordinates of the circumscribed rectangle of the corresponding circle (i.e. the dial pattern after correction) in turn rt .
[0037] 5. The image of the pointer instrument to be recognized can be projected and transformed by using the projection transformation method (similar to the projection transformation of the panoramic image), and then the dial pattern is corrected to a regular circular dial. The specific calculation formula of the projection transformation is as follows:
[0038]
[0039] where (x o ,y o ) represents the dial pattern image before projection transformation; (x n ,y n ) represents the image after projection transformation; (x n ′,y n ′) represents the image coordinates after projection transformation without scaling; k n represents the scaling factor.
[0040] Returning to the flow, after completing the image correction step in step S206, the flow proceeds to step S208. In step S208, the corrected pointer instrument image is pre-processed, and then a binary image about the pointer instrument image can be obtained, wherein the binary image can be obtained by one and / or more of image filtering smoothing, histogram equalization, adaptive threshold binary, and morphological operation. Then, in step S210, the feature blocks in the binary image are screened and extracted, wherein the screening process can include area screening, barycenter distance screening, and number screening. It should be understood that the first feature block meeting the predetermined area can be screened as the second feature block by area screening, and then the first feature block with an area less than the first predetermined value can be removed. In an application scenario, most small image noise information can be removed by area screening, and then unnecessary calculation and comparison can be reduced in the subsequent pointer feature block screening operation. Further, the first feature block with an area greater than the second predetermined value can also be removed by area screening. For example, the interference information other than the pointer in the binary image can be removed by area screening, wherein the interference information can include large-area dark or bright feature blocks in the binary image due to light problems.
[0041] Specifically, the step of area screening can include calculating the area S i of each feature block in the binary image (i = 1, 2, …, K allAnd extract K features whose area is within the area threshold range. S The area threshold of a first feature block can be calculated as follows:
[0042] S th_min =t S_min P X P Y (5)
[0043] S th_max =t S_max P X P Y (6)
[0044] Among them, S th_min S represents the minimum value of the area threshold (i.e., the first predetermined value); th_max This represents the maximum value of the area threshold (i.e., the second predetermined value); P X P Y These represent the number of pixels in the horizontal and vertical directions of the binarized image, respectively; t S_min t S_max These represent the minimum and maximum values of the area threshold ratio, respectively, where t S_min and t S_max The value is selected based on the specific instrument image. In one application scenario, by comparing the feature block area value with an area threshold, most areas smaller than S can be removed. th_min Image noise feature blocks. Simultaneously, it can also remove noise feature blocks with an area larger than S. th_max Large areas of dark or bright features caused by lighting issues can be used to filter out K features that meet a predetermined area. S The first feature block is used as the second feature block.
[0045] Furthermore, the second feature block is filtered by centroid distance to select those that meet a predetermined distance as the third feature block. The centroid distance is the distance between the center of the dial in the pointer instrument image and the centroid of the second feature block. It's important to understand that the pointer in a pointer instrument rotates around the center of the dial. Therefore, the centroid of the pointer feature block is relatively close to the center, while the centroids of feature blocks in other parts of the instrument, such as the dial frame, and other noise feature blocks are much further away. Thus, centroid distance filtering can remove noise and interference feature blocks that were not removed in the area filtering step because their areas are similar to the pointer feature block.
[0046] Specifically, feature block extraction of the second feature block by utilizing the centroid distance conditional attribute can include calculating K, which is filtered by area. S The centroid (x) of the second feature block bi ,ybi (i = 1, 2, …, K S ), and the Euclidean distance D bi between the center of gravity (x bi , y c ) and the center of the dial (x c , y i ) of the dial in the pointer instrument image (the center coordinates are described above) is calculated. Further, by comparing the Euclidean distance D i with the distance threshold, the center of gravity distance screening operation of the K S second feature blocks can be realized, and then the K D third feature blocks satisfying the distance threshold can be obtained, wherein the specific calculation formula of the distance threshold is as follows:
[0047]
[0048] wherein t D is the distance threshold ratio, which is selected according to the specific instrument image characteristics, and generally does not exceed 1. In an application scenario, by comparing the Euclidean distance D S of the K i second feature blocks with the distance threshold, the feature blocks with a large Euclidean distance from the center of the dial in the pointer instrument image can be removed, such as the dial frame feature block in the pointer instrument image, other component feature blocks in the instrument, and other noise feature blocks, and then the K D third feature blocks satisfying the distance threshold can be screened out.
[0049] In addition, the third feature blocks can also be subjected to quantity screening to screen out third feature blocks satisfying a predetermined number as fourth feature blocks, wherein the fourth feature blocks are arranged in descending order of feature block area and are collected into pointer feature information. It should be understood that the main feature block with the largest area in the third feature block can be extracted through quantity screening, so as to obtain more accurate results for subsequent feature block refinement and angle calculation operations, and the feature block threshold can be set as the condition for quantity screening. Further, since different instruments have different pointer forms, the K D fourth feature blocks satisfying the feature block threshold can be extracted from the K res third feature blocks by flexibly setting the feature block threshold, wherein the specific formula for obtaining the K res fourth feature blocks is as follows:
[0050]
[0051] wherein K res represents the number of fourth feature blocks, i.e., the pointer feature information finally extracted and obtained; and K thRepresentative feature block threshold value. In some application scenarios, in response to the fact that the pointer entity of some instruments is consistent and complete in material, the feature block threshold value K th Generally, it can be set to 1; in response to the fact that the pointer entity of some instruments is different from the material near the center of the circle, K th It can be set to 2, so that the operation of the pointer entity and the material near the center of the circle can be processed independently.
[0052] Returning to the flow, after the above feature block extraction operation is completed, the flow proceeds to step S212. In step S212, the deflection angle of the pointer can be calculated according to the pointer feature information. In an embodiment, the deflection angle of the pointer can be calculated by performing a morphological thinning operation on the fourth feature block in the pointer feature information, and then the image skeleton of the fourth feature block can be obtained. Further, the deflection angle of the pointer can be calculated by performing straight line detection on the image skeleton using a conventional method, wherein the value of the deflection angle is recorded with the center of the dial of the pointer instrument as the starting point.
[0053] In one application scenario, the conventional method can be Hough transform straight line detection, and the deflection angle of the pointer can be calculated by performing straight line detection on the image skeleton of the fourth feature block (i.e. the image skeleton of the pointer) using Hough transform straight line detection. Then, in step S214, the reading result of the pointer instrument can be obtained according to the deflection angle of the pointer and the deflection angle of the scale of the pointer instrument. In an embodiment, the reading result of the pointer instrument can be obtained by comparing the deflection angle of the pointer with the deflection angle of the smallest scale and the deflection angle of the largest scale obtained in the pointer instrument, and the reading result of the pointer instrument can be calculated.
[0054] In summary, the present application discloses a method for reading a pointer instrument with stronger applicability and higher robustness, which can recognize both conventional pointer instrument images with good quality and pointer instrument images with poor quality with a lot of noise and interference information, thereby improving the accuracy and universality of pointer recognition. Specifically, the method for reading a pointer instrument can include instrument positioning operation, image preprocessing operation, pointer recognition operation and reading result obtaining operation. Further, the collected image can be binarized by using the instrument positioning operation and the image preprocessing operation, thereby reducing the data amount in the image and reducing data screening for subsequent pointer recognition operation. In addition, through the pointer recognition operation, a series of conditional screening operations can be performed on the feature blocks, thereby excluding noise feature blocks and interference feature blocks. At the same time, the pointer feature information (i.e. the fourth feature block) can be extracted from the binarized image, so as to realize the reading of the pointer value of the pointer instrument.
[0055] Figure 3 is a schematic diagram exemplarily showing a binarized pointer instrument image for instrument reading according to an embodiment of the present application. It can be understood that in the image preprocessing, by binarizing the image, the gray value of the points on the image can be made to be 0 or 255, i.e. the entire image presents a clear black and white effect. As shown in Figure 3 , the pointer instrument image of the present application is processed by image binarization, and an image with a clear black and white effect as shown in the figure can be obtained. Further, to ensure that the overall and local features of the image can be reflected by the binarized image, all pixels with a gray value greater than or equal to a threshold value can be determined as specific objects, and their gray values can be set to 255. As an example, the pointer, the dial scale and the dial frame can be determined as specific objects, and further the gray values of the image regions of the pointer, the dial scale and the dial frame in the pointer instrument image can be set to 255, i.e. the white regions shown in the figure. Conversely, the gray values of the remaining pixel regions excluded from the specific objects can be set to 0 to represent the background or the exceptional object region, i.e. the black regions shown in the figure.
[0056] Figure 4 is a schematic block diagram showing a device 400 for reading a pointer instrument according to an embodiment of the present application. The device 400 can include a reading device 401 according to an embodiment of the present application and its peripheral devices and external network, wherein the reading device 401 is used to acquire a binarized image of the pointer instrument, and by conditionally screening the binarized image, the pointer feature information in the pointer instrument is extracted. Further, the deflection angle of the pointer is calculated according to the pointer feature information, and the reading result of the pointer instrument is determined according to the deflection angle of the pointer and the deflection angle of the scale of the pointer instrument, to realize the method for reading a pointer instrument of the present application as described in Figures 1-3 .
[0057] As shown in Figure 4 , the reading device 401 can include a CPU 4011, which can be a general-purpose CPU, a special-purpose CPU or other information processing and program running execution unit. Further, the reading device 401 can also include a mass storage 4012 and a read-only memory ROM 4013, wherein the mass storage 4012 can be configured to store various types of data. In the present application, the relevant data includes the pointer feature information about the pointer instrument image, the deflection angle data of the pointer and the reading result of the pointer instrument or various formulas used by the present application, etc. In addition, the ROM 4013 can be configured to store the initialization of each functional module of the reading device 401, the driver program of the basic input / output of the system and the data required for booting the operating system.
[0058] Further, the device 400 for reading a pointer gauge further comprises other hardware platforms or components, such as a tensor processing unit (TPU) 4014, a graphics processing unit (GPU) 4015, a field programmable gate array (FPGA) 4016, and a machine learning unit (MLU) 4017 as shown. It can be appreciated that although a plurality of hardware platforms or components are shown in the device 400 for reading a pointer gauge, they are merely exemplary and not limiting, and a person skilled in the art can add or remove corresponding hardware according to actual needs.
[0059] The reading device 401 of the present application further comprises a communication interface 4018, so that it can be connected to a local area network / wireless local area network (LAN / WLAN) 405 through the communication interface 4018, and in turn can be connected to a local server 406 or to the Internet (“Internet”) 405 through the LAN / WLAN. Alternatively or additionally, the reading device 401 of the present application can also be directly connected to the Internet or a cellular network based on wireless communication technology through the communication interface 4018, such as based on third generation (“3G”), fourth generation (“4G”), or fifth generation (“5G”) wireless communication technology. In some application scenarios, the reading device 401 of the present application can also access a server 408 and possibly a database 409 of an external network as needed, in order to obtain various known template image data of, for example, the prepared pointer gauges of the present application, and can remotely store various data calculated via formulas.
[0060] The peripherals of the reading device 401 can include a display device 402, an input device 403, and a data transmission interface 404. In one embodiment, the display device 402 can include, for example, one or more speakers and / or one or more visual displays configured for voice prompting and / or image / video display of the operation process or final results of the test device of the present application. The input device 403 can include, for example, a keyboard, a mouse, a microphone, a gesture capture camera, or other input buttons or controls configured for receiving input of test data or user instructions. The data transmission interface 404 can include, for example, a serial interface, a parallel interface, or a universal serial bus interface (“USB”), a small computer system interface (“SCSI”), Serial ATA, FireWire, PCI Express, and High-Definition Multimedia Interface (“HDMI”), etc., configured for data transmission and interaction with other devices or systems. According to the scheme of the present application, the data transmission interface 404 can receive the panoramic image of the pointer instrument and the template image of the pointer instrument. The above-mentioned CPU 4011, mass storage 4012, read-only memory ROM 4013, TPU 4014, GPU 4015, FPGA 4016, MLU 4017, and communication interface 4018 of the reading device 401 of the present application can be connected to each other through a bus 4019, and data interaction with peripherals is achieved through the bus. In one embodiment, through the bus 4019, the CPU 4011 can control other hardware components and their peripherals in the reading device 401.
[0061] It should also be understood that any module, unit, component, server, computer, terminal or device of the present application example executing instructions can include or otherwise have access to computer- readable media, such as storage media, computer storage media, or data storage devices (removable and / or non-removable) such as, for example, magnetic disks, optical disks, or tape. Computer storage media can include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data.
[0062] The application further discloses a computer readable storage medium, wherein program instructions are stored in the computer readable storage medium, and the program instructions are suitable for being loaded and executed by a processor to acquire a binary image of a pointer instrument; perform conditional screening on the binary image to extract pointer feature information in the pointer instrument; calculate a deflection angle of the pointer according to the pointer feature information; and determine a reading result of the pointer instrument according to the deflection angle of the pointer and a deflection angle of a scale of the pointer instrument. When the scheme of the application is embodied in the form of a software product (a computer readable storage medium), the software product can be stored in a memory, and the software product can include a plurality of instructions to make a computer device (for example, a personal computer, a server or a network device, etc.) execute part or all steps of the method according to the embodiments of the application. The memory mentioned above can include, but is not limited to, a U disk, a flash disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk and various media capable of storing program codes.
[0063] It should be understood that the terms "first" or "second" and the like in the claims, specification and drawings of the present application are used to distinguish different objects, and are not used to describe a particular order. The terms "include" and "contain" used in the specification and claims of the present application indicate the presence of the described features, whole, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, whole, steps, operations, elements, components and / or sets thereof.
[0064] It should also be understood that the terms used in the present application disclosure are only for the purpose of describing specific embodiments, and are not intended to limit the present application. As used in the specification and claims of the present application, the singular forms "a", "an" and "the" are intended to include the plural forms, unless the context clearly indicates otherwise. It should be further understood that the term "and / or" used in the specification and claims of the present application means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0065] Although the embodiments of the present application are as described above, the above description is only for the purpose of facilitating understanding of the present application, and is not intended to limit the scope and application scenarios of the present application. Any person skilled in the art of the present application can make any modification and change in the form and details without departing from the spirit and scope of the present application, but the patent protection scope of the present application shall be subject to the scope defined in the appended claims.
Claims
1. A method for reading a pointer gauge, characterized by, The method comprises: obtaining a binary image of the pointer instrument; performing conditional screening on the binary image to extract pointer feature information in the pointer instrument; wherein the conditional screening on the binary image comprises: performing area screening on first feature blocks in the binary image to screen out first feature blocks satisfying a predetermined area as second feature blocks; The area filtering step includes calculating the area of each feature block in the binarized image. i=1,2,… And extract feature blocks whose area is within the area threshold range The first feature block, where the area threshold is calculated as follows: S th_min = t s_min P x P Y S th_max = t s-max P x P Y wherein, represents the minimum value of the area threshold; represents the maximum value of the area threshold; , are respectively the horizontal and vertical pixel numbers of the binary image; , are respectively the minimum and maximum values of the area threshold ratio, wherein and are selected according to specific instrument images. performing center of gravity distance screening on the second feature blocks to screen out second feature blocks satisfying a predetermined distance as third feature blocks, wherein the center of gravity distance is the distance between the center of the dial of the pointer instrument and the center of gravity of the second feature blocks; and wherein the feature block extraction on the second feature blocks by utilizing the barycenter distance condition attribute comprises calculating barycenters of the second feature blocks filtered via the area screening , ), i = 1, 2, …, , and calculating the Euclidean distances between the barycenters , and the center of the circular dial of the pointer-type meter image , ; performing quantity screening on the third feature blocks to screen out third feature blocks satisfying a predetermined quantity as fourth feature blocks, wherein the fourth feature blocks are arranged in descending order of feature block area and are combined into the pointer feature information; The method further comprises: By flexibly setting the feature block threshold value, the feature block threshold value is extracted from one third feature block one fourth feature block, wherein the specific formula of obtaining one fourth feature block is as follows: wherein represents the number of fourth feature blocks, i.e., the pointer feature information obtained by the final extraction, represents a feature block threshold value; calculating a deflection angle of the pointer according to the pointer feature information; and determining a reading result of the pointer instrument according to the deflection angle of the pointer and a deflection angle of the scale of the pointer instrument. Wherein obtaining the binary image of the pointer instrument comprises:
2. The method of claim 1, wherein, obtaining the pointer instrument image, and performing image correction on the pointer instrument image; and performing image preprocessing on the corrected pointer instrument image to obtain the binary image. Wherein obtaining the pointer instrument image comprises:
3. The method of claim 2, wherein, obtaining a template image of the pointer instrument and calculating image features of the template image; obtaining a panoramic image of the pointer instrument and calculating image features of the panoramic image; matching the image features of the template image with the image features of the panoramic image to obtain a projection matrix, wherein the projection matrix is used to project and transform the panoramic image into the template image; and projecting and transforming the panoramic image into the template image by using the projection matrix to obtain the pointer instrument image. Wherein performing image correction on the pointer instrument image comprises correcting an inclined and / or deformed reading dial in the pointer instrument image into a regular circular reading dial.
4. The method of claim 2, wherein, Wherein performing image preprocessing on the processed pointer instrument image comprises one or more of image filtering smoothing, histogram equalization, adaptive threshold binaryzation, and morphological operation.
5. The method of claim 2, wherein, Wherein calculating the deflection angle of the pointer according to the pointer feature information comprises:
6. The method of claim 1, wherein, performing morphological thinning operation on the fourth feature blocks in the pointer feature information to obtain an image skeleton of the fourth feature blocks; and performing straight line detection on the image skeleton by using a conventional method to calculate the deflection angle of the pointer, wherein the value of the deflection angle is recorded with the center of the dial of the pointer instrument as the starting point. Wherein determining the reading result of the pointer instrument according to the deflection angle of the pointer and the deflection angle of the scale of the pointer instrument comprises:
7. The method of claim 1, wherein, obtaining the deflection angle of the smallest scale in the pointer instrument; obtaining the deflection angle of the largest scale in the pointer instrument; and comparing the deflection angle of the pointer to the deflection angle of the minimum scale and the deflection angle of the maximum scale to calculate a reading result of the pointer instrument.
8. An apparatus for reading a pointer gauge, characterized by comprising: a processor; a memory storing program instructions for reading a pointer instrument, which when executed by the processor implement the method steps according to any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, a memory storing program instructions for reading a pointer instrument, which when executed by the processor implement the method steps according to any one of claims 1-7.
Citation Information
Patent Citations
Automatic identification method and system for pointer type instrument reading
CN112560839A