Relay node identification method, system, electronic device and storage medium
Through red-green ratio operation and elliptical fitting combined with pin array features, a simplified relay detection model is built, which solves the misjudgment of traditional visual recognition technology and insufficient computing resources on industrial automation production lines, and achieves efficient and accurate relay node recognition.
Patent Information
- Application Number
- CN202510863704.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2045-06-26
AI Technical Summary
Traditional visual recognition technology has problems such as high misjudgment rate, insufficient computing resources and insufficient real-time processing capabilities in relay detection, which is difficult to meet the high accuracy and high efficiency requirements of industrial automation production lines.
The coil region is determined through red-green ratio calculation and elliptical fitting, and the rectangular array layout of the pins and high-contrast features are positioned. Laplace Gaussian nuclear convolution and Gaussian-Newton iterative optimization are used to build a simplified detection model, and the confidence calculation is combined to ensure the reliability of the detection results.
It reduces the computational complexity, improves detection efficiency and accuracy, enhances anti-interference ability, and ensures the stability and reliability of detection results.
Smart Images

Figure CN120374986B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of relay node identification, and in particular to a relay node identification method, system, electronic equipment and storage medium. Background Art
[0002] Against the backdrop of the rapid development of Industry 4.0 and smart manufacturing, industrial automated production lines are placing extremely high demands on component inspection accuracy, speed, and stability. Relays, a common electronic component in industrial control systems, require accurate identification to ensure production line operation and improve product quality. Visual recognition technology, with its advantages of being contactless and providing comprehensive information, has become a key tool for relay inspection. However, the complexity of production line environments and the computing power limitations of embedded devices present numerous challenges for traditional visual recognition technology in relay inspection.
[0003] Traditional visual recognition technologies often rely on single color or edge detection methods. Industrial production lines often encounter a mix of component models, unstable lighting conditions, and oil contamination, all of which can easily lead to misjudgments. For example, color threshold-based detection methods may mistakenly identify red or copper components as relay coils. Edge detection struggles to accurately extract relay contours when oil is covered or when illumination is uneven. Complex image segmentation and feature matching algorithms also place high demands on computing resources. Embedded devices commonly used in industrial automation production lines, such as PLCs and industrial cameras, have limited CPU power. Traditional algorithms operating on these devices struggle to meet sub-millisecond real-time processing requirements, resulting in low detection efficiency and an inability to adapt to the pace of high-speed production lines. Existing technologies fail to fully exploit the unique structural characteristics of relays: an elliptical coil shape and a strictly rectangular pin array, and transform them into effective detection constraints. This results in redundant computations, increasing the computational load and reducing detection accuracy and stability. Summary of the Invention
[0004] Purpose of the invention: To propose a relay node identification method, and further provide a system, electronic device and storage medium capable of running and implementing the above method, so as to solve the above problems existing in the prior art.
[0005] A first aspect of the present invention provides a relay node identification method, comprising the following steps:
[0006] S1. Obtain the original RGB image data of the relay, perform a red-green ratio calculation, generate a color mask binary image through threshold segmentation, filter the non-coil area, determine the coil area through ellipse equation fitting, and output a color mask binary image of the coil area;
[0007] S2. Extracting edge contour point sets from the color mask binary image of the coil area, calculating the covariance matrix of the edge contour points, and obtaining the principal eigenvector corresponding to the maximum eigenvalue of the covariance matrix as the principal axis direction vector of the coil to construct the rigid body transformation matrix of the coil;
[0008] S3. Convert the original RGB image of the relay into a grayscale image and extract the pin template coordinates. Combine the pin template coordinates with the rigid body transformation matrix of the coil to calculate the predicted pixel coordinates of the pin. Apply a Laplacian of Gaussian kernel to the grayscale image within a preset window around the predicted pixel coordinates of the pin, and obtain the measured pixel coordinates of the pin through local maximum detection. Construct an objective function to output the optimized measured pixel coordinates of the pin and the optimized rigid body transformation matrix by iteratively fine-tuning the transformation parameters.
[0009] S4. Extract the measured pixel coordinates of the optimized pins, the total number of pins, and the pixel tolerance, and obtain the predefined labels of the pin template. Map the predefined labels of the pin template to the measured pixel coordinates of the pins through isomorphic mapping, and perform confidence calculation to determine the reliability of the output results.
[0010] A further improvement of the present invention is that S1 comprises the following specific steps:
[0011] S11. Get the original RGB image of the relay and the R channel value of each pixel in the original RGB image and G channel value , Represents pixel coordinates;
[0012] S12, performing red-green ratio calculation, the red-green ratio calculation formula is:
[0013]
[0014] in, Is a constant, the value is ;
[0015] S13, perform threshold segmentation to generate a color mask binary image, for the original RGB image Pixels marked with color mask ,otherwise, ;
[0016] S14, fitting an ellipse equation to the coil, the ellipse equation is: ; where a is the major axis of the ellipse, b is the minor axis of the ellipse, is the center coordinate of the ellipse, the ellipse area that meets the ellipse geometric constraint parameters is retained as the final coil area, and the color mask binary image of the coil area is output.
[0017] A further improvement of the present invention is that the ellipse geometric constraint parameters in S14 are specifically: the ratio of the major semi-axis to the minor semi-axis is not less than 0.95 and not greater than 1.1, and the area is greater than 2000 pixels.
[0018] A further improvement of the present invention is that S2 comprises the following specific steps:
[0019] S21. Extract edge contour point set C from the color mask binary image of the coil area, and calculate the covariance matrix of the edge contour points. The calculation formula is:
[0020]
[0021] Where Σ represents the covariance matrix of the edge contour points, N is the number of elements in the edge contour point set C, Represents the pixel coordinates of the i-th edge contour point, represents the centroid coordinates of the edge contour points, and T represents the transpose of the matrix;
[0022] S22, select the principal eigenvector of the covariance matrix corresponding to the maximum eigenvalue as the coil main axis direction vector ; Calculate the scaling ratio of the coil ;in, Represents the semi-major axis length of the coil of the standard relay model; calculates the direction vector of the coil main axis The angle with the x-axis of the color mask binary image is: ; Represents the component of the coil main axis direction vector in the y-axis direction of the color mask binary image, Represents the component of the coil main axis direction vector in the x-axis direction of the color mask binary image, generating a rotation matrix ;
[0023] S23, scaling ratio s of the combined coil, rotation matrix And the centroid coordinates of the edge contour points , construct the rigid body transformation matrix .
[0024] A further improvement of the present invention is that S3 includes the following specific steps:
[0025] S31. Convert the original RGB image of the relay into a grayscale image and extract the pin template coordinates , combined with the pin template coordinates Rigid body transformation matrix with the coil , calculate the predicted pixel coordinates of the pin , the calculation formula is: ; Wherein, j represents pin j;
[0026] S32, predicted pixel coordinates at the pin In the surrounding 9×9 window, the grayscale image is convolved with the Laplace Gaussian kernel, and the point with the strongest response is found by local maximum detection as the measured pixel coordinate of the pin. ;
[0027] S33. With the goal of minimizing the error between the predicted pixel coordinates and the measured pixel coordinates of the pin, a Gauss-Newton optimization objective function is constructed to fine-tune the rigid body transformation matrix of the coil. The specific formula is:
[0028]
[0029] in, is the fine-tuning amount of the rigid body transformation matrix of the coil; n represents the total number of relay pins;
[0030] S34, output the measured pixel coordinates of the optimized pin and the optimized rigid body transformation matrix.
[0031] A further improvement of the present invention is that S4 includes the following specific steps:
[0032] S41. Extract the measured pixel coordinates of the optimized pins , the total number of pins n and the pixel tolerance ;
[0033] S42. Get the predefined label of the pin template , through isomorphic mapping Mapping the predefined labels of the pin template to the measured pixel coordinates of the pin;
[0034] S43: Calculate the confidence level. The specific formula for the confidence level calculation is:
[0035]
[0036] in, represents the Euclidean distance between the predicted pixel coordinates of the jth pin and the optimized measured pixel coordinates of the pin;
[0037] S44, judge the reliability of the output results, when the confidence , the output result is determined to be reliable, otherwise the re-check mechanism is triggered.
[0038] A second aspect of the present invention provides a relay node identification system, which includes: a coil extraction module, a rigid body transformation module, a pin joint optimization module, and a label assignment and confidence verification module.
[0039] The coil extraction module is used to obtain the original RGB image data of the relay, perform red-green ratio calculation, generate a color mask binary image through threshold segmentation, filter the non-coil area, determine the coil area through ellipse equation fitting, and output the color mask binary image of the coil area;
[0040] The rigid body transformation module is used to extract the edge contour point set from the color mask binary image of the coil area, calculate the covariance matrix of the edge contour points, and obtain the main eigenvector corresponding to the maximum eigenvalue of the covariance matrix as the main axis direction vector of the coil to construct the rigid body transformation matrix of the coil;
[0041] The pin joint optimization module is used to convert the original RGB image of the relay into a grayscale image and extract the pin template coordinates. The pin template coordinates are combined with the rigid body transformation matrix of the coil to calculate the predicted pixel coordinates of the pin. A Laplace Gaussian kernel is applied to the grayscale image within a preset window around the predicted pixel coordinates of the pin to perform a convolution operation. The measured pixel coordinates of the pin are obtained through local maximum detection. An objective function is constructed to output the optimized measured pixel coordinates of the pin and the optimized rigid body transformation matrix by iteratively fine-tuning the transformation parameters.
[0042] The label assignment and confidence verification module is used to extract the optimized pin measured pixel coordinates, the total number of pins and the pixel tolerance, and obtain the predefined labels of the pin template. The predefined labels of the pin template are mapped to the measured pixel coordinates of the pin through isomorphic mapping, and confidence calculation is performed to determine the reliability of the output results.
[0043] According to a third aspect of the present invention, an electronic device is provided, comprising a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the relay node identification method as described in the first aspect is implemented.
[0044] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the storage medium stores at least one executable instruction. When the executable instruction is executed on an electronic device, the electronic device executes the relay node identification method as described in the first aspect.
[0045] Beneficial effects: The novel relay node identification method disclosed in the present invention only relies on two prior features, namely coil color-geometry and pin array, to construct a detection model. By screening coils using the red-green ratio and determining the coil shape through ellipse fitting, the pins are positioned using the rectangular array layout and high-contrast visual features, thus avoiding the complex image segmentation and feature matching process, fundamentally simplifying the algorithm complexity and reducing the amount of calculation; the search space for pin positioning is reduced from the entire image to a local window, reducing the amount of calculation while improving detection efficiency; combining the high brightness characteristics of metal pins, suppressing background noise and enhancing anti-interference capabilities. The global optimization link fine-tunes the transformation parameters through Gauss-Newton iteration to ensure the overall alignment accuracy of all pins. At the same time, the confidence calculation provides a quantitative reliability indicator. When the detection environment deteriorates, the system can automatically identify and trigger remedial measures to effectively eliminate false detection results and ensure the accuracy and stability of the detection results. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 4 is a flow chart of a relay node identification method according to an embodiment of the present invention.
[0047] Figure 2 2 is a schematic structural diagram of a relay node identification system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0048] In the following description, numerous specific details are provided to provide a more thorough understanding of the present invention. However, it will be apparent to those skilled in the art that the present invention may be practiced without one or more of these details. In other instances, certain technical features well known in the art have not been described to avoid confusion with the present invention.
[0049] Example 1:
[0050] This embodiment constructs a new relay node identification method based on image recognition, and its overall process is shown in FIG. Figure 1 The specific steps are as follows:
[0051] S1. Obtain the original RGB image data of the relay and perform a red-green ratio calculation. Generate a color mask binary image through threshold segmentation. Filter the non-coil area, determine the coil area through ellipse equation fitting, and output a color mask binary image of the coil area.
[0052] In this embodiment, step S1 can be implemented by the following specific steps:
[0053] S11. Get the original RGB image of the relay and the R channel value of each pixel in the original RGB image and G channel value , Represents pixel coordinates;
[0054] S12, calculate the red-green ratio. The red-green ratio calculation formula is shown in formula (1):
[0055]
[0056] in, Is a constant, the value is ;
[0057] S13, perform threshold segmentation to generate a color mask binary image, for the original RGB image Pixels marked with color mask ,otherwise, ;
[0058] S14. Fit the ellipse equation to the coil, see formula (2):
[0059]
[0060] Among them, a is the major axis of the ellipse, b is the minor axis of the ellipse, The ellipse center coordinates are retained as the final coil region. The ellipse region that satisfies the ellipse geometric constraint parameters is output as a color mask binary image of the coil region. The ellipse geometric constraint parameters are as follows: the ratio of the major semi-axis to the minor semi-axis is not less than 0.95 and not greater than 1.1, and the area is greater than 2000 pixels.
[0061] The color specificity of the copper wire (its high R / G ratio) is used to quickly filter out the background. Elliptical geometric constraints (approximately circular ellipses) are then applied to eliminate non-coil interference (such as cylindrical capacitors), ultimately resulting in a coil mask. This step narrows the candidate region from the entire image to the coil perimeter, reducing subsequent computational effort.
[0062] S2. Extract the edge contour point set from the color mask binary image of the coil area, calculate the covariance matrix of the edge contour points, and obtain the principal eigenvector corresponding to the maximum eigenvalue of the covariance matrix as the principal axis direction vector of the coil to construct the rigid body transformation matrix of the coil.
[0063] In this embodiment, step S2 can be implemented by the following specific steps:
[0064] S21. Extract the edge contour point set C from the color mask binary image of the coil area and calculate the covariance matrix of the edge contour points. The calculation formula is shown in formula (3):
[0065]
[0066] Where Σ represents the covariance matrix of the edge contour points, N is the number of elements in the edge contour point set C, Represents the pixel coordinates of the i-th edge contour point, represents the centroid coordinates of the edge contour points, and T represents the transpose of the matrix;
[0067] S22, select the principal eigenvector of the covariance matrix corresponding to the maximum eigenvalue as the coil main axis direction vector ; Calculate the scaling ratio of the coil ;in, Represents the semi-long axis length of the coil of the standard relay model; Calculate the coil main axis direction vector according to formula (4) The angle with the x-axis of the color mask binary image:
[0068]
[0069] Represents the component of the coil main axis direction vector in the y-axis direction of the color mask binary image, represents the component of the coil main axis direction vector in the x-axis direction of the color mask binary image, generating the rotation matrix shown in formula (5):
[0070]
[0071] S23, scaling ratio s of the combined coil, rotation matrix And the centroid coordinates of the edge contour points , construct the rigid body transformation matrix shown in formula (6):
[0072]
[0073] S3. Convert the original RGB image of the relay into a grayscale image and extract the pin template coordinates. Combine the pin template coordinates with the rigid body transformation matrix of the coil to calculate the predicted pixel coordinates of the pin. Apply the Laplace Gaussian kernel to the grayscale image within a preset window around the predicted pixel coordinates of the pin, and obtain the measured pixel coordinates of the pin through local maximum detection. Then construct an objective function to output the optimized measured pixel coordinates of the pin and the optimized rigid body transformation matrix by iteratively fine-tuning the transformation parameters.
[0074] In this embodiment, step S3 can be implemented by the following specific steps:
[0075] S31. Convert the original RGB image of the relay into a grayscale image and extract the pin template coordinates , combined with the pin template coordinates Rigid body transformation matrix with the coil , calculate the predicted pixel coordinates of the pin according to formula (7):
[0076]
[0077] S32, predicted pixel coordinates at the pin In the surrounding 9×9 window, the grayscale image is convolved with the Laplace Gaussian kernel, and the point with the strongest response is found by local maximum detection as the measured pixel coordinate of the pin. ;
[0078] S33, with the goal of minimizing the error between the predicted pixel coordinates and the measured pixel coordinates of the pin, a Gauss-Newton optimization objective function is constructed to fine-tune the rigid body transformation matrix of the coil. The specific formula is shown in formula (8):
[0079]
[0080] in, is the fine-tuning amount of the rigid body transformation matrix of the coil; n represents the total number of relay pins;
[0081] S34, output the measured pixel coordinates of the optimized pin and the optimized rigid body transformation matrix.
[0082] First, template projection is used to generate candidate pin locations. The high contrast of metal pins is then used to precisely locate the center of mass of the bright spot in the local area using the LoG operator, reducing the computational complexity of the global search. Finally, Gauss-Newton iteration is used to optimize the rigid body parameters to ensure the overall alignment accuracy of all pins and avoid topological errors caused by single-point positioning errors.
[0083] S4. Extract the measured pixel coordinates of the optimized pins, the total number of pins, and the pixel tolerance, and obtain the predefined labels of the pin template. Map the predefined labels of the pin template to the measured pixel coordinates of the pins through isomorphic mapping, and perform confidence calculation to determine the reliability of the output results.
[0084] In this embodiment, step S4 can be implemented using the following specific steps:
[0085] S41. Extract the measured pixel coordinates of the optimized pins , the total number of pins n and the pixel tolerance ;
[0086] S42. Get the predefined label of the pin template , through isomorphic mapping Mapping the predefined labels of the pin template to the measured pixel coordinates of the pin;
[0087] S43. Calculate the confidence level according to formula (9):
[0088]
[0089] in, represents the Euclidean distance between the predicted pixel coordinates of the jth pin and the optimized measured pixel coordinates of the pin;
[0090] S44, judge the reliability of the output results, when the confidence , the output result is determined to be reliable, otherwise the re-check mechanism is triggered.
[0091] Leveraging the fixed topology of relay pins, template labels are directly mapped to measured coordinates, avoiding complex semantic segmentation. Confidence calculation quantifies the reliability of the results by normalizing the mean error, ensuring unambiguous output and meeting the accuracy requirements of industrial control.
[0092] Example 2:
[0093] This embodiment proposes a new relay node identification system based on image recognition, such as Figure 2 As shown in the figure, it consists of four parts: coil extraction module, rigid body transformation module, pin joint optimization module, and label assignment and confidence verification module.
[0094] The coil extraction module is used to obtain the original RGB image data of the relay, perform red-green ratio calculation, generate a color mask binary image through threshold segmentation, filter the non-coil area, determine the coil area through ellipse equation fitting, and output the color mask binary image of the coil area.
[0095] The rigid body transformation module is used to extract the edge contour point set from the color mask binary image of the coil area, calculate the covariance matrix of the edge contour points, and obtain the principal eigenvector corresponding to the maximum eigenvalue of the covariance matrix as the coil principal axis direction vector to construct the rigid body transformation matrix of the coil.
[0096] The pin joint optimization module is used to convert the original RGB image of the relay into a grayscale image and extract the pin template coordinates. The predicted pixel coordinates of the pin are calculated by combining the pin template coordinates with the rigid body transformation matrix of the coil. The Laplace Gaussian kernel is applied to the grayscale image within a preset window around the predicted pixel coordinates of the pin to perform a convolution operation. The measured pixel coordinates of the pin are obtained through local maximum detection. The objective function is constructed to output the optimized measured pixel coordinates of the pin and the optimized rigid body transformation matrix by iteratively fine-tuning the transformation parameters.
[0097] The label assignment and confidence verification module is used to extract the measured pixel coordinates of the optimized pins, the total number of pins, and the pixel tolerance, and obtain the predefined labels of the pin template. Through isomorphic mapping, the predefined labels of the pin template are mapped to the measured pixel coordinates of the pins, and confidence calculation is performed to determine the reliability of the output results.
[0098] The above-mentioned parameters and steps for each unit module to implement corresponding functions in the relay node identification system of the present invention can refer to the parameters and steps in the embodiment of a new relay node identification method based on image recognition in Example 1 above, and will not be repeated here.
[0099] Example 3
[0100] This embodiment provides an electronic device, which includes a processor and a memory, wherein the memory stores a computer program that can be called by the processor; the processor executes a new relay node identification method based on image recognition disclosed in the above embodiment 1 by calling the computer program stored in the memory.
[0101] This electronic device can vary significantly depending on its configuration or performance. It can include one or more processors (Central Processing Units, CPUs) and one or more memories, wherein the memories store at least one computer program, which is loaded and executed by the processor to implement the novel relay node identification method based on image recognition provided in the above-mentioned method embodiment. The electronic device can also include other components for implementing the device's functions. For example, the electronic device can also include components such as wired or wireless network interfaces and input / output interfaces for data input and output. This embodiment is not described in detail here.
[0102] Those skilled in the art will appreciate that the present invention may be implemented as a system, method, or computer program product. Therefore, the present disclosure may be implemented in the following forms: entirely in hardware, entirely in software (including firmware, resident software, microcode, etc.), or in a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." Furthermore, in some embodiments, the present invention may be implemented as a computer program product embodied in one or more computer-readable media containing computer-readable program code.
[0103] Any combination of one or more computer-readable media can be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or device.
[0104] The present invention is described with reference to flowcharts and block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process or block in the flowcharts and block diagrams, as well as combinations of processes and blocks in the flowcharts or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts. Figure 1 A process or multiple processes and boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0105] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 A process or multiple processes and boxes Figure 1 A step that specifies a function in one or more boxes.
[0106] As described above, although the present invention has been shown and described with reference to specific preferred embodiments, it should not be construed as limiting the present invention itself. Various changes may be made to it in form and detail without departing from the spirit and scope of the present invention as defined in the appended claims.
Claims
1. A relay node identification method, characterized in that: The steps include: S1. Obtain the original RGB image data of the relay and perform a red-green ratio operation on it. Generate a color mask binary image through threshold segmentation, filter the non-coil area, and determine the coil area through ellipse equation fitting. Output the color mask binary image of the coil area. S2. Extracting edge contour point sets from the color mask binary image of the coil area, calculating the covariance matrix of the edge contour points, and obtaining the principal eigenvector corresponding to the maximum eigenvalue of the covariance matrix as the principal axis direction vector of the coil to construct the rigid body transformation matrix of the coil; S3. Convert the original RGB image of the relay into a grayscale image and extract the pin template coordinates. Combine the pin template coordinates with the rigid body transformation matrix of the coil to calculate the predicted pixel coordinates of the pin. Apply a Laplacian of Gaussian kernel to the grayscale image within a preset window around the predicted pixel coordinates of the pin, and obtain the measured pixel coordinates of the pin through local maximum detection. Construct an objective function to output the optimized measured pixel coordinates of the pin and the optimized rigid body transformation matrix by iteratively fine-tuning the transformation parameters. S4. Extract the measured pixel coordinates of the optimized pins, the total number of pins, and the pixel tolerance, and obtain the predefined labels of the pin template. Map the predefined labels of the pin template to the measured pixel coordinates of the pins through isomorphic mapping, and perform confidence calculation to determine the reliability of the output results.
2. The relay node identification method according to claim 1, wherein Step S1 specifically includes: S11. Get the original RGB image of the relay and the R channel value of each pixel in the original RGB image and G channel value , Represents pixel coordinates; S12. Calculate red-green ratio : Where, is a constant; S13, for the original RGB image Pixels marked with color mask ; Otherwise mark the color mask ; S14. Determine the coil area by fitting an ellipse equation, wherein the ellipse equation is as follows: Where a is the major axis of the ellipse, b is the minor axis of the ellipse, is the center coordinate of the ellipse, the ellipse area that meets the ellipse geometric constraint parameters is retained as the final coil area, and the color mask binary image of the coil area is output.
3. The relay node identification method according to claim 2, characterized in that: The ellipse geometric constraint parameters are: the ratio of the major semi-axis to the minor semi-axis is not less than 0.95 and not greater than 1.1, and the area is greater than 2000 pixels.
4. The relay node identification method according to claim 3, characterized in that: Step S2 specifically includes: S21. Extract edge contour point set C from the color mask binary image of the coil area and calculate the covariance matrix of the edge contour points : Where Σ represents the covariance matrix of edge contour points; N is the number of elements in the edge contour point set C; Represents the pixel coordinates of the i-th edge contour point; represents the centroid coordinates of the edge contour points; T represents the transpose of the matrix; S22, select the principal eigenvector of the covariance matrix Σ corresponding to the maximum eigenvalue as the coil main axis direction vector ; Calculate the scaling ratio s of the coil: Where, represents the length of the semi-major axis of the coil of the standard relay model; a is the semi-major axis of the ellipse; Calculate the coil main axis direction vector The angle with the x-axis of the color mask binary image : Where, Represents the component of the coil main axis direction vector in the y-axis direction of the color mask binary image; Represents the component of the coil main axis direction vector in the x-axis direction of the color mask binary image; Generate rotation matrix ; S23, scaling ratio s of the combined coil, rotation matrix And the centroid coordinates of the edge contour points , construct the rigid body transformation matrix .
5. The relay node identification method according to claim 4, characterized in that: Step S3 specifically includes: S31. Convert the original RGB image of the relay into a grayscale image and extract the pin template coordinates , combined with the pin template coordinates Rigid body transformation matrix with the coil , calculate the predicted pixel coordinates of pin j : S32, predicted pixel coordinates at the pin In the surrounding 9×9 window, the grayscale image is convolved with the Laplace Gaussian kernel, and the point with the strongest response is found by local maximum detection as the measured pixel coordinate of the pin. ; S33, with the goal of minimizing the error between the predicted pixel coordinates and the measured pixel coordinates of the pin, a Gauss-Newton optimization objective function is constructed to fine-tune the rigid body transformation matrix of the coil. The formula is: Where, is the fine-tuning amount of the rigid body transformation matrix of the coil; n represents the total number of relay pins; S34, output the measured pixel coordinates of the optimized pin and the optimized rigid body transformation matrix.
6. The relay node identification method according to claim 5, characterized in that: Step S4 specifically includes: S41. Extract the measured pixel coordinates of the optimized pins , the total number of pins n and the pixel tolerance ; S42. Get the predefined label of the pin template , through isomorphic mapping Mapping the predefined labels of the pin template to the measured pixel coordinates of the pin; S43. Calculate confidence : Where, Represents the Euclidean distance between the predicted pixel coordinates of the jth pin and the optimized measured pixel coordinates of the pin.
7. The relay node identification method according to claim 6, characterized in that: Step S4 further includes: S44, judge the reliability of the output results, when the confidence , the output result is determined to be reliable, otherwise the re-check mechanism is triggered.
8. A relay node identification system, used to execute the relay node identification method according to any one of claims 1 to 7, characterized in that: include: The coil extraction module is used to obtain the original RGB image data of the relay, perform red-green ratio calculation, generate a color mask binary image through threshold segmentation, filter the non-coil area, determine the coil area through ellipse equation fitting, and output the color mask binary image of the coil area; The rigid body transformation module is used to extract the edge contour point set from the color mask binary image of the coil area, calculate the covariance matrix of the edge contour points, and obtain the principal eigenvector corresponding to the maximum eigenvalue of the covariance matrix as the coil principal axis direction vector to construct the rigid body transformation matrix of the coil; The pin joint optimization module is used to convert the original RGB image of the relay into a grayscale image and extract the pin template coordinates. The pin template coordinates are combined with the rigid body transformation matrix of the coil to calculate the predicted pixel coordinates of the pin. The grayscale image is convolved with the Laplacian of Gaussian kernel within a preset window around the predicted pixel coordinates of the pin. The measured pixel coordinates of the pin are obtained through local maximum detection. The objective function is constructed to output the optimized measured pixel coordinates of the pin and the optimized rigid body transformation matrix by iteratively fine-tuning the transformation parameters. The label assignment and confidence verification module is used to extract the measured pixel coordinates of the optimized pins, the total number of pins, and the pixel tolerance, and obtain the predefined labels of the pin template. Through isomorphic mapping, the predefined labels of the pin template are mapped to the measured pixel coordinates of the pins, and confidence calculation is performed to determine the reliability of the output results.
9. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the relay node identification method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that The storage medium stores at least one executable instruction, and when the executable instruction is executed on the electronic device, the electronic device executes the relay node identification method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Three-phase electrode positioning device in smelting process of electro-fused magnesia furnace and control method thereof
CN101765258A
Image-based circuit board electronic component positioning method and system
CN118762003A