Instrument identification method and system, electronic device and readable storage medium
By acquiring the dial image and determining the area of interest, performing binarization processing and pointer direction recognition, the problem of low reading efficiency of instrument reading in the prior art is solved, and automated and speedy reading processing is realized.
Patent Information
- Application Number
- CN202011162874.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-27
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2040-10-27
AI Technical Summary
The prior art is inefficient when manually reading instrument readings, has large processing and calculations, and slow response speed, making it impossible to achieve automation and speed.
By acquiring the dial image and determining the area of interest, the area of interest is binarized and the pointer pixel points are identified to determine the pointer direction, and the dial scale value is determined according to the pointer direction to obtain the dial reading.
The processing algorithm is optimized, the calculation amount is reduced, the processing speed is improved, and the instrument readings are automated and speedy.
Smart Images

Figure CN112347877B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of instrument processing technology, and in particular to an instrument identification method and system, an electronic device and a readable storage medium. Background Art
[0002] The current manual reading of meter readings is inefficient, and people are pursuing automation and speed in reading meter readings. In addition, the traditional reading of meter readings requires the entire area of the dial to be included in the recognition process, which has a large amount of processing and calculation and a slow response speed. Summary of the invention
[0003] Embodiments of the present application provide an instrument identification method and system, an electronic device, and a readable storage medium.
[0004] The embodiment of the present application provides an instrument recognition method. The instrument recognition method comprises: acquiring a dial image and determining a focus area; binarizing the focus area and identifying pointer pixels to determine the pointer direction; and determining a dial scale value according to the pointer direction to obtain a dial reading.
[0005] In some embodiments, determining the area of interest includes: respectively acquiring coverage areas of the long end and the short end of the pointer of the instrument; and extracting the coverage area within the long end and outside the short end of the pointer as the area of interest.
[0006] In some embodiments, the region of interest is in the shape of a ring or a sector ring.
[0007] In some embodiments, binarizing the focus area and identifying pointer pixels to determine the pointer direction includes: respectively calculating the number of black pixels in the focus area in multiple directions; and determining the direction with the most black pixels as the pointer direction.
[0008] In certain embodiments, calculating the number of black pixels in the area of interest in multiple directions includes: taking a preset direction passing through the center of the dial as the calculation direction; calculating the number of black pixels in the area of interest from the outside of the area of interest along one end of the calculation direction to the center of the dial; rotating the calculation direction around the center of the dial multiple times by preset angles to obtain the number of black pixels in the area of interest corresponding to multiple calculation directions.
[0009] In some embodiments, determining the dial scale value according to the pointer direction to obtain the dial reading includes: determining the conversion relationship between the pointer direction and the scale according to the zero scale and the full-scale scale; and determining the corresponding dial reading according to the conversion relationship and the pointer direction.
[0010] The embodiment of the present application also provides an instrument recognition system. The instrument recognition system includes a camera, a lighting component and a processor, wherein the camera is arranged above the center of the dial of the instrument and is used to collect a dial image, wherein the dial image includes a focus area; the lighting component surrounds the camera and is used to emit light to the focus area; the processor is used to: obtain the dial image according to the camera and determine the focus area; perform binarization processing on the focus area and identify the pointer pixel points to determine the pointer direction; determine the dial scale value according to the pointer direction to obtain the dial reading.
[0011] In some embodiments, the lighting component includes a plurality of light sources, and the plurality of light sources are evenly arranged around the camera in a circumferential direction; or the lighting component includes an annular light source, and the camera is located at the center of the annular light source.
[0012] The embodiment of the present application further provides an electronic device. The electronic device includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the instrument identification method described in any of the above embodiments is implemented.
[0013] The embodiment of the present application also provides a non-volatile computer-readable storage medium of a computer program. When the computer program is executed by one or more processors, the instrument identification method described in any of the above embodiments is implemented.
[0014] The instrument recognition method and system, electronic device and readable storage medium of the present application determine the focus area by acquiring the dial image, and determine the pointer method according to the focus area to determine the dial reading, which can optimize the processing algorithm and achieve the effect of reducing the amount of calculation and improving the processing speed.
[0015] Additional aspects and advantages of the embodiments of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0017] Figure 1 is a flow chart of an instrument identification method according to certain embodiments of the present application;
[0018] Figure 2 is a schematic diagram of the structure of an instrument identification device in certain embodiments of the present application;
[0019] Figure 3 is a schematic diagram of the structure of an instrument identification system of certain embodiments of the present application;
[0020] Figure 4 is a schematic diagram of the structure of an instrument identification system of certain embodiments of the present application;
[0021] Figure 5 is a schematic diagram of a focus area of an instrument identification method according to certain embodiments of the present application;
[0022] Figure 6 is a schematic diagram of the structure of an electronic device according to some embodiments of the present application;
[0023] Figure 7 is a schematic diagram of the structure of a computer-readable storage medium of certain embodiments of the present application;
[0024] Figure 8 is a schematic diagram of the structure of an instrument identification system of certain embodiments of the present application;
[0025] Fig. 9 is a flow chart of an instrument identification method according to certain embodiments of the present application;
[0026] Fig.10 is a schematic diagram of the structure of an instrument identification device in certain embodiments of the present application;
[0027] Fig.11 is a flow chart of an instrument identification method according to certain embodiments of the present application;
[0028] Fig.12 It is a schematic diagram of the structure of an instrument identification device in certain embodiments of the present application. DETAILED DESCRIPTION
[0029] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions from beginning to end. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application, and cannot be understood as limiting the embodiments of the present application.
[0030] See also Figure 1 , the present application provides an instrument identification method. The method comprises:
[0031] S12: Acquire a dial image and determine a focus area;
[0032] S14: performing binarization processing on the focus area and identifying the pointer pixel points to determine the pointer direction;
[0033] S16: Determine the dial scale value according to the pointer direction to obtain the dial reading.
[0034] Please combine Figure 2The present application also provides an instrument identification device 10. The instrument identification device 10 includes an acquisition module 12, a processing module 14 and a determination module 16.
[0035] Step S12 can be implemented by the acquisition module 12, step S14 can be implemented by the processing module 14, and step S16 can be implemented by the determination module 16. That is, the acquisition module 12 is used to acquire the dial image and determine the focus area; the processing module 14 is used to perform binarization processing on the focus area and identify the pointer pixel points to determine the pointer direction; the determination module 16 is used to determine the dial scale value according to the pointer direction to obtain the dial reading.
[0036] Please combine Figure 3 and Figure 4 The present application also provides an instrument recognition system 20. The instrument recognition system 20 includes a camera 21, a lighting component 22, and a processor 23. The camera 21 is arranged above the center of the instrument dial to collect the dial image, and the dial image includes a focus area; the lighting component surrounds the camera 21, and the lighting component 22 is used to emit light to the focus area, and the processor 23 is used to: obtain the dial image according to the camera 21 and determine the focus area; perform binarization processing on the focus area and identify the pointer pixel points to determine the pointer direction; determine the dial scale value according to the pointer direction to obtain the dial reading.
[0037] In some embodiments, determining the focus area includes: respectively acquiring the coverage area of the long end and the short end of the pointer of the meter; and extracting the coverage area within the long end and outside the short end of the pointer as the focus area.
[0038] Specifically, see Figure 5 , the dial image refers to Figure 5 The image of the instrument panel showing pressure is shown, and the focus area 24 is the area between the inner ring and the outer ring in the dial image. Regarding the process of graphics processing, the present application starts with the structural characteristics of the pointer instrument. Generally, the pointer of the pointer instrument includes a long end and a short end. In the process of processing the dial image, the area of compression processing is extracted as the focus area only from the area outside the short end of the pointer and inside the long end of the pointer. That is, the focus area 24 is the area represented by the shadow between the inner ring and the outer ring in the dial image (such as Figure 5 shown).
[0039] Image binarization means setting the grayscale value of the pixels on the image to 0 or 255, that is, making the entire image appear to be only black and white. Binarization of the area of interest can produce a more obvious black-and-white contrast in the processed dial image, making it easier to identify the number of black pixels corresponding to the pointer and more accurately determine the pointer direction.
[0040] Compared with the traditional solution without extracting the region of interest, the region of interest extracted in this application can greatly compress the image area required to process the obtained dial image, which will reduce the amount of calculation accordingly, thereby improving the speed of the entire recognition. Take a 20*20 (mm) instrument dial image as an example, assuming that the long end of the pointer is 7.5 mm long and the short end is 2.5 mm long, then the area of interest S2 inside the long end of the pointer and outside the short end of the pointer is 3.14*(7.5 2 -2.5 2 )=157mm 2 , the total area S1 of the instrument panel image is 400mm 2 In terms of, (S1-S2) / S1=(400-157) / 400=60.75%, that is, the amount of computation required to process the dial image is reduced by 60.75%.
[0041] See also Figure 6 The present application also provides an electronic device 30. The electronic device 30 includes a processor 31 and a memory 32. The memory 32 stores a computer program 33. When the computer program is executed by the processor 31, it realizes: obtaining a dial image and determining a focus area; binarizing the focus area and identifying the pointer pixel points to determine the pointer direction; determining the dial scale value according to the pointer direction to obtain the dial reading. The electronic device 30 can be a device with a dashboard, such as an electronic scale, a mechanical watch, a car, a water pressure gauge, an ammeter, etc., which are not listed here one by one.
[0042] See also Figure 7 The present application also provides a non-volatile computer-readable storage medium 40 for a computer program, on which a computer program 41 is stored.
[0043] When the program is executed by one or more processors 42 , the steps of the instrument identification method in any one of the above-mentioned embodiments are implemented.
[0044] For example, when the program is executed by the processor 42, the following steps of the instrument identification method are implemented:
[0045] S12: Acquire a dial image and determine a focus area;
[0046] S14: performing binarization processing on the concerned area and identifying the pointer pixel points to determine the pointer direction;
[0047] S16: Determine the dial scale value according to the pointer direction to obtain the dial reading.
[0048] The computer-readable storage medium 40 may be disposed in a processor 42 or a data source reader. In this case, the processor 42 or the data source reader may communicate with a cloud server to obtain a corresponding computer program 41 .
[0049] It can be understood that the computer program 41 includes computer program code. The computer program code can be in source code form, object code form, executable file or some intermediate form, etc. Computer readable storage media can include: any entity or device capable of carrying computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution medium, etc.
[0050] The instrument recognition method and system, electronic device and readable storage medium of the present application determine the focus area by acquiring the dial image, and determine the pointer method according to the focus area to determine the dial reading, which can optimize the processing algorithm and achieve the effect of reducing the amount of calculation and improving the processing speed.
[0051] See also Figure 3 and Figure 5 In some embodiments, the camera 21 of the instrument recognition system 20 may be opposite to the fixed center of the pointer, and the size of the camera 21 may be similar to the fixed center of the pointer (eg Figure 5 The O area shown is equal to or larger than the fixed center of the pointer. In addition, the camera 21 can be specifically arranged on the inner surface of the shell above the instrument panel, and the height of the camera 21 from the dial is less than or equal to the height from the inner surface of the shell to the dial. When the height of the camera 21 from the dial is less than the height from the inner surface of the shell to the dial, the camera 21 can be directly installed on the inner surface of the shell, which is simple to install and convenient to disassemble the camera. In addition, at this time, the field of view of the camera 21 can be adjusted to a reasonable value so that the camera 21 can normally collect the dial image with the pointer and the complete picture of the scale. In this way, the function of collecting the dial image can be realized without changing the structure of the shell. When the height of the camera 21 from the dial is equal to the height from the inner surface of the shell to the dial, a position can be set at the center of the shell to facilitate the embedding of the camera 21 into the shell, which is conducive to the installation and fixation of the camera 21. The camera 21 can also be hidden inside the instrument panel, and the shooting surface of the camera 21 is flush with the inner surface of the shell. The space between the dial of the instrument panel and the shell is the same as the previous instrument panel, which is conducive to the overall beauty of the instrument panel.
[0052] The lighting component 22 is used to provide fill light when the camera 21 acquires the dial image. The lighting component 22 can be an LED lamp or other lamps, which are not listed here.
[0053] Understandably, the dial needs to be fully illuminated during the instrument recognition process, but the light emitted by the lighting component is reflected by the dial to generate reflected light, which makes the obtained dial image easy to produce light spots, making the dial image blurred, affecting the accuracy of the subsequent determination of the focus area. Therefore, in the process of obtaining the dial image, it is necessary to ensure sufficient lighting and no shadow on the pointer, and avoid or reduce the damage of the light spots to the original image of the dial.
[0054] In one embodiment, the lighting component 22 includes a plurality of light sources, and the plurality of light sources are evenly arranged around the camera 21 in a circumferential direction. The plurality of light sources are arranged around the camera 21, which, on the one hand, ensures sufficient lighting and can play a similar effect as a shadowless lamp to avoid the appearance of pointer shadows; on the other hand, according to the law of reflection, a light spot will appear between the camera and the plurality of LED light sources, which can effectively reduce the influence of the light spot on the area of interest.
[0055] Specifically, see Figure 4 In one example, a structured design scheme for lighting is: four LED light sources are evenly and closely arranged around the camera 21. On the one hand, sufficient lighting is ensured, which can have an effect similar to a shadowless lamp and avoid the appearance of pointer shadows; on the other hand, according to the law of reflection, the light spot will appear between the camera and the four LED light sources, which can effectively reduce the impact of the light spot on the area of interest.
[0056] In another embodiment, see Figure 8 , the lighting component 22 includes a ring light source 221, and the camera 21 is located at the center of the ring light source 221. The lighting design scheme is to use the ring light source 221 to be arranged around the camera 21, which, on the one hand, ensures sufficient lighting and can play a similar effect as a shadowless lamp to avoid the appearance of the pointer shadow; on the other hand, according to the law of reflection, the light spot will appear between the camera and the LED light source, which can effectively reduce the influence of the light spot on the focus area.
[0057] In summary, the instrument recognition method, device 10 and system 20 of the present application use a technical means to illuminate a specific area of the dial through a fixed light source, compress and extract the area of interest, and only process the area of interest, so as to achieve the technical effect of a clear dial, no shadow on the pointer, a fixed area affected by the light spot, reduced calculation amount in the pointer recognition process, and improved recognition speed, thereby solving the technical problems of light spot interference recognition, large calculation amount of pointer instrument recognition, and slow recognition speed.
[0058] In some embodiments, the region of interest is annular or fan-shaped. It is understandable that due to the different positions of the scale marks in different instruments, for example, the pressure gauge of an electronic scale (such as Figure 5As shown in the figure, the oil gauge, tachometer and speedometer on the car are all in the shape of a sector, not a circle, so the focus area obtained by the instrument recognition device 10 is a sector ring corresponding to the sector. For another example, the scale mark position of the mechanical watch worn by people is in the shape of a circle, so the focus area obtained by the instrument recognition device 10 is a ring corresponding to the circle.
[0059] See also Fig. 9 In some embodiments, step S14 includes:
[0060] S142: Calculate the number of black pixels in the focus area in multiple directions respectively;
[0061] S144: Determine the direction with the most black pixels as the pointer direction.
[0062] Please combine Fig.10 The processing module 14 of the instrument recognition device 10 includes a calculation unit 142 and a direction determination unit 144 .
[0063] Step 142 can be implemented by the calculation unit 142, and step 144 can be implemented by the direction determination unit 144. That is, the calculation unit 142 is used to calculate the number of black pixels in the focus area in multiple directions. The direction determination unit 144 is used to determine the direction with the most black pixels as the pointer direction.
[0064] In some embodiments, the processor 23 of the instrument recognition system 20 is used to: respectively calculate the number of black pixels in the focus area in multiple directions; and determine the direction with the most black pixels as the pointer direction.
[0065] Specifically, when the scales on the dial form a sector-shaped area around the center of the dial, the focus area is correspondingly fan-shaped. At this time, calculating the number of black pixels in the focus area in multiple directions refers to calculating the number of black pixels in the focus area in each direction of the sector-shaped area formed by the scales on the dial around the center of the dial, and then determining the direction with the most black pixels as the pointer direction.
[0066] When the scales on the dial form a circular area around the center of the dial, the corresponding focus area is annular. At this time, calculating the number of black pixels in the focus area in multiple directions refers to calculating the number of black pixels in the focus area in each direction (360°) of the annular area formed by the scales on the dial around the center of the dial, and then determining the direction with the most black pixels as the pointer direction.
[0067] In some embodiments, calculating the number of black pixels in the area of interest in multiple directions includes: taking a preset direction passing through the center of the dial as the calculation direction; calculating the number of black pixels in the area of interest; rotating the calculation direction around the center of the dial by preset angles multiple times to obtain the number of black pixels in the area of interest corresponding to multiple calculation directions.
[0068] Specifically, see Figure 5 , taking the pressure gauge on the electronic scale as an example, and when the scale on the dial in the acquired dial image is fan-shaped, the preset direction passing through the center of the dial may refer to various directions spreading from the center of the dial to the edge of the fan-shaped direction. In particular, the preset direction may be a horizontal direction (such as the horizontal direction of the A side) starting from the center of the dial and passing through the center of the dial. Figure 5 The dashed arrow direction shown in the figure) can also be the horizontal direction of the B side passing through the center of the dial (such as Figure 5 The preset direction is used as the calculation direction to calculate the number of black pixels in the focus area in the calculation direction. That is, first calculate the number of black pixels in the focus area in a preset direction from the center of the dial toward the edge of the sector in the sector area. For example, the horizontal direction of the B side passing through the center of the dial is used as the preset direction. Then, the number of black pixels in the focus area in the horizontal direction of the B side from the center of the dial toward the edge of the sector is first calculated. Then, the calculation direction B is rotated around the center of the dial multiple times by a preset angle. The preset angle can be any angle less than or equal to 1°, for example, 0.1°, 0.2°, 0.3°, 0.4°, 0.5°, 0.6°, 0.7°, 0.8°, 0.9°, 1°, etc.
[0069] Taking the preset angle of 1° as an example, the calculation direction is rotated from the horizontal direction on the right side of the center of the dial at a preset angle of 1°, and the number of black pixels in the focus area corresponding to the multiple calculation directions after rotation is calculated respectively, where the multiple calculation directions can specifically be 360 calculation directions around the entire instrument, and the number of calculation directions can also be the total number of dial scales corresponding to the fan-shaped area, that is, after the rotation is completed, the calculation direction returns to the initial direction (that is, the horizontal direction on the right side passing through the center of the dial). Therefore, the number of black pixels in the focus area in the entire fan-shaped area can be counted, so that the direction with the most black pixels can be accurately determined as the pointer direction.
[0070] See also Fig.11 In some embodiments, step S16 includes:
[0071] S162: Determine the conversion relationship between the pointer direction and the scale according to the zero scale and the full scale;
[0072] S164: Determine the corresponding dial reading according to the conversion relationship and the pointer direction.
[0073] See also Fig.12 In some embodiments, the determination module 16 in the instrument identification device 10 includes: a first determination unit 162 and a second determination unit 164 .
[0074] Step S162 can be implemented by the first determination unit, and step S164 can be implemented by the second determination unit. That is, the first determination unit 162 is used to determine the conversion relationship between the pointer direction and the scale according to the zero scale and the full scale; the second determination unit 164 is used to determine the corresponding dial reading according to the conversion relationship and the pointer direction.
[0075] In some embodiments, the processor 23 in the meter identification system 20 is used to: determine the conversion relationship between the pointer direction and the scale according to the zero scale and the full scale; and determine the corresponding dial reading according to the conversion relationship and the pointer direction.
[0076] It is understandable that before acquiring the dial image, the instrument is generally calibrated or initialized to clarify the positions of the zero scale and the full-scale scale relative to the center of the dial, thereby determining the conversion relationship between the pointer direction and the scale.
[0077] The conversion relationship refers to determining the dial reading corresponding to the pointer direction based on the zero scale position and the full scale position and the angle of the pointer direction relative to the zero scale position.
[0078] For example, please combine Figure 5 , assuming that the zero scale is located in the horizontal direction of the B side of the center of the dial, and the full-scale scale is located in the horizontal direction of the A side of the center of the dial, then when the pointer direction is rotated 20 degrees relative to the initial calculation direction (if the horizontal direction of the B side of the center of the dial is the initial calculation direction), the angle of the pointer direction relative to the zero scale position is 20°. The corresponding relationship between the scale values corresponding to each angle is fixed. Taking the tachometer of a car as an example, when the angle of the pointer direction relative to the zero scale position is 20°, the corresponding scale value can be 20km / h. Therefore, the corresponding dial degree can be determined based on the conversion relationship between the rotation angle of the pointer and the scale on each instrument panel and the pointer direction. Other situations are similar to the readings in this embodiment, and are not described here one by one.
Claims
1. A method for identifying an instrument, characterized in that: include: Get an image of the dial and identify the area of interest; Binarizing the focus area and identifying the pointer pixel points to determine the pointer direction; Determine the dial scale value according to the pointer direction to obtain the dial reading; Determining the area of interest includes: respectively obtaining the coverage areas of the long end and the short end of the pointer of the instrument; The coverage area within the long end and outside the short end of the pointer is extracted as the focus area.
2. The instrument identification method according to claim 1, characterized in that: The region of interest is in the shape of a ring or a fan ring.
3. The instrument recognition method according to claim 1, wherein the binarization of the focus area and identifying the pointer pixel points to determine the pointer direction comprises: Calculate the number of black pixels in the region of interest in multiple directions respectively; The direction with the most black pixels is determined as the pointer direction.
4. The instrument identification method according to claim 3, characterized in that: The calculating the number of black pixels in the focus area in multiple directions respectively includes: The preset direction passing through the center of the dial is used as the calculation direction; Calculating the number of black pixels in the focus area in the calculation direction; The calculation direction is rotated around the center of the dial for multiple times by a preset angle to respectively obtain the number of black pixels in the focus area corresponding to multiple calculation directions.
5. The instrument identification method according to claim 1, characterized in that: Determining the dial scale value according to the pointer direction to obtain the dial reading includes: Determine the conversion relationship between the pointer direction and the scale based on the zero scale and the full scale; The corresponding dial reading is determined according to the conversion relationship and the pointer direction.
6. An instrument identification system, characterized in that: The instrument recognition system includes a camera, a lighting component and a processor. The camera is arranged above the center of the dial of the instrument and is used to collect a dial image, and the dial image includes a focus area. The lighting component surrounds the camera and is used to emit light to the focus area. The processor is used to: Acquire a dial image according to the camera and determine the focus area; Binarizing the focus area and identifying the pointer pixel points to determine the pointer direction; Determine the dial scale value according to the pointer direction to obtain the dial reading; Determining the area of interest includes: respectively obtaining the coverage areas of the long end and the short end of the pointer of the instrument; The coverage area within the long end and outside the short end of the pointer is extracted as the focus area.
7. The instrument identification system according to claim 6, characterized in that: The lighting component comprises a plurality of light sources, and the plurality of light sources are evenly arranged around the camera in a circumferential direction; or The lighting component comprises an annular light source, and the camera is located at the center of the annular light source.
8. An electronic device, characterized in that: It includes a processor and a memory, the memory stores a computer program, and when the computer program is executed by the processor, the instrument identification method described in any one of 1-5 is implemented.
9. A non-volatile computer-readable storage medium for a computer program, characterized in that: When the computer program is executed by one or more processors, the instrument identification method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Detecting algorithm for identifying meter needle
CN103714329A
Pointer-type meter reading identification method and device
CN104298994A