A method of reading a dial gauge
By acquiring the relative grayscale information of the pointer instrument image and performing binarization processing based on the preset dial shape, and combining it with a neural network model to identify key elements, the problem of inaccurate readings caused by light intensity is solved, and more accurate pointer instrument reading recognition is achieved.
Patent Information
- Application Number
- CN202211719908.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2042-12-30
AI Technical Summary
In existing technologies, pointer instrument reading recognition methods are unable to accurately distinguish key elements and the substrate due to the grayscale threshold caused by different light intensities, resulting in inaccurate reading recognition results.
By acquiring the relative grayscale information of the pointer instrument image to be identified, binarization processing is performed using the preset dial shape and grayscale information. Combined with an artificial neural network model to identify key elements, a mask is generated and image overlay processing is performed to eliminate the influence of lighting and accurately distinguish the scale and pointer positions.
It improves the accuracy of pointer instrument reading recognition, reduces the interference of light intensity on reading recognition, and ensures the accurate reflection of the relationship between the scale and pointer position.
Smart Images

Figure CN116798023B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of metrology and calibration technology, and in particular to a method for identifying pointer instrument readings. Background Technology
[0002] Pointer instruments are used to measure physical quantities and obtain corresponding readings, such as pressure gauges and temperature gauges. A pointer instrument consists of a measuring part and a pointer dial. The measuring part measures the physical quantity, and the pointer dial displays the measured value. However, because pointer instruments are mechanical and do not have the ability to output measured values, manual reading and recording are required. Manual reading and recording, however, is costly, lacks real-time accuracy, is inefficient, and has low accuracy.
[0003] To improve the efficiency and accuracy of reading recording, image recognition technology can be used to identify images containing pointer dials, enabling automatic reading recognition of pointer instruments. Generally, key elements such as pointers and scales are displayed in one color on the dial, while other elements, such as the dial base, are displayed in a different color. In current pointer instrument reading recognition methods, a set grayscale threshold is usually used to distinguish key elements of different shades from the base. The pointer dial is first binarized to obtain a binarized image, and then reading recognition is performed based on this binarized image.
[0004] However, when actually acquiring images of the pointer instruments to be identified, due to differences in light intensity, the acquired images may exhibit the following characteristics: under strong light, the entire image has a high grayscale level (appears too white); under weak light, the entire image has a low grayscale level (appears too black). In such cases, it is difficult to distinguish the key elements from the substrate using the set grayscale threshold, resulting in a binarized image that cannot accurately reflect the positional relationship between the scale and the pointer, leading to inaccurate reading recognition results. Summary of the Invention
[0005] To address the problem that it is difficult to distinguish key elements from the substrate by setting a grayscale threshold, resulting in a binarized image that cannot accurately reflect the positional relationship between the scale and the pointer, thus leading to low accuracy in reading recognition, this application provides a pointer instrument reading recognition method through the following aspects.
[0006] The first aspect of this application provides a method for recognizing pointer instrument readings. The method for recognizing pointer instrument readings includes:
[0007] Acquire an image of the pointer instrument to be identified, wherein the image of the pointer instrument to be identified includes the pointer, scale, and dial of the pointer instrument to be identified;
[0008] The image of the pointer instrument to be identified is processed to obtain the relative grayscale information of key elements relative to the dial. The key elements include at least one of the pointer and the scale.
[0009] The image of the pointer instrument to be identified is binarized according to the preset dial shape and relative grayscale information to obtain a binarized image. The preset dial shape includes the pointer and scale as the first grayscale extreme value and the dial as the second grayscale extreme value.
[0010] The binarized image is processed to obtain the position information of the scale and the pointer.
[0011] Based on the information of the scale position and the position information of the pointer, the reading corresponding to the pointer instrument image to be identified is obtained.
[0012] In some embodiments, the image of the pointer instrument to be identified is processed to obtain the relative grayscale information of key elements relative to the dial, including:
[0013] The image of the pointer instrument to be identified is blurred to obtain a blurred pointer instrument image;
[0014] The image of the pointer instrument to be identified is processed to obtain a mask, which is used to select the area corresponding to the key elements;
[0015] The image of the pointer instrument to be identified and the mask are overlaid, and the average gray value of the overlaid image is calculated to obtain the first gray value.
[0016] The blurred pointer instrument image and the mask are overlaid, and the average gray value of the overlaid image is calculated to obtain the second gray value.
[0017] Based on the first grayscale value and the second grayscale value, relative grayscale information is determined; the relative grayscale information includes the relative magnitude of the first grayscale value and the second grayscale value.
[0018] In some embodiments, the image of the pointer instrument to be identified is binarized according to a preset dial shape and relative grayscale information, including:
[0019] Obtain the grayscale threshold based on the first grayscale value and / or the second grayscale value;
[0020] If the first gray value is greater than the second gray value, the image of the pointer instrument to be identified is processed, and the pixels with gray values less than the gray value threshold are processed as the first gray value extreme value, and the pixels with gray values greater than the gray value threshold are processed as the second gray value extreme value.
[0021] If the first gray value is less than the second gray value, the image of the pointer instrument to be identified is processed, and the pixels with gray values less than the gray threshold are processed as the second gray extreme value, and the pixels with gray values greater than the gray threshold are processed as the first gray extreme value.
[0022] The first gray-level extreme value corresponds to one of the gray-level maximum and minimum values, and the second gray-level extreme value corresponds to the other of the gray-level maximum and minimum values.
[0023] In some embodiments, the image of the pointer instrument to be identified is processed to obtain a mask, including:
[0024] The first artificial neural network model is pre-trained. The training samples used to train the first artificial neural network model include key elements and the localization boxes of the key elements.
[0025] The first artificial neural network model is used to identify the pointer instrument image to be identified, and the identification box is obtained. The identification box indicates the position of the key element in the pointer instrument image to be identified.
[0026] Based on the bounding box to be identified, determine the selected area of the mask.
[0027] In some embodiments, the image of the pointer instrument to be identified is processed to obtain a mask, including:
[0028] The second artificial neural network model is pre-trained. The training samples used to train the second artificial neural network model include a first feature point combination and / or a second feature point combination. The first feature point combination includes the center point of the dial, the smallest inner diameter point, the smallest outer diameter point, the largest inner diameter point, and the largest outer diameter point. The second feature point combination includes the pointer tip point and the pointer tail point.
[0029] The second artificial neural network model is used to identify the pointer instrument image to be identified, and the position information of the feature points is obtained. The position information of the feature points includes the position information of the first feature point combination and / or the position information of the second feature point combination.
[0030] The image of the pointer instrument to be identified is segmented based on the location information of the feature points to obtain the selected area of the mask.
[0031] In some embodiments, the image of the pointer instrument to be identified is binarized according to a preset dial shape and relative grayscale information, including:
[0032] A third artificial neural network model is pre-trained. The third artificial neural network model includes a generator and a discriminator. The pointer instrument sample image is processed according to the preset dial shape to obtain the corresponding binarized sample image. The training dataset of the third artificial neural network model includes pointer instrument sample images and corresponding binarized sample images. The trained generator is output as the third recognition model. The relative grayscale threshold is determined based on the pointer instrument sample image.
[0033] The judgment is made based on the relative gray information and the relative gray threshold. If the relative gray information is less than the relative gray threshold, the contrast of the pointer instrument image to be identified is processed to make the relative gray information greater than or equal to the relative gray threshold.
[0034] The third recognition model is used to process the processed pointer instrument image to obtain a binarized image.
[0035] A second aspect of this application provides a method for verifying a pointer instrument, which utilizes the aforementioned pointer instrument identification method for verification and identification, including:
[0036] The pointer instrument provides a calibration physical quantity, controls the change of the calibration physical quantity, and measures the calibration physical quantity.
[0037] Image acquisition is performed on the pointer instrument to obtain the image of the first pointer instrument to be identified. Correspondingly, the verification value at that moment is obtained. The verification value is the value of the verification physical quantity.
[0038] Before or after acquiring the first image of the pointer instrument to be identified, at least one image acquisition is performed on the pointer instrument to acquire the second image of the pointer instrument to be identified.
[0039] Generate a third pointer instrument image based on at least one second pointer instrument image to be identified;
[0040] According to the aforementioned pointer instrument reading recognition method, the first pointer instrument image to be recognized is recognized to obtain the position information of the measured pointer, and the measured pointer is the pointer of the first pointer instrument image to be recognized;
[0041] The image of the third pointer instrument to be identified is identified to obtain the position information of the measured scale, which is the scale of the third pointer instrument image to be identified;
[0042] Based on the measured scale position information and the measured pointer position information, determine the measured reading of the pointer instrument, and calibrate the pointer instrument based on the measured reading and the calibration value.
[0043] In some embodiments, at least two calibration points are determined based on the pointer instrument to be identified, and the calibration points are included within the range of the pointer instrument to be identified.
[0044] The physical quantity to be verified is controlled to traverse at least two verification points. When the physical quantity to be verified reaches the verification point, image acquisition is performed to obtain the corresponding image of the pointer instrument to be identified.
[0045] Obtaining the measured reading corresponding to the first verification point includes taking the pointer instrument image to be identified corresponding to the first verification point as the first pointer instrument image to be identified, taking the pointer instrument image to be identified corresponding to the second verification point as one of the second pointer instrument images to be identified, and thereby obtaining the measured reading corresponding to the first verification point. The first verification point and the second verification point are both included in at least two verification points, and the first verification point is different from the second verification point.
[0046] Obtaining the measured reading corresponding to the second verification point includes using the pointer instrument image to be identified corresponding to the second verification point as the first pointer instrument image to be identified, and using the pointer instrument image to be identified corresponding to the first verification point as one of the second pointer instrument images to be identified, thereby obtaining the measured reading corresponding to the second verification point.
[0047] In some embodiments, at least three calibration points are determined based on the pointer instrument to be identified;
[0048] The method of generating a third pointer instrument image based on at least one second pointer instrument image to be identified includes combining at least three pointer instrument images to be identified corresponding to different verification points to obtain a third pointer instrument image to be identified.
[0049] The first and second verification points correspond to the same third pointer instrument image to be identified.
[0050] In some embodiments, at least three pointer instrument images corresponding to different verification points are stitched together to obtain a third pointer instrument image, including:
[0051] The image is divided into at least three small grids according to fixed positions, and a pre-defined image representative value calculation rule is used to calculate the representative value of the image. The difference in the representative value is determined by the difference in the image's features.
[0052] According to the image segmentation rules, at least three pointer instrument images to be identified, corresponding to different verification points, are divided to obtain at least three first small grid images corresponding to each fixed position;
[0053] Calculate the representative value of each first small grid image according to the image representative value calculation rules;
[0054] Each fixed position is compared one by one, including selecting all first small grid images corresponding to the fixed position, determining the mode of all selected first small grid images, determining the first small grid image that is the same as or closest to the mode, and outputting the determined first small grid image as the second small grid image corresponding to the fixed position.
[0055] The second small grid image at each fixed position is combined to obtain the third pointer instrument image to be identified.
[0056] In some embodiments, generating a third pointer meter image based on at least one second pointer meter image includes:
[0057] Preset pointer deviation threshold;
[0058] The image of the second pointer instrument to be identified is identified to obtain the position information of the reference pointer, which is the pointer of the second pointer instrument image to be identified;
[0059] Based on the position information of the reference pointer and the position information of the measured pointer, the position deviation value between the reference pointer and the measured pointer is calculated. If the position deviation value exceeds the pointer deviation threshold, the corresponding second pointer instrument image to be identified is the fourth pointer instrument image to be identified.
[0060] At least one second pointer instrument image to be identified is filtered based on the position deviation value and the pointer deviation threshold, so that more than half of the selected second pointer instrument images to be identified are the fourth pointer instrument images to be identified.
[0061] A third pointer instrument image is generated based on the selected second pointer instrument image.
[0062] The pointer instrument reading recognition method provided in this application includes acquiring an image of the pointer instrument to be recognized; acquiring the relative grayscale information of key elements relative to the dial portion; performing binarization processing on the pointer instrument image to be recognized based on the relative grayscale information to obtain a binarized image of a preset dial shape; obtaining scale position information and pointer position information based on the binarized image; and obtaining the reading corresponding to the pointer instrument image to be recognized based on the scale position information and pointer position information. The pointer instrument reading recognition method first acquires the relative grayscale information of key elements relative to the dial portion; uses the relative grayscale information to distinguish the key elements from the dial base, minimizing interference caused by different illumination intensities, so that the acquired binarized image can accurately reflect the positional relationship between the scale and the pointer, improving the accuracy of reading recognition. Attached Figure Description
[0063] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0064] Figure 1 A schematic diagram illustrating the workflow of a pointer instrument reading recognition method provided in this application embodiment;
[0065] Figure 2 This is a schematic diagram illustrating the workflow of step 102 in one implementation of a pointer instrument reading recognition method provided in this application embodiment;
[0066] Figure 3 A schematic diagram of part of the processing results in one implementation of a pointer instrument reading recognition method provided in this application;
[0067] Figure 4 A schematic diagram of samples in the training dataset of the third artificial neural network model in a pointer instrument reading recognition method provided in an embodiment of this application;
[0068] Figure 5 This is a schematic diagram of an example of an image of a pointer instrument to be identified, acquired during the calibration and verification process.
[0069] Figure 6 A schematic diagram illustrating the workflow of a pointer instrument reading recognition method provided in this application for determining a third pointer instrument image to be recognized;
[0070] Figure 7 This is a schematic diagram of the images of the pointer instrument to be identified collected at various verification points during the calibration and verification process.
[0071] Figure 8 This is a schematic diagram illustrating the workflow of generating a third pointer instrument image based on at least one second pointer instrument image to be identified in a pointer instrument reading recognition method provided in this application embodiment. Detailed Implementation
[0072] To address the issue that it is difficult to distinguish key elements from the substrate using a set grayscale threshold, resulting in a binarized image that cannot accurately reflect the positional relationship between the scale and the pointer, leading to low accuracy in reading recognition, this application provides a pointer instrument reading recognition method through the following embodiments.
[0073] See Figure 1 The present application provides a pointer instrument reading identification method, including steps 101-105.
[0074] Step 101: Obtain an image of the pointer instrument to be identified, wherein the image of the pointer instrument to be identified includes the pointer, scale, and dial of the pointer instrument to be identified, and the dial includes a dial base and other information located on the dial base.
[0075] In some embodiments, the pointer meter reading recognition method can be implemented in a handheld device, such as a mobile phone. The handheld device's built-in camera takes a picture of the pointer meter's dial to obtain an image of the pointer meter to be recognized. In other embodiments, the image acquisition device and the image recognition device can be separate. In this case, for devices such as handheld devices equipped with the pointer meter reading recognition method, the image of the pointer meter to be recognized acquired by the image acquisition device is received via data transmission.
[0076] Step 102: Process the image of the pointer instrument to be identified to obtain the relative grayscale information of key elements relative to the dial. The key elements include at least one of the pointer and the scale. See also: [link to relevant documentation] Figure 2 Step 102 includes steps 201-205.
[0077] Step 201: Perform image blurring processing on the image of the pointer instrument to be identified to obtain a blurred pointer instrument image. In this embodiment, the image blurring processing can employ a mean blurring method, a median blurring method, or a Gaussian blurring method. This application does not limit the specific image blurring method; preferably, median blurring processing is used to obtain a blurred pointer instrument image, which can yield relatively better edges. For example, see [link to example]. Figure 3 Image (a) in the image is the pointer instrument to be identified. Figure 3 (b) in the figure is the fuzzy pointer instrument image obtained by using the median fuzzing processing method.
[0078] Step 202: Process the image of the pointer instrument to be identified to obtain a mask, which is used to select the area corresponding to the key element.
[0079] In one possible embodiment, the process of processing the image of the pointer instrument to be identified to obtain a mask for selecting the key elements includes steps 301-303.
[0080] Step 301: Pre-train a first artificial neural network model. The training samples used to train the first artificial neural network model include the key elements and the bounding boxes for the key elements. The key elements refer to the elements that are expected to be distinguished from the dial base, which can be scales, pointers, or a combination of both. For example, the first artificial neural network model is a YOLOv5 model. The YOLOv5 model is trained, and the training samples include a large number (for example, more than 10,000) of various pointer instrument sample images to be recognized. At this time, the pointer instrument sample images to be recognized are color original images including pointer dials. The pointers and scales in the training sample images are labeled. Taking YOLOv5_nano (data size only 3M) as an example, its labeling format is [x_center, y_center, width, height], where x_center represents the horizontal coordinate of the center point of the bounding box, y_center represents the vertical coordinate of the center point of the bounding box, width represents the width (x-axis length) of the bounding box, and height represents the height (y-axis length) of the bounding box. Using training samples, a convergent YOLOv5 model with sufficient confidence is obtained (i.e., the first artificial neural network model).
[0081] Step 302: The first artificial neural network model is used to identify the pointer instrument image to be identified, obtaining a bounding box to be identified. The bounding box indicates the position of the key element in the pointer instrument image to be identified. For example, a pre-trained YOLOv5 model is placed in a handheld device to identify and locate the scale and / or pointer, thereby obtaining the position of the key element in the pointer instrument image to be identified.
[0082] Step 303: Based on the identified positioning box, obtain a mask for selecting the key elements. See also... Figure 3 (c) in the diagram is a schematic diagram of the mask obtained in one implementation method, wherein, Figure 3 The key elements corresponding to the mask shown in (c) include the pointer and the tick mark.
[0083] In one possible embodiment, the process of processing the image of the pointer instrument to be identified to obtain a mask for selecting the key elements includes steps 401-403.
[0084] Step 401: Pre-train the second artificial neural network model. The training samples used to train the second artificial neural network model include a first feature point combination and / or a second feature point combination. The first feature point combination includes the center point of the dial, the smallest inner diameter point, the smallest outer diameter point, the largest inner diameter point, and the largest outer diameter point. The second feature point combination includes the pointer tip point and the pointer tail point. The first feature point combination is used to determine the scale portion in the image of the pointer instrument to be identified, and the second feature point combination is used to determine the pointer portion in the image of the pointer instrument to be identified. In this embodiment, the key element can be only the scale portion, only the pointer portion, or both the scale and the pointer portion.
[0085] In this embodiment, the second artificial neural network model can be a MobileNetv2 network model, a ResNet residual network, or other related artificial neural network models with feature point recognition capabilities.
[0086] Step 402: Use the second artificial neural network model to identify the pointer instrument image to be identified and obtain the position information of the feature points. The position information of the feature points includes the position information of the first feature point combination and / or the position information of the second feature point combination.
[0087] Step 403: Segment the image of the pointer instrument to be identified according to the position information of the feature points to obtain the selected area of the mask.
[0088] In one implementation, the image of the pointer instrument to be identified is segmented according to the first feature point combination to obtain the selected area of the mask, including: obtaining the outer edge of the range according to the center point of the dial, the smallest inner diameter point, and the largest inner diameter point; obtaining the inner edge of the range according to the center point of the dial, the smallest outer diameter point, and the largest outer diameter point; and obtaining the edges at both ends of the range according to the two ends on the same side of the outer diameter edge and the inner diameter edge.
[0089] For example, a polar coordinate system is established with the center point of the dial as the pole to obtain the polar diameter of the inner diameter of the smallest scale and the inner diameter of the largest scale. The smaller of the two is determined as the first dividing radius. The polar angles of the inner diameter of the smallest scale and the inner diameter of the largest scale are obtained. With the center point of the dial as the center, an arc is drawn with the first dividing radius. The starting angle and ending angle of the arc are the polar angles of the inner diameter of the smallest scale and the inner diameter of the largest scale, respectively. This arc is then used as the outer edge of the scale. A polar coordinate system is established with the center point of the dial as the pole. The polar diameters of the minimum and maximum scale outer diameters are obtained. The larger of these two values is determined as the second segmentation radius, yielding the polar angles of the minimum and maximum scale outer diameters. An arc is drawn with the dial center as the center and the second segmentation radius. The starting and ending angles of this arc are the polar angles of the minimum and maximum scale outer diameters, respectively. This arc serves as the inner edge of the range. Based on the edge of the outer and inner diameters of the range, near the minimum scale, one edge of the range is obtained; similarly, based on the edge of the outer and inner diameters of the range, near the maximum scale, the other edge of the range is obtained. The image of the pointer instrument to be identified is segmented based on the inner, outer, and two edges of the range, resulting in the selected area of the mask. At this point, the selected area of the mask corresponds to the scale portion.
[0090] In one implementation, the image of the pointer instrument to be identified is segmented based on the second feature point combination to obtain the selected area of the mask, including: determining the four edges of the pointer area based on the pointer tip and the pointer tail, thus obtaining the selected area of the mask. In this case, the selected area of the mask corresponds to the pointer portion.
[0091] In one implementation, the image of the pointer instrument to be identified is segmented based on the first feature point combination and the second feature point combination to obtain the selected area of the mask. In this case, the selected area of the mask corresponds to the pointer and scale portions. For specific segmentation methods, please refer to the two implementation methods mentioned above; they will not be repeated here.
[0092] Step 203: Overlay the image of the pointer instrument to be identified and the mask, calculate the average grayscale value of the overlaid image, and obtain a first grayscale value. Overlay the image of the pointer instrument to be identified and the mask to obtain the first grayscale image. See also... Figure 3 (d) in the diagram represents an example of a first grayscale image under one implementation method. For instance, the image of the pointer instrument to be identified can be processed into grayscale first, and then superimposed on the mask to obtain the first grayscale image; alternatively, the image of the pointer instrument to be identified and the mask can be superimposed first, and then the grayscale of the superimposed image can be processed to obtain the first grayscale image. The average grayscale value of the first grayscale image is calculated to obtain the first grayscale value G1.
[0093] Step 204: Overlay the blurred pointer instrument image and the mask, calculate the average grayscale value of the overlaid image, and obtain a second grayscale value. Overlay the blurred pointer instrument image and the mask to obtain the second grayscale image. See also... Figure 3 Example of a second grayscale image in one implementation is shown in (e). The average grayscale value of the second grayscale image is calculated to obtain the second grayscale value G2.
[0094] By overlaying masks in steps 203 and 204, the influence of lighting on the judgment of the dial shape is eliminated.
[0095] Step 205: Determine the relative grayscale information based on the first grayscale value and the second grayscale value; the relative grayscale information includes the relative magnitude of the first grayscale value and the second grayscale value.
[0096] Step 103: Binarize the image of the pointer instrument to be identified according to the preset dial shape and the relative grayscale information to obtain a binary image. The preset dial shape includes the pointer and scale being the first grayscale extreme value and the dial being the second grayscale extreme value.
[0097] In some embodiments, a grayscale threshold is obtained based on the first grayscale value and / or the second grayscale value. If the first grayscale value is greater than the second grayscale value, the image of the pointer instrument to be identified is processed, and pixels with grayscale values less than the grayscale threshold are processed as the first grayscale extreme value, and pixels with grayscale values greater than the grayscale threshold are processed as the second grayscale extreme value; if the first grayscale value is less than the second grayscale value, the image of the pointer instrument to be identified is processed, and pixels with grayscale values less than the grayscale threshold are processed as the second grayscale extreme value, and pixels with grayscale values greater than the grayscale threshold are processed as the first grayscale extreme value. The first grayscale extreme value corresponds to one of the grayscale maximum and grayscale minimum values, and the second grayscale extreme value corresponds to the other of the grayscale maximum and grayscale minimum values. That is, after step 103, the dial shape of the binarized image of the pointer instrument to be identified is uniformly obtained, and the dial shape is all the preset dial shape. In subsequent processing, the data is uniform, which facilitates calculation and processing.
[0098] In one implementation, the first grayscale value can be directly used as the grayscale threshold. In another implementation, the second grayscale value can be directly used as the grayscale threshold. In yet another implementation, the average of the first and second grayscale values can be taken as the grayscale threshold.
[0099] In one implementation, the first grayscale extreme value is the grayscale minimum value, for example, the grayscale minimum value is 0, and the second grayscale extreme value is the grayscale maximum value, for example, the grayscale maximum value is 255, and the corresponding preset dial shape is white background, black pointer and black scale.
[0100] If G1 < G2, the dial of the pointer instrument is determined to be black with white hands and white scale. Pixels with gray values less than the gray threshold are processed into the second gray extreme value, i.e., 255, and pixels with gray values greater than the gray threshold are processed into the first gray extreme value, i.e., 0. The resulting binarized image is white with black hands and black scale, the opposite of the original dial shape, but consistent with the preset dial shape. If G1 > G2, the dial of the pointer instrument is determined to be white with black hands and black scale. Pixels with gray values less than the gray threshold are processed into 0, and pixels with gray values greater than the gray threshold are processed into 255. The resulting binarized image is white with black hands and black scale, consistent with the original dial shape.
[0101] In another implementation, the first grayscale extreme value is the maximum grayscale value, for example, the maximum grayscale value is 255, and the second grayscale extreme value is the minimum grayscale value, for example, the minimum grayscale value is 0. The corresponding preset dial shape is black background, white pointer and white scale.
[0102] If G1 < G2, the dial of the pointer instrument is determined to be black with white hands and white scale. Pixels with gray values less than the gray threshold are processed into the second gray extreme value (0), and pixels with gray values greater than the gray threshold are processed into the first gray extreme value (255). The resulting binarized image is black with white hands and white scale, consistent with the original dial shape. If G1 > G2, the dial of the pointer instrument is determined to be white with black hands and black scale. Pixels with gray values less than the gray threshold are processed into the first gray extreme value (255), and pixels with gray values greater than the gray threshold are processed into the second gray extreme value (0). The resulting binarized image is black with white hands and white scale, the opposite of the original dial shape, but consistent with the preset dial shape.
[0103] Thus, the binarized image of the preset dial shape obtained in step 103 can be used in subsequent processing to identify the points corresponding to the maximum grayscale values as the key elements and the points corresponding to the minimum grayscale values as the basis, thus unifying the data and facilitating calculation and processing.
[0104] Because when recognizing pointer instrument readings, only the relationship between the pointer and the scale needs to be considered. Therefore, in some embodiments, the pointer instrument image to be recognized in step 103 can also be a segmented image to be recognized, obtained by segmenting the selected area of the mask. The segmented image to be recognized includes the key element portion. In this case, the binarized image obtained in step 103 only includes the key element region, which can reduce the computational load in subsequent recognition processes and improve computational accuracy.
[0105] Generally, handheld devices offer relatively limited processing and storage resources, resulting in slower processing speeds and unsuitability for larger processing programs. The above embodiment provides steps 201-205, using simple, lightweight tools to obtain a mask containing key elements. By overlaying the mask, the influence of lighting on the judgment of the dial shape is eliminated, obtaining the relative grayscale information of the key elements and the dial portion. Based on this relative grayscale information, a high-quality binarized image can be obtained through simple calculations and grayscale processing, significantly reducing the requirements for processing speed and storage resources, making it highly suitable for handheld devices.
[0106] In some embodiments, step 103 (binarizing the image of the pointer instrument to be identified according to the preset dial shape and the relative grayscale information) includes steps 501-503.
[0107] Step 501: Pre-train a third artificial neural network model. The training dataset of the third artificial neural network model includes the pointer instrument sample image and the corresponding binarized sample image. Output the trained generator as the third recognition model and determine the relative grayscale threshold based on the pointer instrument sample image.
[0108] Step 502: Based on the relative grayscale information and the relative grayscale threshold, a judgment is made. If the relative grayscale information is less than the relative grayscale threshold, the contrast of the pointer instrument image to be identified is processed so that the relative grayscale information is greater than or equal to the relative grayscale threshold. In this application, to ensure the processing accuracy of the third recognition model, a relative grayscale threshold is set, requiring that the relative grayscale information of the pointer instrument image to be identified is greater than or equal to the relative grayscale threshold. If it is less than the relative grayscale threshold, the contrast of the pointer instrument image to be identified is adjusted to obtain a processed pointer instrument image to be identified; if it is greater than or equal to the relative grayscale threshold, the pointer instrument image to be identified is directly used as the processed pointer instrument image to be identified and input into the third recognition model for processing. The relative grayscale information of the processed pointer instrument image to be identified is greater than or equal to the relative grayscale threshold. For example, since the key element is linear, image sharpening processing can be used to adjust the contrast of the pointer instrument image to be identified.
[0109] In one implementation, the pointer or scale portion can be extracted from the image of the pointer to be identified using YOLO or other lightweight object extraction tools, and the corresponding average grayscale value can be calculated. Simultaneously, the dial portion can be extracted from the image of the pointer to be identified, and the corresponding average grayscale value can be calculated. The difference between the two average grayscale values is then calculated to obtain the relative grayscale information. In another implementation, the method provided in steps 201-205 can be used to obtain the relative grayscale information.
[0110] Step 503: Input the processed pointer instrument image to be identified into the third recognition model to obtain the binarized image.
[0111] In one implementation, the third artificial neural network model employs a Generative Adversarial Network (GAN) model. The training dataset includes multiple stitched images; see [link to relevant documentation]. Figure 4 The stitched image is obtained by stitching together a sample pointer instrument image and a corresponding binarized sample image, wherein the dial shape of the binarized sample image is the preset dial shape. Figure 4 As can be seen, the binarized sample image can retain only the pointer and scale portions. In one implementation, the preset dial shape is defined as the pointer and scale being the first grayscale extreme values, and the other unknown parts of the dial being the second grayscale extreme values. For example, the preset dial shape is a black dial base with white pointers and scales; that is, the dial shape of the binarized image extracted by the third recognition model is always a black dial base with white pointers and scales. The role of the third recognition model is to simulate a binarized image that is as similar as possible to the original image, but retains only the effective information.
[0112] Generative Adversarial Networks (GANs) are a deep learning-based generative modeling method. During training, a GAN consists of a generator G and a discriminator D. The generator G uses a U-net structure to encode and then decode the input contour map x into a real image. The discriminator D uses a conditional discriminator PatchGAN, which determines whether the generated image G(x) is false or the real image is true, given the contour map x. U-net borrows from the FCN network, and its network structure includes two symmetrical parts: the first part is similar to a regular convolutional network, using 3×3 convolutions and pooling downsampling to capture contextual information (i.e., relationships between pixels); the second part is essentially symmetrical, using 3×3 convolutions and upsampling to achieve image segmentation. Furthermore, the GAN algorithm uses feature fusion, fusing features from the downsampling part with features from the upsampling part to obtain more accurate contextual information and achieve better segmentation results. The objective function during training is as follows:
[0113]
[0114] Because the generator G's purpose is to confuse the discriminator D while producing an image that closely resembles the real image, an L1 loss similar to the real image is added:
[0115]
[0116] Therefore, the final objective function is:
[0117]
[0118] The discriminator D adopts a PatchGAN structure, which means that the image is divided into equal patches, each patch is judged as real or fake, and then the average is taken. In this embodiment, by testing patches of different sizes, it was found that a size between 50×50 and 100×100 is more suitable.
[0119] The training dataset includes a large number (e.g., over 10,000) of sample pointer meter images. In one implementation, the sample pointer meter images need to be resized to 256×256 and manually processed into binarized sample images with a black background, white pointers, and white scale (preset dial layout). The sample pointer meter images and the binarized sample images are then stitched together to form a 512×256 image, which is then fed into the GAN network for training. The training process includes alternating steps 1 and 2.
[0120] The process is as follows: Step 1: Fix the generator D and train the discriminator D until the discriminator D's recognition rate of the generated images approaches or reaches 100% (or can be set to 95%). Step 2: Fix the discriminator D and train the generator G until the discriminator D's recognition rate of the machine-generated images approaches or reaches 50%.
[0121] After the aforementioned multiple rounds of training, a generative adversarial network with a sufficiently high confidence level is obtained. The generator G part of this network is used as the third recognition model. Using this third recognition model, a binary image containing only the pointer and scale is extracted from the processed image of the pointer instrument to be recognized. This essentially eliminates the influence of interference factors such as shadows, exposure, various marks, and text, making it relatively easy to read the pointer and scale information.
[0122] The binarization processing method using a third recognition model provided in this embodiment can be deployed in a reading recognition system with relatively abundant processing and storage resources. For example, an image of the pointer meter to be recognized can be acquired using a handheld device or other image acquisition device that can be fixed near the pointer meter and transmitted to a remote server. The server then uses the binarization processing method using a pre-trained third recognition model provided in this embodiment to extract the binarized image of the preset dial shape from the processed image of the pointer meter to be recognized.
[0123] Step 104: Process the binarized image to obtain the position information of the scale and the position information of the pointer.
[0124] Step 105: Based on the position information of the scale and the position information of the pointer, obtain the reading corresponding to the pointer instrument image to be identified.
[0125] In one implementation, based on the scale information (e.g., the coordinates of the center points of all scale positioning boxes), the center of the ellipse is fitted using the least squares method (other calculation methods may also be used), and the fitted ellipse center is taken as the pole. The downward direction (or upward, left, or right, adjusted accordingly during subsequent judgment) is taken as the polar axis direction. According to the aforementioned pole and polar axis, the polar coordinate image is unfolded into a rectangular coordinate image. For example, an angle precision of 0.1-1 degree is selected, resulting in 360*10-360 pixels of angular coordinates after unfolding. The angle precision parameter can be modified, but a larger value does not necessarily mean greater precision; a larger angle precision parameter may affect the calculation speed.
[0126] The unfolded image resembling a ruler undergoes matrix operations, and is corrected and supplemented using scale spacing logic to determine the scale angle and distinguish scale sizes. An image resembling a vernier is processed separately to determine the pointer angle. In one implementation, when determining the scale position, a convolution kernel with a width equal to the image width and a height of 5 is used to obtain a matrix of (1 * height). This matrix represents an array that comprehensively considers scale length, width, and grayscale; its peak value can be considered the scale position. The spacing between adjacent scales is calculated, essentially finding the "mode" in a floating-point number, and values with significant differences are judged, added, deleted, or modified. Similarly, the pointer position can also be determined.
[0127] In another implementation, the binarized image can be transformed into polar coordinates based on the coordinates of the dial center point extracted by the feature point extraction model, thus obtaining the scale distribution map and pointer distribution map in a Cartesian coordinate system. In the Cartesian coordinate system, by determining the distribution coordinates of the pointer tip and the corresponding scale distribution coordinates, the scale the pointer points to can be further determined, thus obtaining the positional relationship between the scale and the pointer.
[0128] In another implementation, polar coordinate expansion can be omitted, and other image processing methods can be used to obtain the scale position information and pointer position information, further determining the positional relationship between the scale and the pointer. For example, an angle measurement method can be used. A polar coordinate system is established based on the coordinates of the dial's center point. The rectangular coordinates of the scale are converted to polar coordinates (polar radius and polar angle) to obtain the scale position information. Similarly, the rectangular coordinates of the pointer are converted to polar coordinates (polar radius and polar angle) to obtain the pointer position information. Based on the polar angle of the pointer and the polar angle of the scale, the scale the pointer is pointing to can be determined, thus establishing the positional relationship between the scale and the pointer.
[0129] In one implementation, while using the first artificial neural network model to obtain the key element location box, the values in the pointer instrument are also identified, and a correspondence is established with the scale. Then, based on the positional relationship between the scale and the pointer, the reading corresponding to the pointer instrument image to be identified is obtained.
[0130] In another implementation, the corresponding numerical value and unit of the pointer instrument can be pre-stored in the recognition terminal. During reading recognition, the corresponding numerical value and unit are directly read and a correspondence is established with the scale. Then, based on the positional relationship between the scale and the pointer, the reading corresponding to the pointer instrument image to be recognized is obtained.
[0131] In another implementation, the largest numerical value and unit can be directly identified from the dial, and the value corresponding to each scale mark can be determined based on the scale's range. Then, based on the positional relationship between the scale marks and the pointer, the reading corresponding to the pointer instrument image to be identified can be obtained.
[0132] The pointer instrument reading recognition method provided in the above embodiments includes: acquiring an image of a pointer instrument to be recognized; processing the image to be recognized to obtain relative grayscale information of key elements relative to the dial; binarizing the image to be recognized according to a preset dial shape and the relative grayscale information to obtain a binarized image; processing the binarized image to obtain position information of the scale and the pointer; obtaining the positional relationship between the scale and the pointer according to the positional information of the scale and the pointer; and obtaining the reading corresponding to the pointer instrument image to be recognized according to the positional relationship between the scale and the pointer. The pointer instrument reading recognition method first acquires the relative grayscale information of key elements relative to the dial portion; uses the relative grayscale information to distinguish the key elements from the dial base, minimizing interference caused by different light intensities, so that the acquired binarized image can accurately reflect the positional relationship between the scale and the pointer, improving the accuracy of reading recognition.
[0133] During the calibration and verification process of pointer instruments, several calibration points are selected to verify the accuracy of the instrument's measurements. These calibration points are typically the main scale graduations on the dial. During calibration, the same calibration physical quantity as at the calibration points is applied to the measuring part of the pointer instrument. If the pointer instrument is sufficiently accurate, when the pointer stabilizes and reads a value, the pointer and scale will at least partially overlap, or the pointer and scale will be indistinguishable in image. See also... Figure 5 Because the pointer tip is often thin and the scale is also thin, it is difficult to distinguish the pointer and the scale when using the aforementioned pointer instrument reading recognition method. This can lead to missed readings of the scale or misreadings of the pointer, thereby reducing the accuracy of pointer instrument reading recognition.
[0134] Therefore, in some embodiments of this application, a calibration physical quantity is provided to the pointer instrument, and the change of the calibration physical quantity is controlled; the pointer instrument measures the calibration physical quantity; an image is acquired from the pointer instrument to obtain a first pointer instrument image to be identified, and correspondingly, the calibration indication value at that moment is acquired, the calibration indication value being the value of the calibration physical quantity; before or after acquiring the first pointer instrument image to be identified, at least one image acquisition is performed on the pointer instrument to obtain a second pointer instrument image to be identified; a third pointer instrument image to be identified is generated based on at least one second pointer instrument image to be identified; the position information of the measured pointer is obtained based on the first pointer instrument image to be identified, the measured pointer being the pointer in the first pointer instrument image to be identified; the position information of the measured scale is obtained by identifying the third pointer instrument image to be identified, the measured scale being the scale in the third pointer instrument image to be identified; the measured reading of the pointer instrument is determined according to the position information of the measured scale and the position information of the measured pointer, and the pointer instrument is calibrated according to the measured reading and the calibration indication value.
[0135] Taking a pressure instrument as an example, after connecting the pressure instrument to a controllable pressure source (such as a pressure controller), the pressure controller is used to pressurize the pressure instrument (the target calibration point is higher than the current pressure) or depressurize it (the target calibration point is lower than the current pressure). When the target calibration point is reached (if the pressure instrument is a pressure gauge or pressure transmitter, the calibration point corresponds to a predetermined pressure value; if the pressure instrument is a pressure switch, the calibration point corresponds to the switching action of the pressure switch), the image of the first pointer instrument to be identified is acquired.
[0136] In one implementation, the acquisition time can be recorded simultaneously with the acquisition of the pointer instrument image to be identified, and the first and second pointer instrument images to be identified can be determined based on the time contained in the instruction. In another implementation, when a predetermined pressure value is reached or based on a triggered action, the pointer instrument image to be identified at the current moment (the moment before and / or the moment after the current moment) is determined as the first pointer instrument image to be identified. Image acquisition is initiated simultaneously with pressurization or depressurization, periodically acquiring pointer instrument images to be identified. For example, if the pressure control time (the time from the start of pressurization / depressurization to pressure stabilization, or the time from the start of pressurization / depressurization to pressure switch action) is 10 seconds, then five second pointer instrument images to be identified can be obtained before the first pointer instrument image to be identified is obtained. Alternatively, one second pointer instrument image can be determined before the first pointer instrument image is obtained during the pressurization or depressurization process. In another implementation, the first and second pointer instrument images to be identified can also be acquired manually.
[0137] In some embodiments, at least three verification points are determined based on the pointer instrument to be identified; generating a third pointer instrument image based on at least one second pointer instrument image to be identified includes merging at least three pointer instrument images to be identified corresponding to different verification points to obtain the third pointer instrument image to be identified; the first verification point and the second verification point correspond to the same third pointer instrument image to be identified.
[0138] See Figure 6 The step of combining at least three pointer instrument images corresponding to different verification points to obtain the third pointer instrument image includes steps 601-605.
[0139] Step 601: Preset image segmentation rules, which include dividing the image into at least three small grid images according to fixed positions; and preset image representative value calculation rules, which are used to calculate the representative value of the image, and the difference in representative value is determined by the difference in image elements.
[0140] Step 602: Divide the at least three pointer instrument images corresponding to different verification points according to the image division rules to obtain at least three first small grid images corresponding to each fixed position.
[0141] Step 603: Calculate the representative value of each of the first small grid images according to the image representative value calculation rules.
[0142] Step 604 involves comparing each of the fixed positions one by one, including selecting all the first small grid images corresponding to the fixed position, determining the mode of all the selected first small grid images, determining the first small grid image that is the same as or closest to the mode, and outputting the determined first small grid image as the second small grid image corresponding to the fixed position.
[0143] Step 605: Combine the second small grid images at each fixed position to obtain the third pointer instrument image to be identified. In one implementation, the first pointer instrument image to be identified and the second pointer instrument image to be identified (the total number of pointer instrument images to be identified is greater than or equal to 3) are divided into N×N small grid images according to a preset image division rule. A representative value is calculated for each first small grid image; for example, this could be the average gray value or the total gray value. If the representative values of all the first small grid images corresponding to a given position are the same, then any first small grid image in the pointer instrument images to be identified is selected as the second small grid image at that position in the third pointer instrument image to be identified. If the values of all the first small grid images corresponding to a given position are not all the same, then the first small grid image with the highest matching degree is selected as the second small grid image at that position in the third pointer instrument image to be identified. For example, if more than half of the representative values are the same, then any one of the first small grid images with the same representative value is selected as the first small grid image at that position in the third pointer instrument image to be identified. Similarly, after traversing all positions of the first small grid image, the selected second small grid images are stitched together to obtain the processed image, which serves as the third pointer instrument image to be identified. The scale position information of the pointer dial is read from the third pointer instrument image to be identified.
[0144] The method for obtaining the third pointer instrument image to be identified, provided in steps 601-565, is a voting-like mechanism. Based on the foregoing description, if the scale near the pointer tip in the first pointer instrument image to be identified is called the scale to be determined, then in the grid image where the scale to be determined is located, there are fewer small grid images of the scale to be determined that are affected by the pointer (from the first pointer instrument image), and more small grid images of the scale to be determined that are not affected by the pointer (from the second pointer instrument image). Under the voting mechanism, the small grid images from the first pointer instrument image to be identified will be voted down, thus ensuring that the scale position information originates from the image unaffected by the pointer.
[0145] In this embodiment, the process of determining the reading corresponding to the first pointer instrument image to be identified based on the scale position information and the pointer position information can be referred to step 105 in the previous embodiment, and will not be repeated here.
[0146] In some embodiments, at least two calibration points are determined based on the pointer instrument to be identified. The calibration points are included within the range of the pointer instrument to be identified. The calibration physical quantity is controlled to traverse the at least two calibration points. When the calibration physical quantity reaches the calibration point, image acquisition is performed to obtain the corresponding image of the pointer instrument to be identified. Obtaining the measured reading corresponding to the first calibration point includes using the image of the pointer instrument to be identified corresponding to the first calibration point as the first image of the pointer instrument to be identified, and using the image of the pointer instrument to be identified corresponding to the second calibration point as one of the second images of the pointer instrument to be identified, thereby obtaining the measured reading corresponding to the first calibration point. Both the first calibration point and the second calibration point are included in the at least two calibration points, and the first calibration point is different from the second calibration point. Obtaining the measured reading corresponding to the second calibration point includes using the image of the pointer instrument to be identified corresponding to the second calibration point as the first image of the pointer instrument to be identified, and using the image of the pointer instrument to be identified corresponding to the first calibration point as one of the second images of the pointer instrument to be identified, thereby obtaining the measured reading corresponding to the second calibration point.
[0147] In other words, the aforementioned pointer instrument reading recognition method and pointer instrument calibration process are combined. The calibration process requires verifying the accuracy of readings at multiple calibration physical quantity points, all of which are within the range of the pointer instrument to be identified. When identifying the reading of a calibration physical quantity point, the pointer position information is determined using the corresponding image of the pointer instrument at that calibration physical quantity point, and the scale position information is determined using at least the images of the pointer instruments at other calibration physical quantity points. Thus, in a single calibration process, only the images of the pointer instruments at each calibration physical quantity point need to be acquired to accurately determine the reading information of each calibration physical quantity point, reducing the amount of data acquisition and processing computation.
[0148] When calibrating pressure gauges, pressure transmitters, etc., multiple calibration physical measurement points are determined within their measuring range. For example, for a pressure gauge with a measuring range of 0-1.6 MPa, there are typically five calibration physical measurement points: 0 MPa, 0.4 MPa, 0.8 MPa, 1.2 MPa, and 1.6 MPa. (See [link to relevant documentation]). Figure 7 .
[0149] Taking the calibration method as an example, pressure control (using a pressure controller) is performed according to the requirements of the physical quantity points to be calibrated, and the calibration pressure is input to the pressure instrument being measured. When the calibration pressure equals the target calibration point of 0 MPa, the calibration pressure is kept stable, and a data acquisition command is sent to the image acquisition device. The image acquisition device acquires the image of the first pointer instrument to be identified corresponding to 0 MPa according to the acquisition command, and feeds back the acquisition completion status to the pressure controller. The pressure controller continues to increase the pressure according to the feedback of the acquisition completion status. When the target pressure equals the target calibration point of 0.4 MPa, the calibration pressure is kept stable, and a data acquisition command is sent to the image acquisition device. The image acquisition device acquires the image of the first pointer instrument to be identified corresponding to 0.4 MPa according to the acquisition command, and feeds back the acquisition completion status to the pressure controller; and so on, until the acquisition of the first pointer instrument images to be identified corresponding to 0.8 MPa, 1.2 MPa, and 1.6 MPa is completed.
[0150] At this time, when it is necessary to identify the measurement value corresponding to the physical quantity point 0MPa, the first pointer instrument image corresponding to each point of 0.4MPa, 0.8MPa, 1.2MPa and 1.6MPa can be processed as the second pointer instrument image to be identified.
[0151] Depending on the verification requirements, reverse voltage reduction can be implemented subsequently. During the voltage reduction process, the first pointer instrument images corresponding to 1.6MPa, 1.2MPa, 0.8MPa, 0.4MPa, and 0MPa are acquired sequentially. Similarly, when it is necessary to identify and verify the measurement reading at 1.6MPa, the first pointer instrument images corresponding to 0MPa, 0.4MPa, 0.8MPa, and 1.2MPa can be processed as the second pointer instrument images.
[0152] In this embodiment, the reading recognition process and verification process of the pointer instrument to be identified are combined. The pointer instrument image acquired at the target verification point during the verification process is used as the first pointer instrument image to be identified, and the pointer instrument images acquired at other verification physical quantity points are used as the second pointer instrument images to be identified. Since the first pointer instrument images to be identified at each verification physical quantity point are the ones that need to be identified or processed, it is equivalent to saving the acquisition and processing of the second pointer instrument images to be identified, reducing the image acquisition and recognition processing volume of the entire pointer instrument reading recognition method, saving hardware storage and processing resources, and improving the reading recognition and processing efficiency.
[0153] In some embodiments, the number of the second pointer instrument images to be identified is 1, and the scale position information is obtained directly based on the second pointer instrument image to be identified, which is then used as the third pointer instrument image to be identified. The process of generating the third pointer instrument image based on at least one second pointer instrument image to be identified further includes steps 701-706, as follows: Figure 8 As shown.
[0154] Step 701: Preset pointer deviation threshold.
[0155] Step 702: Identify the second pointer instrument image to be identified and obtain the position information of the reference pointer, wherein the reference pointer is the pointer in the second pointer instrument image to be identified.
[0156] In one implementation, during the extraction process in steps 701-702, the MobileNetv2 network model, ResNet residual network, or other related artificial neural network models with feature point recognition capabilities can be used to obtain the position information of the reference pointer.
[0157] Step 703: Calculate the position deviation value between the reference pointer and the measured pointer based on the position information of the reference pointer and the measured pointer. If the position deviation value exceeds the pointer deviation threshold, the corresponding second pointer instrument image to be identified is the fourth pointer instrument image to be identified.
[0158] Step 704: Filter at least one second pointer instrument image to be identified based on the position deviation value and the pointer deviation threshold, so that more than half of the selected second pointer instrument images to be identified are the fourth pointer instrument images to be identified.
[0159] Step 705: Generate the third pointer instrument image to be identified based on the selected second pointer instrument image to be identified.
[0160] In one implementation, the range angle range is first determined, and then a preset position difference threshold is determined based on the range angle range. The method for determining the range angle range includes: extracting corresponding range feature points from a fourth pointer instrument image to be identified, wherein the range feature points include the dial center point, the minimum scale inner diameter point, and the maximum scale inner diameter point, or the range feature points include the dial center point, the minimum scale outer diameter point, and the maximum scale outer diameter point; wherein the fourth pointer instrument image to be identified is any one of the first pointer instrument image to be identified or the second pointer instrument image to be identified. Based on the dial center point, the minimum scale outer diameter point, the maximum scale outer diameter point, and / or the dial center point, the minimum scale inner diameter point, and the maximum scale inner diameter point, a polar coordinate system is established with the dial center point as the pole, the polar angles of the remaining range feature points are determined, and the angle range from the minimum scale to the maximum scale is further determined, i.e., the range angle range under the preset coordinate system is obtained.
[0161] In step 703, a preset position difference threshold is set. For example, the preset position difference threshold is set to 5% of the range angle range under the preset coordinate system. The relative position difference between the second pointer position and the first pointer position corresponding to any second pointer instrument image to be identified is calculated. If the relative position difference is less than the preset position difference threshold, the corresponding second pointer instrument image to be identified will not participate in the subsequent reading recognition process and will be deleted from the process. If the relative position difference is greater than or equal to the preset position difference threshold, the corresponding second pointer instrument image to be identified will participate in the subsequent reading recognition process.
[0162] The steps of the method described in the embodiments of this application can be directly embedded in hardware, a software unit executed by a processor, or a combination of both. The software unit can be stored in RAM, flash memory, ROM, EPROM, EEPROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from and write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and storage medium can be disposed in an ASIC, which can be disposed in the UE. Optionally, the processor and storage medium can also be disposed in different components within the UE.
[0163] It should be understood that in the various embodiments of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0164] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0165] The same or similar parts between the various embodiments in this specification can be referred to interchangeably. Each embodiment focuses on the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment section.
[0166] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments of the present invention.
[0167] The embodiments described above do not constitute a limitation on the scope of protection of this application.
Claims
1. A method of reading a dial gauge, characterized in that, include: Acquire an image of a pointer instrument to be identified, wherein the image of the pointer instrument to be identified includes the pointer, scale, and dial of the pointer instrument to be identified; The image of the pointer instrument to be identified is processed to obtain the relative grayscale information of key elements relative to the dial, wherein the key elements include at least one of pointer and scale; The image of the pointer instrument to be identified is binarized according to the preset dial shape and the relative grayscale information to obtain a binarized image. The preset dial shape includes the pointer and scale being the first grayscale extreme value and the dial being the second grayscale extreme value. The binarized image is processed to obtain the position information of the scale and the position information of the pointer; Based on the position information of the scale and the position information of the pointer, the reading corresponding to the pointer instrument image to be identified is obtained; The process of processing the image of the pointer instrument to be identified to obtain the relative grayscale information of key elements relative to the dial includes: The image of the pointer instrument to be identified is blurred to obtain a blurred pointer instrument image; The image of the pointer instrument to be identified is processed to obtain a mask, which is used to select the area corresponding to the key element; The image of the pointer instrument to be identified and the mask are superimposed, and the average gray value of the superimposed image is calculated to obtain the first gray value. The blurred pointer instrument image and the mask are overlaid, and the average gray value of the overlaid image is calculated to obtain the second gray value. The relative grayscale information is determined based on the first grayscale value and the second grayscale value; the relative grayscale information includes the relative magnitudes of the first grayscale value and the second grayscale value.
2. The pointer instrument reading recognition method according to claim 1, characterized in that, The binarization process of the pointer instrument image to be identified based on the preset dial shape and the relative grayscale information includes: Obtain the grayscale threshold based on the first grayscale value and / or the second grayscale value; If the first gray value is greater than the second gray value, the image of the pointer instrument to be identified is processed, and the pixels with gray values less than the gray value threshold are processed as the first gray value extreme value, and the pixels with gray values greater than the gray value threshold are processed as the second gray value extreme value. If the first gray value is less than the second gray value, the image of the pointer instrument to be identified is processed, and the pixels with gray values less than the gray threshold are processed into the second gray extreme value, and the pixels with gray values greater than the gray threshold are processed into the first gray extreme value. The first grayscale extreme value corresponds to one of the grayscale maximum and the grayscale minimum value, and the second grayscale extreme value corresponds to the other of the grayscale maximum and the grayscale minimum value.
3. The pointer gauge reading recognition method of claim 1, wherein, The process of processing the image of the pointer instrument to be identified to obtain a mask includes: A first artificial neural network model is pre-trained, and the training samples used to train the first artificial neural network model include the key elements and the bounding boxes of the key elements; The first artificial neural network model is used to identify the pointer instrument image to be identified, and a positioning box to be identified is obtained. The positioning box to be identified indicates the position of the key element in the pointer instrument image to be identified. Based on the target location box, the selected area of the mask is determined.
4. The pointer gauge reading recognition method of claim 1, wherein, The process of processing the image of the pointer instrument to be identified to obtain a mask includes: The second artificial neural network model is pre-trained. The training samples used to train the second artificial neural network model include a first feature point combination and / or a second feature point combination. The first feature point combination includes the center point of the dial, the smallest inner diameter point, the smallest outer diameter point, the largest inner diameter point, and the largest outer diameter point. The second feature point combination includes the pointer tip point and the pointer tail point. The second artificial neural network model is used to identify the pointer instrument image to be identified, and the location information of the feature points is obtained. The location information of the feature points includes the location information of the first feature point combination and / or the location information of the second feature point combination. The image of the pointer instrument to be identified is segmented based on the location information of the feature points to obtain the selected area of the mask.
5. The pointer instrument reading recognition method according to claim 1, characterized in that, The binarization process of the pointer instrument image to be identified based on the preset dial shape and the relative grayscale information includes: A third artificial neural network model is pre-trained. The third artificial neural network model includes a generator and a discriminator. The pointer instrument sample image is processed according to the preset dial shape to obtain the corresponding binarized sample image. The training dataset of the third artificial neural network model includes the pointer instrument sample image and the corresponding binarized sample image. The trained generator is output as the third recognition model. The relative grayscale threshold is determined based on the pointer instrument sample image. Based on the relative grayscale information and the relative grayscale threshold, if the relative grayscale information is less than the relative grayscale threshold, the contrast of the pointer instrument image to be identified is processed so that the relative grayscale information is greater than or equal to the relative grayscale threshold. The image of the pointer instrument to be identified is input into the third recognition model to obtain the binarized image.
6. A method for calibrating a pointer instrument, characterized in that, The pointer instrument is provided with a calibration physical quantity, the calibration physical quantity is controlled to change, and the pointer instrument measures the calibration physical quantity. Image acquisition is performed on the pointer instrument to obtain the first pointer instrument image to be identified, and correspondingly, the verification value at that moment is obtained, wherein the verification value is the value of the verification physical quantity; Before or after acquiring the first image of the pointer instrument to be identified, at least one image acquisition is performed on the pointer instrument to acquire the second image of the pointer instrument to be identified. A third pointer instrument image is generated based on at least one second pointer instrument image to be identified; According to any one of claims 1-5, the pointer instrument reading recognition method identifies the first pointer instrument image to be identified to obtain the position information of the measured pointer, wherein the measured pointer is the pointer in the first pointer instrument image to be identified; The third pointer instrument image to be identified is identified to obtain the position information of the measured scale, wherein the measured scale is the scale of the third pointer instrument image to be identified; Based on the position information of the measured scale and the position information of the measured pointer, the measured reading of the pointer instrument is determined, and the pointer instrument is calibrated based on the measured reading and the calibration value.
7. The calibration method for pointer instruments according to claim 6, characterized in that, At least two calibration points are determined based on the pointer instrument to be identified, and the calibration points are included within the range of the pointer instrument to be identified; The physical quantity being verified is controlled to traverse the at least two verification points. When the physical quantity being verified reaches the verification point, image acquisition is performed to obtain the corresponding image of the pointer instrument to be identified. Obtaining the measured reading corresponding to the first verification point includes taking the image of the pointer instrument to be identified corresponding to the first verification point as the first image of the pointer instrument to be identified, taking the image of the pointer instrument to be identified corresponding to the second verification point as one of the second images of the pointer instrument to be identified, thereby obtaining the measured reading corresponding to the first verification point. The first verification point and the second verification point are both included in the at least two verification points, and the first verification point is different from the second verification point. Obtaining the measured reading corresponding to the second verification point includes using the image of the pointer instrument to be identified corresponding to the second verification point as the first image of the pointer instrument to be identified, and using the image of the pointer instrument to be identified corresponding to the first verification point as one of the second images of the pointer instrument to be identified, thereby obtaining the measured reading corresponding to the second verification point.
8. The calibration method for pointer instruments according to claim 7, characterized in that, At least three verification points are determined based on the pointer instrument to be identified; The process of generating a third pointer instrument image based on at least one second pointer instrument image to be identified. This includes combining at least three pointer instrument images to be identified that correspond to different verification points to obtain the third pointer instrument image to be identified; The first verification point and the second verification point correspond to the same third pointer instrument image to be identified.
9. The calibration method for pointer instruments according to claim 8, characterized in that, The step of combining at least three pointer instrument images corresponding to different verification points to obtain the third pointer instrument image includes: The image is divided into at least three small grids according to a fixed position, and a representative value calculation rule is set up to calculate the representative value of the image. The difference in the representative value is determined by the difference in the image's elements. According to the image segmentation rules, the at least three pointer instrument images to be identified corresponding to different verification points are divided to obtain at least three first small grid images corresponding to each fixed position; Calculate the representative value of each of the first small grid images according to the image representative value calculation rules; Each of the fixed positions is compared one by one, including selecting all the first small grid images corresponding to the fixed position, determining the mode of all the selected first small grid images, determining the first small grid image that is the same as or closest to the mode, and outputting the determined first small grid image as the second small grid image corresponding to the fixed position. The second small grid images at each of the fixed positions are combined to obtain the third pointer instrument image to be identified.
10. The calibration method for pointer instruments according to claim 6, characterized in that, Generating a third pointer instrument image based on at least one second pointer instrument image to be identified includes: Preset pointer deviation threshold; The second pointer instrument image to be identified is identified to obtain the position information of the reference pointer, wherein the reference pointer is the pointer in the second pointer instrument image to be identified; Based on the position information of the reference pointer and the position information of the measured pointer, the position deviation value between the reference pointer and the measured pointer is calculated. If the position deviation value exceeds the pointer deviation threshold, the corresponding second pointer instrument image to be identified is the fourth pointer instrument image to be identified. At least one second pointer instrument image to be identified is filtered according to the position deviation value and the pointer deviation threshold, so that more than half of the selected second pointer instrument images to be identified are the fourth pointer instrument images to be identified. The third pointer instrument image to be identified is generated based on the selected second pointer instrument image to be identified.
Citation Information
Patent Citations
Automobile combination instrument system
CN109872361A
Single-character tablet inscription image binaryzation method, system and device and storage medium
CN112927254A