Instrument pointer identification method and device, equipment and storage medium
By converting the instrument image from RGB to HSV color space and hiding non-target pointers, the position of the target pointer is determined by using virtual pointer scanning, which solves the problem of recognition accuracy of multi-pointer instruments in complex backgrounds and poor lighting conditions, and achieves higher recognition accuracy.
Patent Information
- Application Number
- CN202511174743.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-11-18
AI Technical Summary
In multi-pointer instruments, especially in complex backgrounds and poor lighting conditions, existing technologies struggle to accurately identify pointer positions, resulting in low identification accuracy and mutual interference between pointers.
The instrument's acquired image is converted from the RGB color space to the HSV color space, non-target pointer color pixels are converted to instrument background color pixels, and the target pointer position is determined by virtual pointer scanning.
It improves the pointer recognition accuracy of multi-pointer instruments in complex backgrounds and poor lighting conditions, prevents non-target pointers from interfering with the recognition of target pointers, and improves the recognition accuracy.
Smart Images

Figure CN120976929A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus, device and storage medium for recognizing instrument pointers. Background Technology
[0002] In modern industry, multi-pointer instruments are often used to monitor industrial equipment, such as magnetic-assisted voltmeters, which are three-pointer instruments. To achieve automated data acquisition from multi-pointer instruments, image processing is often used to identify the pointer positions.
[0003] Currently, the general method for identifying the pointer position in a multi-pointer instrument is to first acquire an RGB image of the multi-pointer instrument, and then directly perform image recognition on the RGB image in the RGB color space to determine the pointer position.
[0004] However, in complex backgrounds and / or under poor lighting conditions (poor lighting, shadows, reflections, etc.), the accuracy of pointer position recognition is low. Furthermore, the recognition results of each pointer in a multi-pointer instrument can affect each other, which can also lead to low pointer position recognition accuracy. Summary of the Invention
[0005] To improve the recognition accuracy of pointers in multi-pointer instruments, this application provides a method, apparatus, device, and storage medium for instrument pointer recognition.
[0006] In a first aspect, this application provides a method for identifying instrument pointers, including:
[0007] The color space of the images acquired by the instrument is converted to obtain the initial HSV image;
[0008] The non-target pointer color pixels in the initial HSV image are converted into instrument background color pixels to obtain the target HSV image;
[0009] The target HSV image is scanned using a virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle.
[0010] The target pointer position is determined based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle.
[0011] Secondly, this application provides an instrument pointer recognition device, comprising:
[0012] The color space conversion module is used to convert the color space of the images acquired by the instrument to obtain the initial HSV image;
[0013] The background pixel conversion module is used to convert non-target pointer color pixels in the initial HSV image into instrument background color pixels to obtain the target HSV image;
[0014] The pixel total value calculation module is used to scan the target HSV image based on a virtual pointer to obtain the current pixel total value of the image corresponding to each scanning angle.
[0015] The pointer position determination module is used to determine the target pointer position based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle.
[0016] Thirdly, this application provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method.
[0017] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described method.
[0018] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.
[0019] The aforementioned instrument pointer recognition method, apparatus, device, and storage medium obtain an initial HSV image by performing color space conversion on the instrument's acquired image; converting non-target pointer color pixels in the initial HSV image to instrument background color pixels to obtain a target HSV image; scanning the target HSV image based on a virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle; and determining the target pointer position based on the current total pixel value of the image corresponding to each scanning angle and the original total pixel value of the image. Through the above implementation, by converting the instrument's acquired image from the RGB color space to the HSV color space through color space conversion, the problem of drastic changes in RGB channel data caused by multi-pointer instruments in complex backgrounds and / or poor lighting conditions can be effectively solved, thereby improving the pointer recognition accuracy. Furthermore, when recognizing a target pointer in a multi-pointer instrument, by converting non-target pointer color pixels in the initial HSV image to instrument background color pixels, the non-target pointer can be hidden in the instrument background, thereby preventing the non-target pointer from adversely affecting the recognition of the target pointer, thus also improving the pointer recognition accuracy in multi-pointer instruments.
[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of an instrument pointer recognition method provided in the embodiments of this application;
[0023] Figure 2 This is a schematic diagram of an instrument acquiring images provided in an embodiment of this application;
[0024] Figure 3 This is a schematic diagram of an initial HSV image provided in an embodiment of this application;
[0025] Figure 4 This is a schematic diagram illustrating a method for displaying a virtual pointer, as provided in an embodiment of this application.
[0026] Figure 5 This is a schematic diagram of the structure of an instrument pointer recognition device provided in the embodiments of this application;
[0027] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application;
[0028] Figure 7 This is an internal structural diagram of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this disclosure.
[0030] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings herein are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0031] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0032] Example 1
[0033] Figure 1 A flowchart of an instrument pointer recognition method provided in Embodiment 1 of this application is shown below. Figure 1 The method can be executed by a device that performs the method, which can be implemented in software and / or hardware, and the method includes:
[0034] S110. Perform color space conversion on the image acquired by the instrument to obtain the initial HSV image.
[0035] In modern industrial settings, instruments are often installed on industrial equipment to monitor its parameters. These instruments can be single-pointer or multi-pointer instruments; this embodiment uses a multi-pointer instrument as an example, specifically a three-pointer instrument. In this embodiment, the three-pointer instrument can be a magnetic-assisted voltmeter with three colored pointers: black, green, and red. Figure 2 As shown; in other embodiments, the specifics are not limited. By acquiring images of the three-pointer instrument in the field, the corresponding instrument image can be obtained, and this instrument image is recorded as the instrument acquisition image.
[0036] It should be noted that the image captured by the instrument is in the RGB color space, that is, an RGB format image. The image captured by the instrument has three channels: R (Red) channel, G (Green) channel, and B (Blue) channel. The value of each channel represents the intensity of the primary color. The value range is usually 0-255 (8-bit color depth), where 0 means that the primary color does not emit light at all, and 255 means that the primary color is the brightest. If image recognition is performed directly on the images acquired by the instrument, this image processing method has certain limitations in color processing because it is performed directly in the RGB color space. For example, in complex backgrounds and situations with large changes in lighting, interference information can easily appear, thus affecting the accuracy of pointer recognition. To solve this problem, this embodiment adopts a color space conversion method for the instrument acquired images, converting the instrument acquired images from the RGB color space to the HSV color space, and the new image generated after conversion to the HSV color space is recorded as the initial HSV image. The initial HSV image also has three channels, namely the H (Hue) channel, the S (Saturation) channel, and the V (Value) channel. Among them, the H channel refers to the essential attributes of the color, such as red, green, blue, yellow, etc.; the S channel refers to the vividness of the color, that is, the proportion of gray components in the color; and the V channel refers to the brightness of the color, that is, the lightness of the color.
[0037] By first normalizing the RGB values of an RGB image to the range of 0-1, and then calculating the maximum and minimum channel values and their differences, hue, saturation, and brightness are derived. This allows the RGB image to be converted into its corresponding HSV image through color space conversion. In this embodiment, the conversion of the RGB image into its corresponding HSV image, i.e., the conversion of the instrument-acquired image into a color space such as... Figure 3 The initial HSV image shown can effectively solve the problem of drastic changes in RGB channel data caused by multi-pointer instruments in complex backgrounds and / or poor lighting conditions, thereby improving the recognition accuracy of the pointer.
[0038] S120. Convert the non-target pointer color pixels in the initial HSV image into instrument background color pixels to obtain the target HSV image.
[0039] Among them, such as Figure 3As shown, the initial HSV image includes three pointers. When identifying the position of one of the pointers (denoted as the target pointer), the other two pointers, due to their similar position and color to the target pointer, will have a very negative impact on the identification of the target pointer, resulting in low identification accuracy. To solve this problem, this embodiment converts the non-target pointer color pixels in the initial HSV image into instrument background color pixels, thereby hiding the two pointers other than the target pointer in the instrument background. Taking a black pointer as the target pointer as an example, the target pointer color of the target pointer is black, and the pixel corresponding to the black pointer in the initial HSV image is the target pointer color pixel. The pixels corresponding to the other two pointer colors, namely the green pointer and the red pointer, are also target pointer color pixels in the initial HSV image. It should be noted that the instrument shown in the initial HSV image has its own instrument background color, which is white. The pixels corresponding to the area occupied by the instrument background color in the initial HSV image are also instrument background color pixels. In order to hide the other two color pointers in the initial HSV image, the non-target pointer color pixels of the other two color pointers in the initial HSV image can be converted to instrument background color pixels respectively. The new HSV image obtained after converting the non-target pointer color pixels in the initial HSV image to instrument background color pixels is denoted as the target HSV image.
[0040] Specifically, in the initial HSV image, all green pixels corresponding to the green pointer are converted to white pixels, and all red pixels corresponding to the red pointer are converted to white pixels. Thus, when the black pointer is used as the target color pointer, the green and red pointers are hidden in the instrument background.
[0041] It should be noted that when the green pointer and the red pointer are used as the target pointers, the method of converting the non-target pointer color pixels in the initial HSV image to the instrument background color pixels is the same as above, and will not be repeated here.
[0042] It should also be noted that by converting the non-target pointer color pixels in the initial HSV image to the instrument background color pixels, the non-target pointer can be hidden in the instrument background, thereby preventing the non-target pointer from adversely affecting the recognition of the target pointer, and thus improving the recognition accuracy of pointers in multi-pointer instruments.
[0043] S130. Scan the target HSV image based on the virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle.
[0044] In this embodiment, to identify the location of the target pointer from the edge, a virtual pointer with the same rotation point as the target pointer is generated on the target HSV image. For example, the virtual pointer is as follows: Figure 4The white virtual pointer shown is currently positioned on the target pointer. The virtual pointer performs a circular scan of the target HSV image with the rotation point as the center, i.e., the scan angle is 360 degrees. In this embodiment, this 360 degrees is evenly divided into 360 scan angles, with the angle range between any two adjacent scan angles being 1 degree. The virtual pointer scans an angle range of 1 degree each time, meaning that after each scan, the virtual pointer points to a scan angle. Taking one scan angle as an example, when the target pointer is currently pointing to the scale of the instrument closest to that scan angle, if the virtual pointer also points to that scan angle, then the pixels corresponding to the virtual pointer and the pixels corresponding to the target pointer have a strong color contrast. Specifically, there is a significant difference between the total pixel value of the pixels in the area occupied by the virtual pointer and the total pixel value of the pixels in that area without the virtual pointer. Therefore, by determining this difference for each scan angle, and then determining the maximum difference, the scan angle pointed to by the virtual pointer corresponding to this maximum difference is the current position of the target pointer.
[0045] To facilitate determining the target pointer's position, each time the virtual pointer points to a scanning angle, the sum of the pixel values of all pixels in the target HSV image with the virtual pointer is calculated, and this sum is recorded as the current total pixel value of the image. This current total pixel value is then subtracted from the sum of the pixel values of all pixels in the target HSV image without the virtual pointer to determine the difference between the sum of the pixel values of the pixels in the area occupied by the virtual pointer corresponding to that scanning angle and the sum of the pixel values of the pixels in that area without the virtual pointer.
[0046] S140. Determine the target pointer position based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle.
[0047] In this process, the sum of the pixel values of all pixels in the target HSV image without the virtual pointer is recorded as the original pixel total value of the image. Taking a scanning angle that the virtual pointer is pointing to as an example, first calculate the current pixel total value of the image corresponding to the scanning angle, and then calculate the difference between the current pixel total value of the image and the original pixel total value of the image. Through the above steps, the corresponding difference can be calculated. The scanning angle corresponding to the largest difference is the angle corresponding to the nearest instrument scale, which is also the target pointer position.
[0048] It should be noted that this embodiment obtains an initial HSV image by performing color space conversion on the instrument's acquired image; converts the non-target pointer color pixels in the initial HSV image to instrument background color pixels to obtain a target HSV image; scans the target HSV image based on a virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle; and determines the target pointer position based on the current total pixel value of the image corresponding to each scanning angle and the original total pixel value of the image. Through the above implementation, by converting the instrument's acquired image in RGB color space to HSV color space through color space conversion, the problem of drastic changes in RGB channel data caused by multi-pointer instruments in complex backgrounds and / or poor lighting conditions can be effectively solved, thereby improving the pointer recognition accuracy. Furthermore, when recognizing a target pointer in a multi-pointer instrument, by converting the non-target pointer color pixels in the initial HSV image to instrument background color pixels, the non-target pointer pointer can be hidden in the instrument background, thereby preventing the non-target pointer pointer from adversely affecting the recognition of the target pointer, thus also improving the pointer recognition accuracy in multi-pointer instruments.
[0049] Example 2
[0050] This application provides a method for recognizing instrument pointers, which optimizes the "color space conversion of the instrument-acquired image to obtain an initial HSV image" step in embodiment one. It should be noted that for parts not detailed in this embodiment, please refer to the descriptions in other embodiments. The method includes:
[0051] S211. Mark the scale values of each scale on the instrument's acquired image to obtain the instrument's target image.
[0052] Among them, such as Figure 2 As shown, only some scale values are marked on the instrument's acquired image, such as 0, 0.4, 0.8, 1.2, and 1.6. In this case, it is more suitable to manually read the scale values pointed to by the pointers on multi-pointer instruments. However, it is difficult to automatically identify the scale values of the unmarked scales pointed to by the pointers through image recognition. In order to further identify the scale values pointed to by the target pointer after determining the target pointer position, this embodiment, based on the acquired instrument image, further marks the scale values of the originally unmarked scales on the acquired instrument image, and records the new image obtained after marking the scale values corresponding to each scale as the instrument target image.
[0053] S212. Perform color space conversion on the instrument target image to obtain an initial HSV image.
[0054] In this embodiment, both the instrument target image and the instrument acquisition image are images in the RGB color space. In order to effectively solve the problem of drastic changes in RGB channel data caused by multi-pointer instruments in complex backgrounds and / or poor lighting conditions, and thus improve the recognition accuracy of the pointers, this embodiment needs to convert the instrument target image from the RGB color space to the HSV color space, thereby realizing the color space conversion of the instrument target image, and the image in the HSV color space obtained by color space conversion of the instrument target image is recorded as the initial HSV image.
[0055] S220. Convert the non-target pointer color pixels in the initial HSV image into instrument background color pixels to obtain the target HSV image.
[0056] S230. Scan the target HSV image based on the virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle.
[0057] S240. Determine the target pointer position based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle.
[0058] Example 3
[0059] This application provides a method for identifying an instrument pointer in Embodiment 3. This method optimizes the "scanning the target HSV image based on a virtual pointer to obtain the total current pixel value of the image corresponding to each scanning angle" in Embodiment 1. It should be noted that for parts not described in detail in this embodiment, please refer to the descriptions in other embodiments. The method includes:
[0060] S310. Perform color space conversion on the image acquired by the instrument to obtain the initial HSV image.
[0061] S320. Convert the non-target pointer color pixels in the initial HSV image into instrument background color pixels to obtain the target HSV image.
[0062] S331. A virtual pointer is generated on the target HSV image based on virtual pointer setting parameters, wherein the virtual pointer setting parameters include pointer length, pointer width, and pointer rotation origin.
[0063] In this embodiment, the virtual pointer setting parameters need to be preset to generate the virtual pointer. In this embodiment, the virtual pointer setting parameters include pointer length, pointer width, and pointer rotation origin. In other embodiments, the specific parameters are not limited. For example, the pointer length is 20 pixels, the pointer width is 2 pixels, and the pointer rotation origin is the position of the instrument pointer rotation point. By setting the virtual pointer setting parameters, a virtual pointer can be generated on the target HSV image. The virtual pointer is used to perform a circular scan on the target HSV image with the pointer rotation origin as the center of rotation.
[0064] S332. Divide the target HSV image into a preset number of scanning angles evenly, and control the virtual pointer to rotate to each of the scanning angles in sequence.
[0065] In order to facilitate the control of the virtual pointer scanning process, in this embodiment, the target HSV image is evenly divided into a preset number of scanning angles with the pointer rotation origin as the rotation center. For example, the preset number is 360, and the scanning angles include: 0°, 1°, 2°...359°, for a total of 360 scanning angles. The virtual pointer starts from 0° and performs a circular scan, scanning 1 degree each time, thereby rotating to each scanning angle in sequence. The scanning angles passed through are: 0°→1°→2°→...→359°→0°.
[0066] S333. Calculate the set of HSV image pixel values corresponding to each of the scanning angles.
[0067] Taking one scanning angle as an example, such as Figure 4 When the virtual pointer scans to the specified scanning angle, the area occupied by the virtual pointer on the target HSV image comprises 20*2=40 pixels. The original pixel values of each pixel within this area change to pixel values consistent with the color (white) of the virtual pointer, such as (0°, 0, 1), where the brightness is 1, reaching its maximum. At this time, the pixel values of each pixel on the target HSV image are counted to obtain the set of HSV image pixel values corresponding to this scanning angle. The set of HSV image pixel values corresponding to each scanning angle can be obtained through the above method.
[0068] S334. Calculate the sum of the pixel values of each HSV image in each set of HSV image pixel values to obtain the total pixel value of the current image corresponding to each scanning angle.
[0069] Taking the set of HSV image pixel values corresponding to a scanning angle as an example, and recording each pixel value in the set of HSV image pixel values as an HSV image pixel value, determining the brightness in each HSV image pixel value, and then calculating the sum of the brightness in each HSV image pixel value in the set of HSV image pixel values, and recording this sum as the current total pixel value of the image corresponding to the scanning angle; the current total pixel value of the image corresponding to each scanning angle can be calculated in the above way.
[0070] S340. Determine the target pointer position based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle.
[0071] Example 4
[0072] This application provides a method for identifying an instrument pointer, which optimizes the method in embodiment one of "determining the target pointer position based on the total current pixel value of the image corresponding to each scanning angle and the total original pixel value of the image." It should be noted that for parts not detailed in this embodiment, please refer to the descriptions in other embodiments. The method includes:
[0073] S410. Perform color space conversion on the image acquired by the instrument to obtain the initial HSV image.
[0074] S420. Convert the non-target pointer color pixels in the initial HSV image into instrument background color pixels to obtain the target HSV image.
[0075] S430. Scan the target HSV image based on the virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle.
[0076] S441. Calculate the difference between the current total pixel value and the original total pixel value of each image to obtain a set of pixel total value differences.
[0077] Before generating virtual pointers on the target HSV image, the pixel values (brightness) of each pixel in the target HSV image are pre-calculated, and each pixel on the target HSV image without virtual pointers is recorded as the original pixel of the image. After obtaining the pixel values of each original pixel, the sum of the pixel values of each original pixel is calculated and recorded as the total value of the original pixel of the image.
[0078] It should be noted that the original total pixel value of the image is used to subtract from the current total pixel value of the image corresponding to each scanning angle, thereby obtaining the difference value corresponding to each scanning angle. In this embodiment, the color of the virtual pointer is consistent with the background color of the instrument. Taking a scanning angle as an example, when the virtual pointer scans to that scanning angle, if the virtual pointer does not coincide with the target pointer, that is, the target pointer is on the background area of the instrument, since the target pointer and the background area of the instrument are the same color, the current total pixel value corresponding to that scanning angle is basically consistent with the original total pixel value of the image. Therefore, the difference between the current total pixel value corresponding to that scanning angle and the original total pixel value of the image is generally small. If the virtual pointer coincides with the target pointer, such as Figure 4 As shown, since the pixel value of the pixel in the area where the target pointer stands is the largest among all the pixel values corresponding to white, when the virtual pointer coincides with the target pointer, the pixel value of the area occupied by the virtual pointer on the target pointer changes from the pixel value corresponding to other colors to the pixel value corresponding to the color of the virtual pointer. This will cause the current total pixel value of the image corresponding to this scanning angle to be significantly larger than the original total pixel value of the image.
[0079] After calculating the total current pixel value of the image corresponding to each scanning angle, the difference between the total current pixel value of each image and the original total pixel value of the image is calculated and used as a set of pixel value differences.
[0080] S442. Determine the scanning angle corresponding to the largest pixel total value difference in the set of pixel total value differences to obtain the target pointer position.
[0081] Among them, the largest pixel total value difference in the set of pixel total value differences is generated when the virtual pointer and the target pointer coincide. Therefore, the scanning angle corresponding to the largest pixel total value difference can be determined as the target pointer position.
[0082] It should be noted that the target pointer is any color pointer in the three-pointer instrument.
[0083] Example 5
[0084] This application provides a method for identifying an instrument pointer in Embodiment 5, which supplements the method described in Embodiment 2. It should be noted that for parts not detailed in this embodiment, please refer to the descriptions in other embodiments. The method includes:
[0085] S511. Mark the scale values of each scale on the instrument's acquired image to obtain the instrument's target image.
[0086] S512. Perform color space conversion on the instrument target image to obtain an initial HSV image.
[0087] S520. Convert the non-target pointer color pixels in the initial HSV image into instrument background color pixels to obtain the target HSV image.
[0088] S530. Scan the target HSV image based on the virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle.
[0089] S540. Determine the target pointer position based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle.
[0090] S550. Determine the pointer scale corresponding to the target pointer position.
[0091] In this embodiment, not only is the target pointer position of the target pointer in the instrument identified, but the scale value pointed to by the target pointer when it is at the target pointer position is also identified, and the scale value is used as the pointer pointing to the scale.
[0092] Example 6
[0093] This application provides a method for identifying an instrument pointer in Embodiment Six, which optimizes the "determining the pointer scale corresponding to the target pointer position" in Embodiment Five. It should be noted that for parts not detailed in this embodiment, please refer to the descriptions in other embodiments. The method includes:
[0094] S611. Mark the scale values of each scale on the instrument's acquired image to obtain the instrument's target image.
[0095] S612. Perform color space conversion on the instrument target image to obtain an initial HSV image.
[0096] S620. Convert the non-target pointer color pixels in the initial HSV image into instrument background color pixels to obtain the target HSV image.
[0097] S630. Scan the target HSV image based on the virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle.
[0098] S640. Determine the target pointer position based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle.
[0099] S651. Determine the scale value closest to the target pointer to obtain the closest scale value.
[0100] The instrument has multiple scale markings. When the target pointer is in the target pointer position, it may not be pointing exactly to one scale, but rather to a point between two scales. In this case, the actual scale that the target pointer is pointing to needs to be accurately identified. First, it is necessary to identify the scale value on the instrument that is closest to the target pointer in terms of angle. This scale value can be the scale value marked in step S611. And this scale value is recorded as the closest scale value.
[0101] S652. Determine the scale angle of the nearest scale value to obtain the nearest scale angle.
[0102] In this embodiment, each scale value on the instrument has its corresponding scale, and each scale has its matching angle. In this embodiment, radians are used to represent the angles matching each scale. In other embodiments, the specifics are not limited.
[0103] S653. Calculate the angle ratio based on the target pointer position and the nearest scale angle.
[0104] The target pointer position is itself the current angle of the target pointer. First, the difference between the target pointer position and the nearest scale angle is calculated to obtain the corresponding angle difference. Furthermore, the angle difference between any two adjacent scales in the instrument is determined. Then, the ratio of this angle difference to the angle difference between adjacent scales is used as the angle ratio. The angle difference between any two adjacent scales in the instrument is a preset known value.
[0105] S654. Calculate the scale value deviation based on the angle ratio and the difference between adjacent scale values.
[0106] In this embodiment, the difference between two scale values corresponding to any two adjacent scales in the instrument is preset, that is, the difference between adjacent scale values; the angle ratio is obtained, and the product of the angle ratio and the difference between adjacent scale values is calculated, and the product is recorded as the scale value deviation.
[0107] It should be noted that this scale deviation is the difference between the actual scale value pointed to by the target pointer when it is at the target pointer position and the scale value of the nearest scale mark on the target pointer. Subsequently, by determining the scale value of the nearest scale mark to the target pointer and this scale deviation, the actual scale value pointed to by the target pointer when it is at the target pointer position can be calculated.
[0108] S655. Calculate the pointer's pointing scale based on the deviation between the most recent scale value and the scale value.
[0109] If the scale deviation is negative, it means that the scale value of the nearest scale to the target pointer (the nearest scale value) is greater than the actual scale value that the target pointer points to when it is at the target pointer position. In this case, the actual scale value that the target pointer points to when it is at the target pointer position can be calculated by summing the deviation of the nearest scale value and the scale value of the nearest scale value. That is, the scale that the pointer points to. If the scale deviation is positive, it means that the scale value of the nearest scale to the target pointer (the nearest scale value) is less than the actual scale value that the target pointer points to when it is at the target pointer position. In this case, the scale that the pointer points to can also be calculated by summing the deviation of the nearest scale value and the scale value of the nearest scale value.
[0110] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0111] Example 7
[0112] Based on the same inventive concept, this embodiment also provides an instrument pointer recognition device for implementing the instrument pointer recognition method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more instrument pointer recognition device embodiments provided below can be found in the limitations of the instrument pointer recognition method described above, and will not be repeated here.
[0113] In this embodiment, as Figure 5 As shown, an instrument pointer recognition device is provided, comprising:
[0114] The color space conversion module is used to convert the color space of the images acquired by the instrument to obtain the initial HSV image;
[0115] The background pixel conversion module is used to convert non-target pointer color pixels in the initial HSV image into instrument background color pixels to obtain the target HSV image;
[0116] The pixel total value calculation module is used to scan the target HSV image based on a virtual pointer to obtain the current pixel total value of the image corresponding to each scanning angle.
[0117] The pointer position determination module is used to determine the target pointer position based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle.
[0118] Each module in the aforementioned instrument pointer recognition device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0119] It should be noted that this embodiment obtains an initial HSV image by performing color space conversion on the instrument's acquired image; converts the non-target pointer color pixels in the initial HSV image to instrument background color pixels to obtain a target HSV image; scans the target HSV image based on a virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle; and determines the target pointer position based on the current total pixel value of the image corresponding to each scanning angle and the original total pixel value of the image. Through the above implementation, by converting the instrument's acquired image in RGB color space to HSV color space through color space conversion, the problem of drastic changes in RGB channel data caused by multi-pointer instruments in complex backgrounds and / or poor lighting conditions can be effectively solved, thereby improving the pointer recognition accuracy. Furthermore, when recognizing a target pointer in a multi-pointer instrument, by converting the non-target pointer color pixels in the initial HSV image to instrument background color pixels, the non-target pointer pointer can be hidden in the instrument background, thereby preventing the non-target pointer pointer from adversely affecting the recognition of the target pointer, thus also improving the pointer recognition accuracy in multi-pointer instruments.
[0120] In an optional embodiment, in converting the color space of the instrument-acquired image to obtain an initial HSV image, the color space conversion module is specifically used for:
[0121] The scale values of each division on the instrument's acquired image are labeled to obtain the instrument's target image;
[0122] The target image of the instrument is converted to a color space to obtain an initial HSV image.
[0123] In an optional embodiment, in obtaining the current total pixel value of the image corresponding to each scanning angle by scanning the target HSV image based on a virtual pointer, the pixel total value calculation module is specifically used for:
[0124] A virtual pointer is generated on the target HSV image based on virtual pointer setting parameters, including pointer length, pointer width, and pointer rotation origin.
[0125] A preset number of scanning angles are evenly divided on the target HSV image, and the virtual pointer is controlled to rotate sequentially to each of the scanning angles.
[0126] Collect the set of HSV image pixel values corresponding to each of the aforementioned scanning angles;
[0127] The sum of the pixel values of each HSV image within each set of HSV image pixel values is calculated to obtain the total current pixel value of the image corresponding to each scanning angle.
[0128] In an optional embodiment, regarding determining the target pointer position based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle, the pointer position determination module is specifically used for:
[0129] Calculate the difference between the current total pixel value and the original total pixel value of each image to obtain a set of pixel value differences;
[0130] The target pointer position is obtained by determining the scanning angle corresponding to the largest pixel total value difference in the set of pixel total value differences.
[0131] In an optional embodiment, the instrument pointer recognition device further includes:
[0132] The pointer scale determination module is used to determine the pointer scale corresponding to the target pointer position.
[0133] In an optional embodiment, the scale determination module is specifically used for:
[0134] Determine the nearest scale value to the target pointer to obtain the nearest scale value;
[0135] Determine the scale angle of the most recent scale value to obtain the most recent scale angle;
[0136] Calculate the angle percentage based on the target pointer position and the nearest scale angle;
[0137] Calculate the scale value deviation based on the angle ratio and the difference between adjacent scale values;
[0138] The pointer's pointing scale is calculated based on the deviation between the most recent scale value and the scale value.
[0139] Example 8
[0140] In this embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows. Figure 6 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a method for identifying instrument pointers.
[0141] Those skilled in the art will understand that Figure 6The structure shown is merely a block diagram of a portion of the structure related to the present disclosure and does not constitute a limitation on the computer device to which the present disclosure is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0142] Example 9
[0143] In this embodiment, a computer-readable storage medium is provided, such as... Figure 7 As shown, a computer program is stored thereon, and when the computer program is executed by the processor, it implements the steps in the above-described method embodiments.
[0144] Example 10
[0145] In this embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0146] It should be noted that the information collected is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with the relevant laws, regulations and standards of the relevant countries and regions, necessary confidentiality measures have been taken, and it does not violate public order and good morals. Corresponding operation portals are provided for users to choose to authorize or refuse.
[0147] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this disclosure can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this disclosure may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this disclosure may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0148] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0149] The embodiments described above are merely illustrative of several implementations of this disclosure, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent disclosure. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this disclosure, and these all fall within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the appended claims.
Claims
1. A method for recognizing instrument pointers, characterized in that, include: The color space of the images acquired by the instrument is converted to obtain the initial HSV image; The non-target pointer color pixels in the initial HSV image are converted into instrument background color pixels to obtain the target HSV image; The target HSV image is scanned using a virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle. The target pointer position is determined based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle.
2. The method according to claim 1, characterized in that, The process of converting the color space of the image acquired by the instrument to obtain the initial HSV image includes: The scale values of each division on the instrument's acquired image are labeled to obtain the instrument's target image; The target image of the instrument is converted to a color space to obtain an initial HSV image.
3. The method according to claim 1, characterized in that, The step of scanning the target HSV image based on a virtual pointer to obtain the current total pixel value of the image corresponding to each scanning angle includes: A virtual pointer is generated on the target HSV image based on virtual pointer setting parameters, including pointer length, pointer width, and pointer rotation origin. A preset number of scanning angles are evenly divided on the target HSV image, and the virtual pointer is controlled to rotate sequentially to each of the scanning angles. Collect the set of HSV image pixel values corresponding to each of the aforementioned scanning angles; The sum of the pixel values of each HSV image within each set of HSV image pixel values is calculated to obtain the total current pixel value of the image corresponding to each scanning angle.
4. The method according to claim 1, characterized in that, The determination of the target pointer position based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle includes: Calculate the difference between the current total pixel value and the original total pixel value of each image to obtain a set of pixel value differences; The target pointer position is obtained by determining the scanning angle corresponding to the largest pixel total value difference in the set of pixel total value differences.
5. The method according to claim 2, characterized in that, Also includes: Determine the pointer scale corresponding to the target pointer position.
6. The method according to claim 5, characterized in that, Determining the pointer scale corresponding to the target pointer position includes: Determine the nearest scale value to the target pointer to obtain the nearest scale value; Determine the scale angle of the most recent scale value to obtain the most recent scale angle; Calculate the angle percentage based on the target pointer position and the nearest scale angle; Calculate the scale value deviation based on the angle ratio and the difference between adjacent scale values; The pointer's pointing scale is calculated based on the deviation between the most recent scale value and the scale value.
7. An instrument pointer recognition device, characterized in that, The device includes: The color space conversion module is used to convert the color space of the images acquired by the instrument to obtain the initial HSV image; The background pixel conversion module is used to convert non-target pointer color pixels in the initial HSV image into instrument background color pixels to obtain the target HSV image; The pixel total value calculation module is used to scan the target HSV image based on a virtual pointer to obtain the current pixel total value of the image corresponding to each scanning angle. The pointer position determination module is used to determine the target pointer position based on the current total pixel value and the original total pixel value of the image corresponding to each scanning angle.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.