Knob angle determination method and device, electronic equipment and storage medium
By acquiring knob images and using edge detection and Hough transform algorithms to automatically identify knob angles, the problem of low knob angle recognition efficiency in existing technologies is solved, achieving efficient and accurate knob angle recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- YUANJIAN WIND POWER JIANGYINENVISION ENERGY CO LTD
- Filing Date
- 2025-12-03
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies for knob angle recognition are inefficient, relying mainly on manual observation, resulting in insufficient accuracy and efficiency.
By acquiring an image of the knob, edge detection and Hough transform algorithms are used to identify the knob's tilt angle. Combined with Gaussian covariance matrix and pixel value processing, the knob's angle is automatically determined.
It significantly improves the efficiency of knob angle recognition, reduces manual intervention, and improves the accuracy and speed of recognition.
Smart Images

Figure CN121982107A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method, apparatus, electronic device, and storage medium for determining the angle of a knob. Background Technology
[0002] In the wind power sector, multiple knobs can be installed on the pitch control cabinet to set the pitch control mode and other parameters. Real-time and accurate monitoring of the knob status (i.e., the knob angle) is crucial for the safe and reliable operation of the wind power system.
[0003] Currently, the identification of knob angles mostly involves first taking photos periodically by inspection robots, and then identifying them manually. This method has a high accuracy rate, but low efficiency. The same technical problem exists with knobs on other types of control cabinets (such as power switch cabinets).
[0004] Therefore, improving the efficiency of knob angle recognition has become a pressing technical problem that needs to be solved. Summary of the Invention
[0005] This application provides a method, apparatus, electronic device, and storage medium for determining the knob angle, which can improve the recognition efficiency of the target knob angle.
[0006] In a first aspect, embodiments of this application provide a method for determining the angle of a knob, comprising: acquiring a first image including a target knob; generating an edge detection image of the target knob based on the first image; determining a first tilt angle according to the edge detection image; the first tilt angle being the tilt angle of the line that appears most frequently in the edge detection image; and determining the angle of the target knob according to the first tilt angle.
[0007] Optionally, determining the angle of the target knob based on the first tilt angle includes: determining a first weighting coefficient matrix based on the first tilt angle and the Gaussian covariance matrix; determining the average saturation and average chroma of all pixels in the first image based on the saturation and brightness values of each pixel in the first image and the first weighting coefficient matrix; processing the first image based on the average saturation and average chroma of all pixels in the first image to obtain a binarized sequence corresponding to the first image; and determining the angle of the target knob based on the binarized sequence corresponding to the first image.
[0008] Optionally, determining the first weight coefficient matrix based on the first tilt angle and the Gaussian covariance matrix includes: rotating the Gaussian covariance matrix to the first tilt angle to obtain a first matrix; and normalizing the first matrix to obtain the first weight coefficient matrix.
[0009] Optionally, before determining the average saturation value and average chromaticity value of all pixels in the first image based on the saturation value, chromaticity value, and the first weighting coefficient matrix of each pixel in the first image, the method further includes: obtaining the red channel value, green channel value, and blue channel value of each pixel in the first image; and determining the saturation value and chromaticity value of each pixel in the first image based on the red channel value, green channel value, and blue channel value of each pixel in the first image.
[0010] Optionally, the step of processing the first image based on the average saturation and average brightness of all pixels in the first image to obtain a binarized sequence corresponding to the first image includes: using the average saturation and average brightness as filtering thresholds, filtering the pixels in the first image based on the saturation and brightness values of each pixel in the first image to determine pixels that meet the filtering conditions and pixels that do not meet the filtering conditions; setting the brightness value of the pixels that meet the filtering conditions to a first value, and setting the brightness value of the pixels that do not meet the filtering conditions to a second value, to obtain a binarized sequence corresponding to the first image.
[0011] Optionally, determining the angle of the target knob based on the binarized sequence corresponding to the first image includes: performing an erosion operation on the binarized sequence to obtain a new binarized sequence; determining the largest connected region in the new binarized sequence; and performing a line fitting operation on the largest connected region to determine the angle of the target knob.
[0012] Optionally, generating an edge detection image of the target knob based on the first image includes: processing the first image using a target detection model to obtain a second image; performing grayscale processing on the second image to obtain a third image; and processing the third image using an edge detection algorithm to obtain an edge detection image of the target knob.
[0013] Secondly, embodiments of this application provide a device for determining the angle of a knob, comprising: an acquisition module for acquiring a first image including a target knob; a generation module for generating an edge detection image of the target knob based on the first image; a first determination module for determining a first tilt angle based on the edge detection image; the first tilt angle being the tilt angle of the line that appears most frequently in the edge detection image; and a second determination module for determining the angle of the target knob based on the first tilt angle.
[0014] Thirdly, embodiments of this application provide an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements any of the methods described in the first aspect.
[0015] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the methods described in the first aspect.
[0016] This application provides a method, apparatus, electronic device, and storage medium for determining the angle of a knob. First, a first image including a target knob is acquired. Then, an edge detection image of the target knob is generated based on the first image, and the tilt angle of the line that appears most frequently in the edge detection image is determined. Finally, the angle of the target knob is automatically determined based on the tilt angle of the line that appears most frequently in the edge detection image. Compared to existing methods that require manual observation, this significantly improves the efficiency of knob angle recognition. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application 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 this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart illustrating a method for determining the knob angle provided in an embodiment of this application; Figure 2 An example schematic diagram showing an image including a target knob provided for an embodiment of this application; Figure 3 An example schematic diagram showing only an image of the target knob provided for an embodiment of this application; Figure 4 An example schematic diagram showing a grayscale image of the target knob provided for an embodiment of this application; Figure 5 An example schematic diagram of an edge detection image of a target knob provided for an embodiment of this application; Figure 6 Another example schematic diagram of the edge detection image of the target knob provided for an embodiment of this application; Figure 7 A flowchart illustrating the determination of a target knob angle provided for an embodiment of this application; Figure 8 An example schematic diagram of an image corresponding to the Gaussian covariance matrix provided for an embodiment of this application; Figure 9 An example schematic diagram of an image corresponding to the rotated Gaussian covariance matrix provided for an embodiment of this application; Figure 10 An example schematic diagram of an image corresponding to a binarized sequence provided in an embodiment of this application; Figure 11 An example schematic diagram of an image corresponding to a binarized sequence after erosion operation provided for an embodiment of this application; Figure 12 Another example schematic diagram of an image corresponding to a binarized sequence after erosion operation provided for an embodiment of this application; Figure 13 A schematic diagram of a knob angle determination device provided for an embodiment of this application; Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0019] In this article, the term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The symbol " / " in this article indicates that the related objects are in an "or" relationship; for example, A / B means A or B.
[0020] The terms "first" and "second," etc., used in the specification and claims herein are used to distinguish different objects, not to describe a specific order of objects. For example, "first response message" and "second response message," etc., are used to distinguish different response messages, not to describe a specific order of response messages.
[0021] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0022] In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more, for example, multiple processors means two or more processors, multiple elements means two or more elements, etc.
[0023] This application provides a method, apparatus, electronic device, and storage medium for determining the knob angle, which can greatly improve the efficiency of knob angle recognition.
[0024] like Figure 1 As shown, this application embodiment provides a method for determining a knob angle. This method can be executed by an electronic device, such as a smart interactive flat panel, laptop, desktop computer, mobile phone, tablet computer, or server, etc., and this application embodiment is not limited to this. The method for determining the knob angle specifically includes the following steps: S11, acquire the first image including the target knob.
[0025] In this step, the target knob is the knob to be tested, that is, the knob that the user needs to test. For example, the target knob can be a knob on the operation panel of the pitch control cabinet.
[0026] In the specific implementation process, the user can take a picture of the target knob to obtain an image including the target knob (first image), and transmit the first image to the aforementioned electronic device, which can then acquire the first image. Besides the target knob, the first image may also include other objects such as indicator lights; this application embodiment is not limited in this regard. Figure 2 As shown.
[0027] S12, Based on the first image, generate an edge detection image of the target knob.
[0028] After acquiring the first image, the electronic device can use a target detection model to process the first image, thereby identifying the region in the first image containing the target knob. After segmentation, an image containing only the target knob (i.e., the second image) can be obtained. Figure 3 As shown. For example, the object detection model can be a convolutional neural network model or a YOLO (You Only Look Once) detection model.
[0029] Next, the electronic device can perform grayscale processing on the second image to obtain a grayscale image (i.e., the third image), such as... Figure 4 As shown. Specifically, the color of the upper surface of the target knob's handle can differ from the color of the rest of the target knob. For example, part of the upper surface of the handle might be green, while the rest of the target knob might be black, as... Figure 3 As shown. This results in a discrepancy between the grayscale values of the original green areas and the original black areas in a grayscale image. This is evident from... Figure 4 This can be observed in the middle.
[0030] Then, the electronic device can use an edge detection algorithm to process the third image to obtain an edge detection image of the target knob, such as... Figure 5 As shown. Edge detection technology is a key technique in computer vision used to identify the contours of objects in images. Its basic principle is to obtain shape information by detecting areas of abrupt changes in pixel brightness values (specifically grayscale values), thus generating an edge-detected image. Since the edge of the handle is green on one side and black on the other, the grayscale values on either side of the edge are different in the grayscale image. During edge detection, the edge of the handle (i.e., the boundary between the black and green parts) can be detected based on the abrupt changes in grayscale values. For example... Figure 6 As shown, the lines in the red box correspond to the edge lines of the handle.
[0031] In the specific implementation, the edge detection algorithm can be the Canny algorithm. The edge detection image is a binary image, where the brightness value of the pixels corresponding to the black parts can be 0, and the brightness value of the pixels corresponding to the white parts can be 255.
[0032] It should be noted that the shape of the green part can also be similar to... Figure 3 Unlike the previous method, this method only requires ensuring that the boundary between the green and black parts is parallel to the edge of the handle. In another implementation, when generating the edge detection image of the target knob, the grayscale processing step can be omitted. During edge detection, shape information can be obtained by detecting areas of drastic change in pixel brightness values. The implementation principle is basically similar to the previous method and will not be detailed here.
[0033] S13, determine a first tilt angle based on the edge detection image; the first tilt angle is the tilt angle of the line that appears most frequently in the edge detection image.
[0034] The Hough Transform algorithm is a feature extraction algorithm used to detect straight lines in images. Its core principle is to map points in the image space to a parameter space (Hough space) and use the peak values in the parameter space to identify the tilt angle of the line. In this step, the electronic device can use the Hough Transform algorithm to... Figure 5 The edge detection image of the target knob shown is processed to determine the angle of each straight line in the edge detection image. Then, the tilt angle of the line that appears most frequently (i.e., the first tilt angle) can be determined statistically. Figure 6 As shown, the tilt angle of the line in the red box is the tilt angle of the line that appears most frequently.
[0035] S14, determine the angle of the target knob based on the first tilt angle.
[0036] The tilt angle of the line that appears most frequently detected by the electronic device (the first tilt angle) is the tilt angle of the edge line of the target knob's handle, which is also the angle of the target knob. Therefore, the electronic device can determine the angle of the target knob based on the first tilt angle. Compared to the existing technology that requires manual observation, this greatly improves the efficiency of knob angle recognition. For example, this angle can be relative to a certain baseline, such as a horizontal or vertical line.
[0037] Then, the electronic device can determine the target knob's position based on its angle. For example, the target knob can be configured for manual control and automatic control. The manual control angle is 0 degrees, and the automatic control angle is 45 degrees. Considering the possibility of error, the logic can be as follows: if the detected target knob angle is within the range of -5 degrees to 5 degrees, the target knob is determined to be in manual control mode; if the detected target knob angle is within the range of 40 degrees to 50 degrees, the target knob is determined to be in automatic control mode. In one example, if the detected target knob angle is 43 degrees, the target knob is determined to be in automatic control mode. In another example, if the detected target knob angle is 2 degrees, the target knob is determined to be in manual control mode.
[0038] In some embodiments of this application, such as Figure 7 As shown, the aforementioned step S14 can specifically include the following sub-steps: S141, determine the first weight coefficient matrix based on the first tilt angle and the Gaussian covariance matrix.
[0039] Specifically, such as Figure 8As shown, the graph corresponding to the Gaussian covariance matrix has the characteristic of "bright in the middle and dark at the edges". This characteristic is determined by the probability density function form of the Gaussian distribution and the statistical properties of the covariance matrix.
[0040] In this embodiment, the number of rows and columns of the Gaussian covariance matrix can be the same as the number of rows and columns of pixels in the edge detection image. For example, if the number of pixels in the first image is 100 rows and 100 columns, and the number of pixels in the edge detection image is also 100 rows and 100 columns, then the Gaussian covariance matrix will also be 100 rows and 100 columns.
[0041] The first matrix can be obtained by rotating the Gaussian covariance matrix to the aforementioned first tilt angle (e.g., 60 degrees). This rotation operation is achieved using an orthogonal matrix; the transformed covariance matrix retains its symmetric positive definiteness and conforms to the definition of a Gaussian distribution. Therefore, the first matrix is still a Gaussian covariance matrix, and its corresponding graph is shown below. Figure 9 As shown. In this way, the tilt angle of the first matrix can be made to match the tilt angle of the knob.
[0042] Next, the electronic device can normalize the first matrix to obtain the first weight coefficient matrix. The graph corresponding to the first weight coefficient matrix is also as follows... Figure 9 As shown, the white part corresponds to a higher weight coefficient value, while the black part corresponds to a lower weight coefficient value.
[0043] It should be noted that electronic devices do not actually generate [data / products] during the actual processing. Figure 9 as well as Figure 8 Provided here Figure 9 and Figure 8 The purpose is simply to provide an intuitive demonstration of the characteristics of the Gaussian covariance matrix and the first weight coefficient matrix.
[0044] S142, based on the saturation value, brightness value of each pixel in the first image and the first weight coefficient matrix, determine the average saturation value and average brightness value of all pixels in the first image.
[0045] In this step, the electronic device can first determine the saturation and brightness values of each pixel in the first image. Specifically, the electronic device can acquire the red, green, and blue channel values of each pixel in the first image, and then calculate the saturation and brightness values of each pixel based on these values.
[0046] Specifically, HSV and RGB are two different color representation methods. The core relationship is that HSV is based on an additive color model that mixes the three primary colors of red, green, and blue (RGB), and uses three-dimensional coordinates to represent colors. This is suitable for device display but does not conform to human visual perception. Describing colors through hue (H), saturation (S), and lightness (V) is more in line with human intuitive understanding of color.
[0047] Next, the electronic device can calculate the average saturation and average chromaticity of all pixels based on the saturation and brightness values of each pixel, as well as the aforementioned first weighting coefficient matrix. For example, continuing with the previous example, if there are 10,000 pixels, the saturation values of these 10,000 pixels can be calculated separately, and then a weighted average of the saturation values of these 10,000 pixels can be obtained. For instance, if the 10,000 pixels are designated P1, P2, up to P10000, and their saturation values are designated S1, S2, up to S10000, then the 10,000 weighting coefficients corresponding to these 10,000 pixels are designated A1, A2, up to A10000.
[0048] For each pixel, the saturation value can be multiplied by its corresponding weighting coefficient. For example, for the first pixel, calculate the product of S1 and A1, B1; for the second pixel, calculate the product of S2 and A2, B2, and so on. For the 10,000th pixel, calculate the product of S10,000 and A10,000, B10,000. Then, calculate the sum of B1, B2, up to B10,000, Bsum. Simultaneously, calculate the sum of A1, A2, up to A10,000, Asum. Dividing Bsum by Asum yields the average saturation value (specifically, the weighted average) of the pixel.
[0049] The method for calculating the average chromaticity of all pixels in the first image is basically the same as the method for calculating the average saturation, and will not be described in detail here.
[0050] S143, Based on the average saturation and average brightness of all pixels in the first image, process the first image to obtain the binarized sequence corresponding to the first image.
[0051] In this step, the electronic device can use the aforementioned average saturation value and average chroma value as filtering thresholds to compare the saturation value and chroma value of each pixel in the first image with the aforementioned average saturation value and average chroma value. If the saturation value and chroma value of a pixel are both greater than the aforementioned average saturation value and average chroma value, then the pixel is determined to meet the filtering conditions. If the saturation value and chroma value of a pixel do not both meet the aforementioned average saturation value and average chroma value, then the pixel is determined to not meet the filtering conditions.
[0052] By setting the brightness values of pixels that meet the filtering criteria to a first value (e.g., 255) and the brightness values of pixels that do not meet the filtering criteria to a second value (e.g., 0), a binarized sequence corresponding to the first image can be obtained. In other words, this binarized sequence is a set of values corresponding to each pixel. The image corresponding to this binarized sequence is shown below. Figure 10 As shown. Electronic devices do not actually generate [data / products] during actual processing. Figure 10 Provided here Figure 10 The purpose is simply to visually demonstrate the characteristics of binary sequences. Because... Figure 3 The green areas in the image have higher brightness and contrast, while the black areas have lower brightness and contrast. Therefore, in Figure 10 In the image, the brightness value of the pixels corresponding to the green part is 255, and the brightness value of the pixels corresponding to the black part is 0.
[0053] S144, Determine the angle of the target knob based on the binarized sequence corresponding to the first image.
[0054] In this step, the electronic device can process the binarized sequence to determine the angle of the target knob. Specifically, the electronic device can determine the largest connected region in the binarized sequence, which can be as follows: Figure 10 The largest white area in the diagram represents the largest connected region. Figure 3 The green portion in the diagram. Then, the electronic device can perform a line fitting operation on the largest connected region to determine the tilt angle of the main direction of the largest connected region. Since the tilt angle of this main direction is consistent with the tilt angle of the target knob, the angle of the target knob can be determined based on the angle of this main direction.
[0055] In one example, principal component analysis (PCA) can be used for line fitting. PCA is a method that fits a straight line by finding the principal directions of the data. Figure 10 The main direction of the largest connected region in the array is determined.
[0056] It is understandable that the main direction of the largest connected component is... Figure 3 The direction of the dividing line between the green and black parts in the image.
[0057] In a more efficient implementation, the electronic device can first perform an erosion operation on the aforementioned binarized sequence to obtain a new binarized sequence. Specifically, the erosion operation on a binary image is a basic morphological processing method, mainly used to eliminate object boundary points, separate fine connections, or remove small objects. After performing the erosion operation on the binarized sequence, interference factors can be effectively eliminated in the resulting new binarized sequence, thereby obtaining a more accurate maximum connected region, and thus more accurately determining the direction of the knob. Figure 12 The direction of the blue line in the diagram indicates the main direction of the largest connected region when this implementation is used.
[0058] like Figure 13 As shown in the figure, this application embodiment provides a device for determining the angle of a knob, including: an acquisition module for acquiring a first image including a target knob; a generation module for generating an edge detection image of the target knob based on the first image; a first determination module for determining a first tilt angle based on the edge detection image; the first tilt angle being the tilt angle of the line that appears most frequently in the edge detection image; and a second determination module for determining the angle of the target knob based on the first tilt angle.
[0059] The knob angle determination device provided in this application embodiment can execute the method executed by the electronic device in the above embodiment. Its implementation principle and technical effect are similar, and will not be described again here.
[0060] like Figure 14 As shown in the figure, this application embodiment also provides an electronic device, which includes a memory and a processor. The memory is used to store a computer program. When the computer program is executed by the processor, the method for determining the knob angle as described above can be implemented. For details, please refer to the description of the foregoing embodiment.
[0061] Specifically, at the hardware level, the electronic device may include a processor, an internal bus, and memory. The memory may include main memory and non-volatile memory. The processor reads the corresponding computer program from the non-volatile memory into main memory and then executes it. Those skilled in the art will understand that... Figure 14 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device may also include components that are larger than... Figure 14 The components shown may include more or fewer components, such as other processing hardware like a GPU (Graphics Processing Unit) or external communication ports. Of course, this application does not exclude other implementation methods besides software implementations, such as logic devices or a combination of hardware and software.
[0062] In this embodiment, the processor may include a central processing unit (CPU) or a graphics processing unit (GPU), and may also include other microcontrollers, logic gates, integrated circuits, or appropriate combinations thereof with logic processing capabilities. The memory described in this embodiment can be a storage device for storing information. In digital systems, a device capable of storing binary data can be a memory; in integrated circuits, a circuit without physical form but with storage function can also be a memory, such as RAM or FIFO; in a system, a storage device with physical form can also be called a memory. In implementation, this memory can also be implemented using a cloud storage method; the specific implementation method is not limited in this specification.
[0063] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the method for determining the knob angle as described above.
[0064] This application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the method for determining the knob angle as described above.
[0065] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable 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 the various embodiments or some parts of the embodiments.
[0066] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for determining the angle of a knob, characterized in that, include: Acquire a first image including the target knob; Based on the first image, generate an edge detection image of the target knob; Based on the edge detection image, a first tilt angle is determined; the first tilt angle is the tilt angle of the line that appears most frequently in the edge detection image. The angle of the target knob is determined based on the first tilt angle.
2. The method for determining the knob angle according to claim 1, characterized in that, Determining the angle of the target knob based on the first tilt angle includes: The first weighting coefficient matrix is determined based on the first tilt angle and the Gaussian covariance matrix. Based on the saturation value, brightness value, and weight coefficient matrix of each pixel in the first image, the average saturation value and average brightness value of all pixels in the first image are determined. The first image is processed based on the average saturation and average brightness of all pixels in the first image to obtain the binarized sequence corresponding to the first image. The angle of the target knob is determined based on the binarized sequence corresponding to the first image.
3. The method for determining the knob angle according to claim 2, characterized in that, The step of determining the first weight coefficient matrix based on the first tilt angle and the Gaussian covariance matrix includes: The Gaussian covariance matrix is rotated to the first tilt angle to obtain the first matrix; The first matrix is normalized to obtain the first weight coefficient matrix.
4. The method for determining the knob angle according to claim 2, characterized in that, Before determining the average saturation and average brightness of all pixels in the first image based on the saturation and brightness values of each pixel in the first image and the first weighting coefficient matrix, the method further includes: Obtain the red channel value, green channel value, and blue channel value of each pixel in the first image; Based on the red channel value, green channel value, and blue channel value of each pixel in the first image, the saturation value and brightness value of each pixel in the first image are determined.
5. The method for determining the knob angle according to any one of claims 2 to 4, characterized in that, The step of processing the first image based on the average saturation and average brightness of all pixels in the first image to obtain a binarized sequence corresponding to the first image includes: Using the average saturation value and the average chromaticity value as filtering thresholds, the pixels in the first image are filtered according to the saturation value and chromaticity value of each pixel in the first image to determine the pixels that meet the filtering conditions and the pixels that do not meet the filtering conditions. The brightness values of pixels that meet the filtering criteria are set to a first value, and the brightness values of pixels that do not meet the filtering criteria are set to a second value, so as to obtain the binarized sequence corresponding to the first image.
6. The method for determining the knob angle according to claim 2, characterized in that, Determining the angle of the target knob based on the binarized sequence corresponding to the first image includes: The binarized sequence is subjected to an erosion operation to obtain a new binarized sequence; Determine the largest connected region in the new binarized sequence; A straight-line fitting operation is performed on the largest connected region to determine the angle of the target knob.
7. The method for determining the knob angle according to claim 1, characterized in that, The step of generating an edge detection image of the target knob based on the first image includes: The first image is processed using an object detection model to obtain the second image; The second image is processed into grayscale to obtain the third image; An edge detection algorithm is used to process the third image to obtain an edge detection image of the target knob.
8. A device for determining the angle of a knob, characterized in that, include: The acquisition module is used to acquire a first image including the target knob; A generation module is used to generate an edge detection image of the target knob based on the first image; The first determining module is used to determine a first tilt angle based on the edge detection image; the first tilt angle is the tilt angle of the line that appears most frequently in the edge detection image; The second determining module is used to determine the angle of the target knob based on the first tilt angle.
9. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it causes the electronic device to implement the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.