A pointer detection method, system and electronic device
By using edge feature extraction and projection direction fitting, the problem of environmental interference in pointer-type instrument detection was solved, improving detection accuracy and the stability of automatic reading.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-20
- Publication Date
- 2026-03-31
AI Technical Summary
In the existing technology, the image detection of pointer-type instruments is easily affected by factors such as reflection, tilt and noise, resulting in poor detection accuracy and affecting the accuracy of automatic reading.
By extracting edge features from the image to be detected, determining multiple projection directions, fitting sample points within a preset distance range, and using the least squares method to fit the target pointer, the influence of environmental interference is reduced.
It improves the accuracy and robustness of pointer detection, and enhances the accuracy and stability of automatic reading.
Smart Images

Figure CN115393609B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a pointer detection method, system, and electronic device. Background Technology
[0002] Pointer instruments, as a traditional measuring instrument, are widely used in various fields such as industrial production due to their simple structure, low price, and stable and reliable operation. Commonly used pointer instruments include barometers, thermometers, and pressure gauges. For example, Figure 1(a) shows a schematic diagram of a barometer, Figure 1(b) shows a schematic diagram of a thermometer, and Figure 1(c) shows a schematic diagram of a pressure gauge. However, pointer instruments typically require manual reading, resulting in a significant waste of human resources. Furthermore, the accuracy of manual readings relies heavily on human subjectivity and is easily affected by environmental factors, fatigue, and other influences. Therefore, to improve the efficiency and accuracy of pointer readings and reduce labor costs, researchers have proposed automatic reading methods for pointer instruments.
[0003] In related technologies, a camera installed at a fixed position opposite to the instrument captures an image of the instrument, and the captured image is then identified to detect the instrument's pointer and determine the value indicated by the pointer. However, during the pointer detection process, the image may be subject to glare, tilt, or high noise, resulting in poor pointer detection accuracy and affecting the accuracy of automatic readings. Summary of the Invention
[0004] The purpose of this invention is to provide a pointer detection method, system, and electronic device to improve the accuracy of pointer detection, thereby improving the accuracy of automatic reading. The specific technical solution is as follows:
[0005] In a first aspect, embodiments of the present invention provide a pointer detection method, the method comprising:
[0006] Edge features are extracted from the image of the pointer to be detected to obtain each sample point;
[0007] Multiple projection directions are determined in the image to be detected regarding the pointer to be detected; wherein the lines containing the multiple projection directions intersect at the target point;
[0008] For each projection direction, determine the distance between the projection point of each sample point in that projection direction and the target point, and determine the number of distances within each preset distance interval in each of the obtained distances;
[0009] Among all the obtained quantities, determine the target distance interval and target projection direction to which the largest quantity belongs;
[0010] A target pointer is obtained by performing linear fitting on each target sample point; wherein, the target sample point is a sample point whose distance between the projection point on the target projection direction and the target point is within the target distance interval.
[0011] Optionally, in one specific implementation, before determining multiple projection directions regarding the pointer to be detected in the image to be detected, the method further includes:
[0012] When the redundant region in the image to be detected does not meet the preset detection requirements, the region of interest including the pointer to be detected is extracted from the image to be detected;
[0013] Determining multiple projection directions in the image to be detected regarding the pointer to be detected includes:
[0014] Determine multiple projection directions with respect to the pointer to be detected within the region of interest;
[0015] Determining the distance between the projection point of each sample point and the target point in each projection direction includes:
[0016] For each projection direction, determine the distance between the projection point of each sample point located within the region of interest and the target point in that projection direction.
[0017] Optionally, in one specific implementation, the image to be detected is rectangular; when the redundant region in the image to be detected does not meet the preset detection requirements, extracting the region of interest (ROI) in the image to be detected, including the region of interest (ROI) with the detection pointer, includes:
[0018] When the aspect ratio of the image to be detected is greater than a preset value, the region of interest including the pointer to be detected is extracted from the image to be detected.
[0019] Optionally, in one specific implementation, extracting the region of interest (ROI) in the image to be detected, including the region of interest (ROI) with the pointer to be detected, includes:
[0020] Based on a preset ratio, a connection point is determined on each side of the image to be detected.
[0021] Two designated straight lines are identified, each including two points to be connected and having the same tilt direction as the pointer to be detected; wherein the different designated straight lines include different points to be connected.
[0022] The polygonal region formed by the edges of the two specified straight lines is defined as the region of interest including the pointer to be detected.
[0023] Optionally, in one specific implementation, the image to be detected is rectangular; determining multiple projection directions in the image to be detected regarding the pointer to be detected includes:
[0024] Identify a designated diagonal line in the image to be detected that has the same tilt direction as the pointer to be detected;
[0025] Using the direction of the perpendicular line of the specified diagonal as the reference direction, and according to the preset angle difference, a specified number of target directions are determined sequentially along the clockwise and counterclockwise directions respectively;
[0026] The reference direction and the specified number of target directions are determined as multiple projection directions about the pointer to be detected.
[0027] Optionally, in one specific implementation, the step of performing linear fitting on each target sample point to obtain the target pointer includes:
[0028] The least squares method is used to fit each target sample point to obtain the target pointer.
[0029] Optionally, in one specific implementation, the method further includes:
[0030] Determine the value indicated by the target pointer to obtain the target value to be read.
[0031] Secondly, embodiments of the present invention provide a pointer detection system, the system comprising:
[0032] An image acquisition device is used to acquire an image of the pointer to be detected.
[0033] A processor is configured to extract edge features from an image of a pointer to be detected, obtaining sample points; determine multiple projection directions of the pointer to be detected in the image of the pointer to be detected; wherein the lines containing the multiple projection directions intersect at a target point; for each projection direction, determine the distance between the projection point of each sample point in that projection direction and the target point, and determine the number of distances within each preset distance interval among the obtained distances; among all the obtained distances, determine the target distance interval and target projection direction to which the maximum number belongs; perform line fitting on each target sample point to obtain the target pointer; wherein the target sample point is a sample point whose distance between the projection point in the target projection direction and the target point is located within the target distance interval.
[0034] Optionally, in one specific implementation, the processor is further configured to:
[0035] Before determining multiple projection directions of the pointer to be detected in the image to be detected, when the redundant regions in the image to be detected do not meet the preset detection requirements, the region of interest including the pointer to be detected in the image to be detected is extracted.
[0036] The processor is specifically used for:
[0037] Determine multiple projection directions with respect to the pointer to be detected within the region of interest;
[0038] The processor is specifically used for:
[0039] For each projection direction, determine the distance between the projection point of each sample point located within the region of interest and the target point in that projection direction.
[0040] Optionally, in one specific implementation, the image to be detected is rectangular; the processor is specifically used for:
[0041] When the aspect ratio of the image to be detected is greater than a preset value, the region of interest including the pointer to be detected is extracted from the image to be detected.
[0042] Optionally, in one specific implementation, the processor is specifically used for:
[0043] Based on a preset ratio, a connection point is determined on each side of the image to be detected.
[0044] Two designated straight lines are identified, each including two points to be connected and having the same tilt direction as the pointer to be detected; wherein the different designated straight lines include different points to be connected.
[0045] The polygonal region formed by the edges of the two specified straight lines is defined as the region of interest including the pointer to be detected.
[0046] Optionally, in one specific implementation, the image to be detected is rectangular; the processor is specifically used for:
[0047] Identify a designated diagonal line in the image to be detected that has the same tilt direction as the pointer to be detected;
[0048] Using the direction of the perpendicular line of the specified diagonal as the reference direction, and according to the preset angle difference, a specified number of target directions are determined sequentially along the clockwise and counterclockwise directions respectively;
[0049] The reference direction and the specified number of target directions are determined as multiple projection directions about the pointer to be detected.
[0050] Optionally, in one specific implementation, the processor is specifically used for:
[0051] The least squares method is used to fit each target sample point to obtain the target pointer.
[0052] Optionally, in one specific implementation, the processor is further configured to:
[0053] Determine the value indicated by the target pointer to obtain the target value to be read.
[0054] Thirdly, embodiments of the present invention provide a pointer detection device, the device comprising:
[0055] The sample point acquisition module is used to extract edge features from the image to be detected regarding the pointer to be detected, and obtain each sample point;
[0056] A projection direction determination module is used to determine multiple projection directions about the pointer to be detected in the image to be detected; wherein the lines containing the multiple projection directions intersect at the target point;
[0057] The quantity determination module is used to determine the distance between the projection point of each sample point and the target point in each projection direction, and to determine the number of distances located in each preset distance interval among the obtained distances.
[0058] The target determination module is used to determine the target distance range and target projection direction of the largest number among all the obtained numbers;
[0059] The target pointer acquisition module is used to perform linear fitting on each target sample point to obtain the target pointer; wherein, the target sample point is: a sample point whose distance between the projection point on the target projection direction and the target point is located in the target distance interval.
[0060] Optionally, in one specific implementation, the apparatus further includes:
[0061] The region of interest extraction module is used to extract the region of interest (ROI) including the pointer in the image to be detected before determining multiple projection directions of the pointer to be detected in the image to be detected, when the redundant regions in the image to be detected do not meet the preset detection requirements.
[0062] The projection direction determination module is specifically used for:
[0063] Determine multiple projection directions with respect to the pointer to be detected within the region of interest;
[0064] The quantity determination module is specifically used for:
[0065] For each projection direction, determine the distance between the projection point of each sample point located within the region of interest and the target point in that projection direction.
[0066] Optionally, in one specific implementation, the image to be detected is rectangular; the region of interest extraction module is specifically used for:
[0067] When the aspect ratio of the image to be detected is greater than a preset value, the region of interest including the pointer to be detected is extracted from the image to be detected.
[0068] Optionally, in one specific implementation, the region of interest extraction module is specifically used for:
[0069] Based on a preset ratio, a connection point is determined on each side of the image to be detected.
[0070] Two designated straight lines are identified, each including two points to be connected and having the same tilt direction as the pointer to be detected; wherein the different designated straight lines include different points to be connected.
[0071] The polygonal region formed by the edges of the two specified straight lines is defined as the region of interest including the pointer to be detected.
[0072] Optionally, in one specific implementation, the image to be detected is rectangular; the projection direction determination module 720 is specifically used for:
[0073] Identify a designated diagonal line in the image to be detected that has the same tilt direction as the pointer to be detected;
[0074] Using the direction of the perpendicular line of the specified diagonal as the reference direction, and according to the preset angle difference, a specified number of target directions are determined sequentially along the clockwise and counterclockwise directions respectively;
[0075] The reference direction and the specified number of target directions are determined as multiple projection directions about the pointer to be detected.
[0076] Optionally, in one specific implementation, the target pointer acquisition module 750 is specifically used for:
[0077] The least squares method is used to fit each target sample point to obtain the target pointer.
[0078] Optionally, in one specific implementation, the apparatus further includes:
[0079] The target value determination module is used to determine the value indicated by the target pointer to obtain the target value to be read.
[0080] Fourthly, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0081] Memory, used to store computer programs;
[0082] When a processor executes a program stored in memory, it implements the method steps of any of the pointer detection methods provided in the first aspect above.
[0083] Fifthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the method steps of any of the pointer detection methods provided in the first aspect.
[0084] In a sixth aspect, embodiments of the present invention provide a computer program product containing instructions that, when run on a computer, cause the computer to execute the method steps of any of the pointer detection methods provided in the first aspect.
[0085] Beneficial effects of the embodiments of the present invention:
[0086] As can be seen from the above, by applying the solution provided in this embodiment of the invention, before detecting the pointer, multiple distance spaces can be pre-set based on prior experience, and each distance in each distance space is: the distance between the projection point of each sample point in each projection direction and the target point where the lines of multiple projection directions intersect. Therefore, when detecting the pointer, edge features can be extracted from the image to be detected regarding the pointer to be detected to obtain each sample point. Then, multiple projection directions regarding the pointer to be detected can be determined in the image to be detected. Next, for each projection direction, the distance between the projection point of each sample point in that projection direction and the target point is determined, and the number of distances in each preset distance interval is determined among the obtained distances. Thus, among all the obtained numbers, the target distance interval and target projection direction to which the largest number belongs are determined, and a straight line is fitted to each target sample point whose distance between the projection point in the target projection direction and the target point is located in the target distance interval to obtain the target pointer.
[0087] Based on this, by applying the solution provided in the embodiments of the present invention, since in an ideal state, when projecting each point on the pointer, the projection points of each point in the projection direction perpendicular to the pointer are relatively concentrated, the distance difference between the projected points and the target point is small when the above-mentioned points are projected in the projection direction perpendicular to the pointer.
[0088] In other words, for each sample point of the extracted pointer to be detected, since the sample points are concentrated near the pointer, when projecting each sample point of the pointer to be detected, the projected points of the sample points near the pointer can be concentrated in a small area in each projection direction. Therefore, the distances between the projected points of the sample points near the pointer and the target points where the lines of multiple projection directions intersect can be concentrated within a small distance range. Thus, for each projection direction, if there are a large number of sample points within the same preset distance interval, these sample points are more likely to be close to the pointer to be detected. Therefore, using these sample points for line fitting, the resulting line can more closely approximate the line where the pointer to be detected is located. Consequently, using this obtained line as the line where the pointer to be detected is highly accurate in identifying the target pointer.
[0089] In this way, by performing linear fitting on each sample point in the preset distance interval containing the most sample points to obtain the target pointer, the interference of the image to be detected, such as reflection, tilt, and noise, on the pointer detection can be reduced when directly detecting the pointer. This improves the accuracy of pointer detection, thereby improving the accuracy of automatic reading. Furthermore, it can further improve the robustness and stability of pointer detection. Attached Figure Description
[0090] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0091] Figure 1(a) is a schematic diagram of a barometer provided in an embodiment of the present invention;
[0092] Figure 1(b) is a schematic diagram of a temperature gauge provided in an embodiment of the present invention;
[0093] Figure 1(c) is a schematic diagram of a pressure gauge provided in an embodiment of the present invention;
[0094] Figure 2 This is a flowchart illustrating a pointer detection method provided in an embodiment of the present invention;
[0095] Figure 3 A diagram of a specified coordinate system drawn based on the image to be detected;
[0096] Figure 4 Ideally, this would be a frequency histogram with two peak values.
[0097] Figure 5 A diagram illustrating how the region of interest is determined;
[0098] Figure 6 A flowchart illustrating a specific embodiment of the present invention;
[0099] Figure 7 This is a schematic diagram of the structure of a pointer detection device provided in an embodiment of the present invention;
[0100] Figure 8 This is a schematic diagram of the structure of a pointer detection system provided in an embodiment of the present invention;
[0101] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0102] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of the present invention.
[0103] In related technologies, a camera installed at a fixed position opposite to the instrument captures an image of the instrument, and the captured image is then identified to detect the instrument's pointer and determine the value indicated by the pointer. However, during the pointer detection process, the image may be subject to glare, tilt, or high noise, resulting in poor pointer detection accuracy and affecting the accuracy of automatic readings.
[0104] To address the aforementioned technical problems, embodiments of the present invention provide a pointer detection method.
[0105] This method is applicable to various applications requiring readings of pointer-type instruments. For example, in chemical production, it can be used to monitor furnace pressure using a pressure gauge. Another example is in tunnel surveying, where a barometer is used to monitor air pressure within a tunnel. Furthermore, this method can be applied to various electronic devices such as laptops, tablets, and desktop computers (hereinafter referred to as electronic devices). Therefore, this embodiment of the invention does not limit the application scenarios or the executing entity of the method.
[0106] An embodiment of the present invention provides a pointer detection method, which may include the following steps:
[0107] Edge features are extracted from the image of the pointer to be detected to obtain each sample point;
[0108] Multiple projection directions are determined in the image to be detected regarding the pointer to be detected; wherein the lines containing the multiple projection directions intersect at the target point;
[0109] For each projection direction, determine the distance between the projection point of each sample point in that projection direction and the target point, and determine the number of distances within each preset distance interval in each of the obtained distances;
[0110] Among all the obtained quantities, determine the target distance interval and target projection direction to which the largest quantity belongs;
[0111] A target pointer is obtained by performing linear fitting on each target sample point; wherein, the target sample point is a sample point whose distance between the projection point on the target projection direction and the target point is within the target distance interval.
[0112] As can be seen from the above, by applying the solution provided in this embodiment of the invention, before detecting the pointer, multiple distance spaces can be pre-set based on prior experience, and each distance in each distance space is: the distance between the projection point of each sample point in each projection direction and the target point where the lines of multiple projection directions intersect. Therefore, when detecting the pointer, edge features can be extracted from the image to be detected regarding the pointer to be detected to obtain each sample point. Then, multiple projection directions regarding the pointer to be detected can be determined in the image to be detected. Next, for each projection direction, the distance between the projection point of each sample point in that projection direction and the target point is determined, and the number of distances in each preset distance interval is determined among the obtained distances. Thus, among all the obtained numbers, the target distance interval and target projection direction to which the largest number belongs are determined, and a straight line is fitted to each target sample point whose distance between the projection point in the target projection direction and the target point is located in the target distance interval to obtain the target pointer.
[0113] Based on this, by applying the solution provided in the embodiments of the present invention, since in an ideal state, when projecting each point on the pointer, the projection points of each point in the projection direction perpendicular to the pointer are relatively concentrated, the distance difference between the projected points and the target point is small when the above-mentioned points are projected in the projection direction perpendicular to the pointer.
[0114] In other words, for each sample point of the extracted pointer to be detected, since the sample points are concentrated near the pointer, when projecting each sample point of the pointer to be detected, the projected points of the sample points near the pointer can be concentrated in a small area in each projection direction. Therefore, the distances between the projected points of the sample points near the pointer and the target points where the lines of multiple projection directions intersect can be concentrated within a small distance range. Thus, for each projection direction, if there are a large number of sample points within the same preset distance interval, these sample points are more likely to be close to the pointer to be detected. Therefore, using these sample points for line fitting, the resulting line can more closely approximate the line where the pointer to be detected is located. Consequently, using this obtained line as the line where the pointer to be detected is highly accurate in identifying the target pointer.
[0115] In this way, by performing linear fitting on each sample point in the preset distance interval containing the most sample points to obtain the target pointer, the interference of the image to be detected, such as reflection, tilt, and noise, on the pointer detection can be reduced when directly detecting the pointer. This improves the accuracy of pointer detection, thereby improving the accuracy of automatic reading. Furthermore, it can further improve the robustness and stability of pointer detection.
[0116] The pointer detection method provided by the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0117] Figure 2 This is a flowchart illustrating a pointer detection method provided in an embodiment of the present invention, as shown below. Figure 2 As shown, the method includes the following steps S201-S205:
[0118] S201: Extract edge features from the image to be detected regarding the pointer to be detected, and obtain each sample point.
[0119] When testing the pointer to be tested, the dial image of the pointer instrument to which the pointer to be tested belongs can be obtained first, and the obtained dial image can be used for image detection. The area image of the region where the pointer to be tested is located is used as the image to be tested for the pointer to be tested.
[0120] The acquired dial image can be detected using methods such as Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), and machine learning to obtain the image to be detected for the aforementioned pointer. This embodiment of the invention does not specifically limit the scope of the detection.
[0121] For example, the CenterNet network (object detection network) can be used to perform image detection on the acquired dial image to obtain the image of the pointer to be detected.
[0122] Before using the CenterNet network for image detection, multiple sample images of the dial can be pre-acquired, and each sample image can be labeled with a sample label to represent the area where the pointer is located.
[0123] In the process of training the CenterNet network, the electronic device used for model training can pre-build an initial model, and then input the sample images into the initial model for training, thereby obtaining the CenterNet network.
[0124] During training, the initial model can learn the image features of each sample image and output the labels of each sample. After learning from a large number of sample images, the initial model gradually establishes the correspondence between image features and pointer detection results, thus obtaining the pointer detection model.
[0125] Training can be stopped when the initial model meets preset conditions, resulting in the CenterNet network. For example, these preset conditions could be that the number of iterations for each sample image reaches a preset number, or that the error between the ground truth and predicted values of the sample labels for each sample image is less than a preset error. This embodiment of the invention does not specifically limit these conditions.
[0126] In this way, after obtaining the dial image of the pointer-type instrument to which the pointer to be detected belongs, the dial image can be directly input into the CenterNet network. The CenterNet network can then learn from the dial image to obtain its image features. Furthermore, by utilizing the established correspondence between the image features and the detection results of the CenterNet network, the detection result corresponding to the dial image is obtained, which is the region image of the area where the pointer to be detected is located. This detection result is then used as the image to be detected for the pointer to be detected.
[0127] In this way, edge features can be extracted from the image to be detected, thereby obtaining each sample point of the pointer to be detected.
[0128] For example, edge features are extracted from the above-mentioned image to be detected by using histogram equalization, Gaussian filtering and Canny edge detection operators respectively, to obtain each sample point of the above-mentioned pointer to be detected.
[0129] S202: Determine multiple projection directions about the pointer to be detected in the image to be detected.
[0130] Among them, the lines containing multiple projection directions intersect at the target point.
[0131] Thus, after obtaining the image to be detected, multiple projection directions of the pointer to be detected can be determined in the image, wherein the lines containing the multiple projection directions intersect at the target point.
[0132] Furthermore, the angle difference between two adjacent projection directions can be the same or different, and the embodiments of the present invention do not specifically limit this.
[0133] Optionally, after obtaining the above-mentioned image to be detected, multiple projection directions of the above-mentioned pointer to be detected can be determined in the above-mentioned image to be detected according to a preset initial angle difference.
[0134] Optionally, after obtaining the above-mentioned image to be detected, multiple projection directions of the above-mentioned pointer to be detected can be determined in the above-mentioned image to be detected based on a preset initial angle difference and according to the decreasing trend of the angle difference.
[0135] Optionally, after obtaining the above-mentioned image to be detected, multiple projection directions of the above-mentioned pointer to be detected can be determined in the above-mentioned image to be detected based on a preset initial angle difference and according to the increasing trend of the angle difference.
[0136] Typically, the acquired image to be detected is rectangular. Based on this, in one optional implementation, when the image to be detected is rectangular, step S202 above may include the following steps 2021-2023:
[0137] Step 2021: Determine the specified diagonal line in the image to be detected that is in the same tilt direction as the pointer to be detected;
[0138] Step 2022: Using the direction of the perpendicular line of the specified diagonal as the reference direction, determine a specified number of target directions in a clockwise and counterclockwise direction according to the preset angle difference;
[0139] Step 2023: Determine the reference direction and a specified number of target directions as multiple projection directions about the pointer to be detected.
[0140] In this specific implementation, when the acquired image to be detected is rectangular, ideally, the positional relationship between the aforementioned pointer to be detected and a certain diagonal line in the image to be detected can be parallel, or even coincident. However, in practice, the sample points of the aforementioned pointer to be detected are mainly distributed near the image diagonal line with the same tilt direction as the aforementioned pointer to be detected.
[0141] Therefore, when the image to be detected is rectangular, after obtaining the image to be detected, the tilt direction of the pointer to be detected can be determined based on the distribution trend of each sample point.
[0142] For example, if the distribution trend of each sample point extends from the upper left corner of the image to the lower right corner of the image to be detected, then the tilt direction of the above-mentioned pointer to be detected is: tilted to the left; if the distribution trend of each sample point extends from the upper right corner of the image to the lower left corner of the image to be detected, then the tilt direction of the above-mentioned pointer to be detected is: tilted to the right.
[0143] Thus, after determining the tilt direction of the pointer to be detected, a designated diagonal line with the same tilt direction as the pointer to be detected can be determined in the image to be detected.
[0144] Then, taking the direction of the perpendicular line of the specified diagonal as the reference direction, a specified number of target directions can be determined sequentially along clockwise and counterclockwise directions according to the preset angle difference. The reference direction and the specified number of target directions are then determined as multiple projection directions about the pointer to be detected, thereby increasing the number and effectiveness of the acquired sample points, and thus improving the accuracy of pointer detection.
[0145] Optionally, using the direction perpendicular to the specified diagonal as the reference direction, and any point on the specified diagonal as the center of rotation, rotate clockwise. After rotating to a preset angle difference, the direction reached is determined as the first target direction. Then, based on the first target direction, continue rotating clockwise. After rotating to a preset angle difference, the direction reached is determined as the second target direction. Then, based on the second target direction, continue rotating clockwise. After rotating to a preset angle difference, the direction reached is determined as the third target direction. And so on, to obtain each target direction in the clockwise direction.
[0146] Correspondingly, the process of determining each target direction by rotating in a counterclockwise and clockwise direction with the direction of the perpendicular line of the specified diagonal as the reference direction and any point of the specified perpendicular line as the center of rotation is the same as the process of determining each target direction by rotating in a clockwise direction with the direction of the perpendicular line of the specified diagonal as the reference direction and any point of the specified perpendicular line as the center of rotation, and will not be repeated here.
[0147] The rotation center can be any point on the vertical line, or it can be the intersection point of the vertical line and the image to be detected. This embodiment of the invention does not impose specific limitations on this.
[0148] For example, such as Figure 3As shown, a specified coordinate system is drawn based on the image to be detected. Quadrilateral 300 represents the pointer to be detected; rectangle 301 represents the image to be detected; dashed line hw represents the specified diagonal; line l is the perpendicular line to the specified diagonal; and the direction of line l is the reference direction. D j Let O be a target direction, and let angle a be the preset angle difference between the reference direction and the target direction. Let point O be the rotation center.
[0149] S203: For each projection direction, determine the distance between the projection point of each sample point and the target point in that projection direction, and determine the number of distances located in each preset distance interval among the obtained distances;
[0150] S204: Among all the obtained quantities, determine the target distance interval and target projection direction to which the largest quantity belongs.
[0151] Before detecting the pointer, multiple distance spaces can be pre-set based on prior experience, and each distance in each distance space is: the distance between the projection point of each sample point in each projection direction and the target point.
[0152] Therefore, after determining multiple projection directions of the pointer to be detected in the image, the projection point of each sample point in that projection direction can be determined for each projection direction, and the distance between each projection point and the target point can be determined.
[0153] In this way, the number of spaces located at each preset distance can be determined based on the obtained distances.
[0154] The more distances that are located in the same preset distance space, the greater the probability that the pointer to be detected is in that projection direction, and the higher the probability that the pointer to be detected is, thereby improving the accuracy of pointer detection.
[0155] In this way, for each projection direction, after determining the number of distances within each preset distance interval among the obtained distances, the target distance interval and target projection direction to which the maximum number belongs can be determined from all the obtained numbers.
[0156] Since the pointer to be detected is composed of two edges, ideally, the distance of the pointer to be detected has two peaks in the same preset distance space. However, in real-world environments, the image to be detected may have reflections, tilt, or high noise levels, which can interfere with or even obscure one of the peaks. Therefore, among all the obtained values, the target distance interval and target projection direction to which the maximum value belongs can be determined.
[0157] For example, such as Figure 4The image shows a frequency histogram under ideal conditions, including two peak values. Wherein, V... L V represents the left edge of the pointer to be detected. R The left edge of the pointer to be detected.
[0158] However, in real-world environments, the image to be detected may exhibit glare, tilt, or high noise levels, which can interfere with or even obscure one of the peak values.
[0159] Optionally, for each projection direction, a frequency histogram can be plotted with a preset distance interval as the horizontal axis and the distance quantity as the vertical axis. Among the frequency histograms corresponding to each projection direction, the frequency histogram containing the highest peak value is selected. Thus, the projection direction corresponding to this frequency histogram can be determined as the target projection direction, and the preset distance interval corresponding to the highest peak value can be determined as the target distance interval.
[0160] S205: Perform linear fitting on each target sample point to obtain the target pointer;
[0161] Among them, the target sample point is: the sample point whose distance between the projection point and the target point in the target projection direction is within the target distance interval.
[0162] After determining the target distance interval and target projection direction to which the maximum number belongs, each sample point whose distance between the projection point and the target point in the target projection direction is located in the target distance interval can be identified as a target sample point. Then, a straight line fit is performed on each of the target sample points to obtain the target pointer corresponding to the pointer to be detected.
[0163] Optionally, in one specific implementation, step S205 may include the following step 2051:
[0164] Step 2051: Use the least squares method to fit each target sample point to obtain the target pointer.
[0165] In this specific implementation, after obtaining each target sample point, the least squares method can be used to fit each target sample point to obtain the target pointer corresponding to the above-mentioned pointer to be detected.
[0166] Optionally, in one specific implementation, the pointer detection method provided in this embodiment of the invention may further include step 206:
[0167] Step 206: Determine the value indicated by the target pointer to obtain the target value to be read.
[0168] In this specific implementation, after performing linear fitting on each target sample point to obtain the target pointer, the data indicated by the target pointer can be determined in the dial image including the pointer to be detected, based on the obtained target pointer, thereby obtaining the target value to be read.
[0169] Optionally, the value indicated by the target pointer can be determined based on the direction pointed to by the target pointer, the start and end positions, the dial value distribution of the pointer instrument to which the target pointer belongs, and the unit setting of the pointer instrument to which the target pointer belongs, thereby obtaining the target value to be read corresponding to the target pointer.
[0170] Optionally, simulation technology can be used to simulate the dial of the pointer-type instrument to which the target pointer belongs, and the target value to be read corresponding to the target pointer can be determined in the simulated dial according to the direction pointed to by the detected target pointer.
[0171] Optionally, after obtaining the target value to be read, the target value can be output.
[0172] The output method of the target value may include at least one of the following: text output, voice playback, or sending to a specified account of a specified user. This embodiment of the invention does not specifically limit this method.
[0173] As can be seen from the above, by applying the solution provided in this embodiment of the invention, before detecting the pointer, multiple distance spaces can be pre-set based on prior experience, and each distance in each distance space is: the distance between the projection point of each sample point in each projection direction and the target point where the lines of multiple projection directions intersect. Therefore, when detecting the pointer, edge features can be extracted from the image to be detected regarding the pointer to be detected to obtain each sample point. Then, multiple projection directions regarding the pointer to be detected can be determined in the image to be detected. Next, for each projection direction, the distance between the projection point of each sample point in that projection direction and the target point is determined, and the number of distances in each preset distance interval is determined among the obtained distances. Thus, among all the obtained numbers, the target distance interval and target projection direction to which the largest number belongs are determined, and a straight line is fitted to each target sample point whose distance between the projection point in the target projection direction and the target point is located in the target distance interval to obtain the target pointer.
[0174] Based on this, by applying the solution provided in the embodiments of the present invention, since in an ideal state, when projecting each point on the pointer, the projection points of each point in the projection direction perpendicular to the pointer are relatively concentrated, the distance difference between the projected points and the target point is small when the above-mentioned points are projected in the projection direction perpendicular to the pointer.
[0175] In other words, for each sample point of the extracted pointer to be detected, since the sample points are concentrated near the pointer, when projecting each sample point of the pointer to be detected, the projected points of the sample points near the pointer can be concentrated in a small area in each projection direction. Therefore, the distances between the projected points of the sample points near the pointer and the target points where the lines of multiple projection directions intersect can be concentrated within a small distance range. Thus, for each projection direction, if there are a large number of sample points within the same preset distance interval, these sample points are more likely to be close to the pointer to be detected. Therefore, using these sample points for line fitting, the resulting line can more closely approximate the line where the pointer to be detected is located. Consequently, using this obtained line as the line where the pointer to be detected is highly accurate in identifying the target pointer.
[0176] In this way, by performing linear fitting on each sample point in the preset distance interval containing the most sample points to obtain the target pointer, the interference of the image to be detected, such as reflection, tilt, and noise, on the pointer detection can be reduced when directly detecting the pointer. This improves the accuracy of pointer detection, thereby improving the accuracy of automatic reading. Furthermore, it can further improve the robustness and stability of pointer detection.
[0177] Since the acquired image of the pointer to be detected still contains redundant regions that may interfere with pointer detection, the image can be preprocessed before step S202: determining multiple projection directions of the pointer to be detected in the image to be detected. This reduces the interference of redundant regions on pointer detection, thereby improving the accuracy of pointer detection.
[0178] Based on this, optionally, in one specific implementation, before step S202 above, the pointer detection method provided by the embodiments of the present invention may further include the following step 11:
[0179] Step 11: When the redundant regions in the image to be detected do not meet the preset detection requirements, extract the region of interest in the image to be detected, including the pointer to be detected.
[0180] Accordingly, step S202 above may include step 12:
[0181] Step 12: Determine multiple projection directions about the pointer to be detected in the region of interest.
[0182] In step S203 above, determining the distance between the projection point of each sample point and the target point in each projection direction can include step 13:
[0183] Step 13: For each projection direction, determine the distance between the projection point of each sample point located in the region of interest and the target point in that projection direction.
[0184] In this specific implementation, after obtaining the image to be detected, the redundant regions in the image to be detected can be determined using preset detection requirements to determine whether they meet the preset detection requirements.
[0185] If the redundant regions in the image to be detected do not meet the preset detection requirements, it indicates that the redundant regions will affect the accuracy of pointer detection. Therefore, the region of interest including the pointer to be detected can be extracted from the image to be detected.
[0186] If the redundant regions in the image to be detected meet the preset detection requirements, it indicates that the redundant regions will not affect the accuracy of pointer detection. Therefore, the image to be detected can be identified as the region of interest.
[0187] In this way, by processing the image to be detected, the interference of redundant areas on pointer detection is reduced, thereby improving the accuracy of pointer detection.
[0188] Then, within the defined region of interest, multiple projection directions for the pointer to be detected can be determined, and for each projection direction, the projection point of each sample point within the region of interest in that projection direction can be determined, and the distance between each projection point and the target point can be determined.
[0189] To facilitate the extraction of the region of interest (ROI) including the pointer to be detected in the image to be detected, thereby improving the efficiency of pointer detection, optionally, in one specific implementation, when the image to be detected is rectangular, step 11 above may include the following step 21:
[0190] Step 21: When the aspect ratio of the image to be detected is greater than a preset value, extract the region of interest (ROI) in the image to be detected, including the pointer to be detected.
[0191] In this specific implementation, the aspect ratio of the image to be detected can reflect the degree of influence of the redundant region in the image on pointer detection. When the aspect ratio is large, the redundant region has a greater impact on pointer detection, and when the aspect ratio is small, the redundant region has a smaller impact on pointer detection.
[0192] Therefore, preset values can be set in advance. In this way, when the aspect ratio of the image to be detected is greater than the above preset value, it indicates that the above redundant area will affect the accuracy of pointer detection, and the region of interest including the pointer to be detected can be extracted from the image to be detected; when the aspect ratio of the image to be detected is not greater than the above preset value, it indicates that the above redundant area will not affect the accuracy of pointer detection, and the region of interest can be identified in the image to be detected.
[0193] Optionally, in one specific implementation, step 21 above, the step of extracting the region of interest (ROI) in the image to be detected, which includes the pointer to be detected, may include the following steps 31-33:
[0194] Step 31: Based on a preset ratio, determine a connection point on each edge of the image to be detected;
[0195] Step 32: Determine two specified straight lines, each containing two points to be connected and in the same direction of inclination as the pointer to be detected; wherein, different specified straight lines contain different points to be connected;
[0196] Step 33: Determine the polygonal region consisting of the edges of the two specified lines as the region of interest including the pointer to be detected.
[0197] In this specific implementation, when the aspect ratio of the image to be detected is greater than a preset value, a connection point can be determined in each of the images to be detected based on the preset ratio. Based on each connection point and the tilt direction of the pointer to be detected, two specified straight lines, each including two connection points and having the same tilt direction, are determined.
[0198] Different specified lines include different points to be connected.
[0199] In this way, the polygonal region formed by the sides of the two specified straight lines in the image to be detected can be identified as the region of interest including the pointer to be detected.
[0200] For example, such as Figure 5 The diagram illustrates how the region of interest is determined. Lines l1 and l2 are two designated lines.
[0201] Figure 5In the image to be detected 301, based on a preset ratio, point b1 is determined to be connected on edge oh; point b2 is determined to be connected on edge hk; point b3 is determined to be connected on edge kw; and point b4 is determined to be connected on edge ow. Since different specified lines include different points to be connected, and the specified line is determined by including two points to be connected and having the same tilt direction as the aforementioned pointer to be detected, after determining the tilt direction of the pointer to be detected, points b2 and b3 can be connected to obtain line l1, and points b1 and b4 can be connected to obtain line l2.
[0202] Therefore, the polygonal region 302 formed by points b1, h, b2, b3, w, and b4 can be determined as the region of interest including the pointer to be detected.
[0203] To facilitate understanding of the pointer detection method provided in this embodiment of the invention, a specific embodiment will be used to illustrate the invention below.
[0204] like Figure 6 The diagram shown is a flowchart illustrating a specific embodiment of the present invention.
[0205] After preprocessing the acquired image to be detected—that is, using the CenterNet network to perform image detection on the acquired dial image to obtain the image of the pointer to be detected—edge features can be extracted from the image to obtain each sample point in the image to be detected. Then, it is determined whether the aspect ratio of the image to be detected is not greater than a preset value of 0.35.
[0206] If the aspect ratio of the image to be detected is greater than the preset value of 0.35, it indicates that the redundant area in the image to be detected will interfere with the pointer detection. Therefore, a region of interest can be set in the area to be detected, and M projection directions can be determined based on the image diagonal line of the image to be detected.
[0207] If the aspect ratio of the image to be detected is not greater than the preset value of 0.35, it indicates that the redundant area in the image to be detected will not affect the pointer detection. Therefore, the image diagonal line of the image to be detected can be used as a reference to determine M projection directions.
[0208] Secondly, by projecting each sample point sequentially onto each projection direction, a projection histogram of the projection interval and frequency can be obtained.
[0209] Let j=1, and use each sample point to project towards the first projection direction, and record the number of times the distance between each sample point and the target point where the projection point of that projection direction intersects the line containing each projection direction falls within the preset distance interval.
[0210] Let j = j + 1, then the original value of j is increased by 1 to obtain the updated value of j. In this way, each sample point can be used to project for the next projection direction, and the number of times the distance between each sample point and the target point where the projection point of the projection direction intersects the line of each projection direction falls within the preset distance interval can be recorded.
[0211] If j≤M, it indicates that there is a projection direction that has not been projected, that is, the sample point has not been projected onto the updated j-th projection direction. In this case, we can return to the above steps of projecting each sample point onto each projection direction in turn, and use each sample point to project onto the updated j-th projection direction.
[0212] The above steps are executed sequentially until the number of sample points in each of the M projection directions and the target points where the distances between the projected points in that projection direction and the lines in each projection direction intersect within the preset distance range is recorded.
[0213] Then, based on the recorded histograms, the frequency histogram with the highest peak can be selected. Thus, the projection direction corresponding to the frequency histogram can be determined as the target projection direction, the preset distance interval corresponding to the highest peak can be determined as the target distance interval, and each sample point whose distance between the projection point and the target point on the target projection direction is located in the target distance interval can be determined as each target sample point.
[0214] In this way, after obtaining each target sample point, the least squares method can be used to fit each target sample point to obtain the target pointer.
[0215] Corresponding to the pointer detection method provided in the above embodiments of the present invention, the present invention also provides a pointer detection device.
[0216] Figure 7 This is a schematic diagram of the structure of a pointer detection device provided in an embodiment of the present invention, as shown below. Figure 7 As shown, the device may include the following modules:
[0217] The sample point acquisition module 710 is used to extract edge features from the image to be detected about the pointer to be detected, and obtain each sample point;
[0218] The projection direction determination module 720 is used to determine multiple projection directions about the pointer to be detected in the image to be detected; wherein the lines containing the multiple projection directions intersect at the target point;
[0219] The quantity determination module 730 is used to determine the distance between the projection point of each sample point and the target point in each projection direction, and to determine the number of distances located in each preset distance interval among the obtained distances.
[0220] The target determination module 740 is used to determine the target distance range and target projection direction of the largest number among all the obtained numbers;
[0221] The target pointer acquisition module 750 is used to perform linear fitting on each target sample point to obtain the target pointer; wherein, the target sample point is: a sample point whose distance between the projection point on the target projection direction and the target point is located in the target distance interval.
[0222] As can be seen from the above, by applying the solution provided in this embodiment of the invention, before detecting the pointer, multiple distance spaces can be pre-set based on prior experience, and each distance in each distance space is: the distance between the projection point of each sample point in each projection direction and the target point where the lines of multiple projection directions intersect. Therefore, when detecting the pointer, edge features can be extracted from the image to be detected regarding the pointer to be detected to obtain each sample point. Then, multiple projection directions regarding the pointer to be detected can be determined in the image to be detected. Next, for each projection direction, the distance between the projection point of each sample point in that projection direction and the target point is determined, and the number of distances in each preset distance interval is determined among the obtained distances. Thus, among all the obtained numbers, the target distance interval and target projection direction to which the largest number belongs are determined, and a straight line is fitted to each target sample point whose distance between the projection point in the target projection direction and the target point is located in the target distance interval to obtain the target pointer.
[0223] Based on this, by applying the solution provided in the embodiments of the present invention, since in an ideal state, when projecting each point on the pointer, the projection points of each point in the projection direction perpendicular to the pointer are relatively concentrated, the distance difference between the projected points and the target point is small when the above-mentioned points are projected in the projection direction perpendicular to the pointer.
[0224] In other words, for each sample point of the extracted pointer to be detected, since the sample points are concentrated near the pointer, when projecting each sample point of the pointer to be detected, the projected points of the sample points near the pointer can be concentrated in a small area in each projection direction. Therefore, the distances between the projected points of the sample points near the pointer and the target points where the lines of multiple projection directions intersect can be concentrated within a small distance range. Thus, for each projection direction, if there are a large number of sample points within the same preset distance interval, these sample points are more likely to be close to the pointer to be detected. Therefore, using these sample points for line fitting, the resulting line can more closely approximate the line where the pointer to be detected is located. Consequently, using this obtained line as the line where the pointer to be detected is highly accurate in identifying the target pointer.
[0225] In this way, by performing linear fitting on each sample point in the preset distance interval containing the most sample points to obtain the target pointer, the interference of the image to be detected, such as reflection, tilt, and noise, on the pointer detection can be reduced when directly detecting the pointer. This improves the accuracy of pointer detection, thereby improving the accuracy of automatic reading. Furthermore, it can further improve the robustness and stability of pointer detection.
[0226] Optionally, in one specific implementation, the apparatus further includes:
[0227] The region of interest extraction module is used to extract the region of interest (ROI) including the pointer in the image to be detected before determining multiple projection directions of the pointer to be detected in the image to be detected, when the redundant regions in the image to be detected do not meet the preset detection requirements.
[0228] The projection direction determination module 720 is specifically used for:
[0229] Determine multiple projection directions with respect to the pointer to be detected within the region of interest;
[0230] The quantity determination module 730 is specifically used for:
[0231] For each projection direction, determine the distance between the projection point of each sample point located within the region of interest and the target point in that projection direction.
[0232] Optionally, in one specific implementation, the image to be detected is rectangular; the region of interest extraction module is specifically used for:
[0233] When the aspect ratio of the image to be detected is greater than a preset value, the region of interest including the pointer to be detected is extracted from the image to be detected.
[0234] Optionally, in one specific implementation, the region of interest extraction module is specifically used for:
[0235] Based on a preset ratio, a connection point is determined on each side of the image to be detected.
[0236] Two designated straight lines are identified, each including two points to be connected and having the same tilt direction as the pointer to be detected; wherein the different designated straight lines include different points to be connected.
[0237] The polygonal region formed by the edges of the two specified straight lines is defined as the region of interest including the pointer to be detected.
[0238] Optionally, in one specific implementation, the image to be detected is rectangular; the projection direction determination module 720 is specifically used for:
[0239] Identify a designated diagonal line in the image to be detected that has the same tilt direction as the pointer to be detected;
[0240] Using the direction of the perpendicular line of the specified diagonal as the reference direction, and according to the preset angle difference, a specified number of target directions are determined sequentially along the clockwise and counterclockwise directions respectively;
[0241] The reference direction and the specified number of target directions are determined as multiple projection directions about the pointer to be detected.
[0242] Optionally, in one specific implementation, the target pointer acquisition module 750 is specifically used for:
[0243] The least squares method is used to fit each target sample point to obtain the target pointer.
[0244] Optionally, in one specific implementation, the apparatus further includes:
[0245] The target value determination module is used to determine the value indicated by the target pointer to obtain the target value to be read.
[0246] Corresponding to the pointer detection method provided in the above embodiments of the present invention, the present invention also provides a pointer detection system.
[0247] Figure 8 This is a schematic diagram of the structure of a pointer detection system provided in an embodiment of the present invention, as shown below. Figure 8 As shown, the system may include the following modules:
[0248] Image acquisition device 810 is used to acquire an image of the pointer to be detected.
[0249] Processor 820 is configured to extract edge features from a target image of a pointer to be detected, obtaining sample points; determine multiple projection directions of the pointer to be detected in the target image; wherein the lines containing the multiple projection directions intersect at a target point; for each projection direction, determine the distance between the projection point of each sample point in that projection direction and the target point, and determine the number of distances within each preset distance interval among the obtained distances; among all the obtained distances, determine the target distance interval and target projection direction to which the maximum number belongs; perform line fitting on each target sample point to obtain the target pointer; wherein the target sample point is a sample point whose distance between the projection point in the target projection direction and the target point is located within the target distance interval.
[0250] As can be seen from the above, by applying the solution provided in this embodiment of the invention, before detecting the pointer, multiple distance spaces can be pre-set based on prior experience, and each distance in each distance space is: the distance between the projection point of each sample point in each projection direction and the target point where the lines of multiple projection directions intersect. Therefore, when detecting the pointer, edge features can be extracted from the image to be detected regarding the pointer to be detected to obtain each sample point. Then, multiple projection directions regarding the pointer to be detected can be determined in the image to be detected. Next, for each projection direction, the distance between the projection point of each sample point in that projection direction and the target point is determined, and the number of distances in each preset distance interval is determined among the obtained distances. Thus, among all the obtained numbers, the target distance interval and target projection direction to which the largest number belongs are determined, and a straight line is fitted to each target sample point whose distance between the projection point in the target projection direction and the target point is located in the target distance interval to obtain the target pointer.
[0251] Based on this, by applying the solution provided in the embodiments of the present invention, since in an ideal state, when projecting each point on the pointer, the projection points of each point in the projection direction perpendicular to the pointer are relatively concentrated, the distance difference between the projected points and the target point is small when the above-mentioned points are projected in the projection direction perpendicular to the pointer.
[0252] In other words, for each sample point of the extracted pointer to be detected, since the sample points are concentrated near the pointer, when projecting each sample point of the pointer to be detected, the projected points of the sample points near the pointer can be concentrated in a small area in each projection direction. Therefore, the distances between the projected points of the sample points near the pointer and the target points where the lines of multiple projection directions intersect can be concentrated within a small distance range. Thus, for each projection direction, if there are a large number of sample points within the same preset distance interval, these sample points are more likely to be close to the pointer to be detected. Therefore, using these sample points for line fitting, the resulting line can more closely approximate the line where the pointer to be detected is located. Consequently, using this obtained line as the line where the pointer to be detected is highly accurate in identifying the target pointer.
[0253] In this way, by performing linear fitting on each sample point in the preset distance interval containing the most sample points to obtain the target pointer, the interference of the image to be detected, such as reflection, tilt, and noise, on the pointer detection can be reduced when directly detecting the pointer. This improves the accuracy of pointer detection, thereby improving the accuracy of automatic reading. Furthermore, it can further improve the robustness and stability of pointer detection.
[0254] Optionally, in one specific implementation, the processor 820 is further configured to:
[0255] Before determining multiple projection directions of the pointer to be detected in the image to be detected, when the redundant regions in the image to be detected do not meet the preset detection requirements, the region of interest including the pointer to be detected in the image to be detected is extracted.
[0256] The processor 820 is specifically used for:
[0257] Determine multiple projection directions with respect to the pointer to be detected within the region of interest;
[0258] The processor 820 is specifically used for:
[0259] For each projection direction, determine the distance between the projection point of each sample point located within the region of interest and the target point in that projection direction.
[0260] Optionally, in one specific implementation, the image to be detected is rectangular; the processor 720 is specifically used for:
[0261] When the aspect ratio of the image to be detected is greater than a preset value, the region of interest including the pointer to be detected is extracted from the image to be detected.
[0262] Optionally, in one specific implementation, the processor 820 is specifically used for:
[0263] Based on a preset ratio, a connection point is determined on each side of the image to be detected.
[0264] Two designated straight lines are identified, each including two points to be connected and having the same tilt direction as the pointer to be detected; wherein the different designated straight lines include different points to be connected.
[0265] The polygonal region formed by the edges of the two specified straight lines is defined as the region of interest including the pointer to be detected.
[0266] Optionally, in one specific implementation, the image to be detected is rectangular; the processor 820 is specifically used for:
[0267] Identify a designated diagonal line in the image to be detected that has the same tilt direction as the pointer to be detected;
[0268] Using the direction of the perpendicular line of the specified diagonal as the reference direction, and according to the preset angle difference, a specified number of target directions are determined sequentially along the clockwise and counterclockwise directions respectively;
[0269] The reference direction and the specified number of target directions are determined as multiple projection directions about the pointer to be detected.
[0270] Optionally, in one specific implementation, the processor 820 is specifically used for:
[0271] The least squares method is used to fit each target sample point to obtain the target pointer.
[0272] Optionally, in one specific implementation, the processor 820 is further configured to:
[0273] Determine the value indicated by the target pointer to obtain the target value to be read.
[0274] Corresponding to the pointer detection method provided in the embodiments of the present invention, the embodiments of the present invention also provide an electronic device, such as... Figure 9 As shown, it includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904.
[0275] Memory 903 is used to store computer programs;
[0276] When the processor 901 executes the program stored in the memory 903, it implements the steps of any of the pointer detection methods provided in the above embodiments of the present invention.
[0277] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0278] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0279] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0280] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0281] In another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements the steps of any of the pointer detection methods described above.
[0282] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the pointer detection methods described above.
[0283] 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 in the form of 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 the present invention 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)).
[0284] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0285] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments, system embodiments, computer-readable storage medium embodiments, and computer program product embodiments are basically similar to the method embodiments, and therefore the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0286] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A pointer detection method, characterized by, The method comprises: performing edge feature extraction on a to-be-detected image about a to-be-detected pointer to obtain sample points; determining a plurality of projection directions about the to-be-detected pointer in the to-be-detected image; wherein straight lines on which the plurality of projection directions are located intersect at a target point; for each projection direction, determining distances between a projection point of each sample point on the projection direction and the target point, and determining a number of distances located in each preset distance interval from the obtained distances; determining a target distance interval and a target projection direction to which a maximum number belongs from the obtained numbers; performing straight line fitting on each target sample point to obtain a target pointer; wherein the target sample point is a sample point whose distance between the projection point on the target projection direction and the target point is located in the target distance interval; wherein the to-be-detected image is a rectangle; the determining of the plurality of projection directions about the to-be-detected pointer in the to-be-detected image comprises: determining a specified diagonal line in the to-be-detected image which is the same as an inclined direction of the to-be-detected pointer; taking a direction of a perpendicular line of the specified diagonal line as a reference direction, and determining a specified number of target directions in turn along a clockwise direction and an anticlockwise direction according to a preset angle difference; determining the reference direction and the specified number of target directions as the plurality of projection directions about the to-be-detected pointer.
2. The method of claim 1, wherein, Before the determining of the plurality of projection directions about the to-be-detected pointer in the to-be-detected image, the method further comprises: when a redundant area in the to-be-detected image does not meet a preset detection requirement, extracting a region of interest in the to-be-detected image which includes the to-be-detected pointer; the determining of the plurality of projection directions about the to-be-detected pointer in the to-be-detected image comprises: determining the plurality of projection directions about the to-be-detected pointer in the region of interest; the determining of the distances between the projection point of each sample point on the projection direction and the target point for each projection direction comprises: for each projection direction, determining the distance between the projection point of each sample point located in the region of interest on the projection direction and the target point.
3. The method of claim 2, wherein, The to-be-detected image is a rectangle; the extracting of the region of interest in the to-be-detected image which includes the to-be-detected pointer when the redundant area in the to-be-detected image does not meet the preset detection requirement comprises: when an aspect ratio of the to-be-detected image is greater than a preset value, extracting the region of interest in the to-be-detected image which includes the to-be-detected pointer.
4. The method of claim 3, wherein, The extracting of the region of interest in the to-be-detected image which includes the to-be-detected pointer comprises: determining one to-be-connected point in each edge of the to-be-detected image based on a preset ratio; determining two specified straight lines which respectively include two to-be-connected points and are the same as an inclined direction of the to-be-detected pointer; wherein the to-be-connected points included by different specified straight lines are different; determining a polygonal region formed by edges including the two specified straight lines as the region of interest which includes the to-be-detected pointer.
5. The method of claim 1, wherein, The performing of the straight line fitting on each target sample point to obtain the target pointer comprises: The target pointer is obtained by fitting each target sample point by using a least square method.
6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: A target value to be read is obtained by determining a value indicated by the target pointer.
7. A pointer detection system, characterized in that The system includes: An image acquisition device is configured to acquire a to-be-detected image of a to-be-detected pointer; A processor is configured to perform edge feature extraction on the to-be-detected image of the to-be-detected pointer to obtain sample points; determine a plurality of projection directions of the to-be-detected pointer in the to-be-detected image; wherein straight lines on which the plurality of projection directions are located intersect at a target point; for each projection direction, determine a distance between a projection point of each sample point on the projection direction and the target point, and determine a quantity of distances located in each preset distance interval from the obtained distances; determine a target distance interval to which a maximum quantity belongs and a target projection direction from the obtained quantities; perform straight line fitting on each target sample point to obtain a target pointer; wherein the target sample point is a sample point whose distance between the projection point on the target projection direction and the target point is located in the target distance interval; The to-be-detected image is a rectangle; and the processor is specifically configured to: Determine a specified diagonal line in the to-be-detected image, which is the same as an inclined direction of the to-be-detected pointer; Take a direction on which a perpendicular line of the specified diagonal line is located as a reference direction, and determine a specified quantity of target directions in turn along a clockwise direction and an anticlockwise direction according to a preset angle difference; Determine the reference direction and the specified quantity of target directions as the plurality of projection directions of the to-be-detected pointer.
8. The system of claim 7, wherein, The processor is further configured to: Before the plurality of projection directions of the to-be-detected pointer in the to-be-detected image are determined, extract a region of interest in the to-be-detected image including the to-be-detected pointer when a redundant region in the to-be-detected image does not meet a preset detection requirement. The processor is specifically configured to: Determine the plurality of projection directions of the to-be-detected pointer in the region of interest. The processor is specifically configured to: For each projection direction, determine a distance between a projection point of each sample point located in the region of interest on the projection direction and the target point.
9. The system of claim 8, wherein, The to-be-detected image is a rectangle; and the processor is specifically configured to: When an aspect ratio of the to-be-detected image is greater than a preset value, extract a region of interest in the to-be-detected image including the to-be-detected pointer.
10. The system of claim 9, wherein, The processor is specifically configured to: Determine one to-be-connected point in each side of the to-be-detected image based on a preset ratio; Determine two specified straight lines respectively including two to-be-connected points and being the same as an inclined direction of the to-be-detected pointer; wherein the to-be-connected points included in different specified straight lines are different; Determine a polygonal region including the two specified straight lines as the region of interest including the to-be-detected pointer.
11. The system of claim 7, wherein, The processor is specifically configured to: The target pointer is obtained by fitting each target sample point by using a least square method.
12. The system according to any of claims 7-11, characterized in that, The processor is further configured to: A target value to be read is obtained by determining a value indicated by the target pointer.
13. An electronic device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps of any one of claims 1-6. The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps of any one of claims 1-6. The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps of any one of claims 1-6.
14. A computer-readable storage medium, characterized in that,
Citation Information
Patent Citations
Instrument pointer image recognition method based on symmetrical characteristics
CN106339707A
Fast iterative algorithm for superresolving computed tomography with missing data
US20150125059A1