Electric connector detection method and system based on machine vision
By constructing triplet template data and template structure topology map, and combining the topology map structure matching value with the material property matching calculation, the lack of multi-dimensional fusion analysis of structural topology relationship and material properties in existing electrical connector detection methods is solved, and high-precision electrical connector detection is achieved.
Patent Information
- Application Number
- CN202511319149.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-16
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-09-16
Smart Images

Figure CN120807533A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electrical connectors, in particular to an electrical connector detection method and system based on machine vision. BACKGROUND
[0002] Electrical connectors are key basic elements for realizing separable connection in electrical circuits. In the electronic manufacturing industry, electrical connectors are key elements for realizing circuit connection, and their quality directly affects the reliability and performance of equipment. Therefore, high-precision detection of electrical connectors is crucial.
[0003] In the prior art, traditional electrical connector detection methods mainly rely on manual visual inspection or machine vision detection based on single geometric features. Manual detection has the defects of low efficiency, strong subjectivity and susceptibility to fatigue, while traditional machine vision detection, such as the invention patent with publication date of July 1, 2018 and publication number CN108269255A, discloses an electrical connector detection device and method based on machine vision. The detection platform is provided with a plurality of detection stations for placing electrical connectors. A three-axis moving mechanism is arranged on the outer periphery of the detection platform. A binocular camera is rotatably arranged on the movable end of the three-axis moving mechanism. The binocular camera is used to take images of the electrical connectors placed on the detection stations. The output end of the binocular camera is connected to a signal processing mechanism. The signal processing mechanism identifies the features of the pins and jacks on the electrical connectors according to the shooting images of the binocular camera, compares the pin and jack features with the set standard template features, and obtains the comparison results. The binocular camera is composed of a left camera and a right camera. The models of the left and right cameras are consistent. The left and right cameras are placed in parallel alignment. The left and right cameras respectively image the pins on the same electrical connector to determine whether the pins are protruding or retracted. The technical solution of the above-mentioned patent can improve the detection efficiency and realize partial automation, but it generally lacks multi-dimensional fusion analysis capability for the topological relationship of electrical connector structure, material properties and geometric features, making it difficult to accurately evaluate the comprehensive performance of electrical connectors in complex industrial scenarios.
[0004] In addition, most existing detection methods only detect single geometric dimensions or appearance defects of electrical connectors, lack joint analysis of spatial relationships between structural units, material properties such as material type and surface reflectivity, and cannot effectively identify hidden defects caused by structural topological abnormalities, making it difficult to meet the detection needs of electrical connectors in high-precision and high-reliability scenarios. SUMMARY
[0005] Therefore, it is necessary to provide a machine vision-based electrical connector detection method and system capable of calculating the comprehensive matching degree of the electrical connector by combining the topological graph structure matching value and the material attribute matching degree, capable of fusing the dual constraints of the structure topology and the material attribute, forming a comprehensive evaluation of the electrical connector model attribution and quality level, and significantly improving the accuracy, comprehensiveness and engineering practicability of the electrical connector detection.
[0006] The technical scheme of the present application is as follows: A machine vision-based electrical connector detection method, the method comprising: establishing a triple group template data and a template structure topological graph of the electrical connector, and obtaining an electrical connector binary mask; generating a topological graph structure matching value according to the electrical connector binary mask and the template structure topological graph; generating an electrical connector foreground image according to the electrical connector binary mask and an electrical connector image, performing material matching processing on the electrical connector foreground image, and generating a material attribute matching degree; performing matching degree calculation on the topological graph structure matching value and the material attribute matching degree, and obtaining an electrical connector change image, and generating an electrical connector detection result according to the electrical connector change image.
[0007] Specifically, establishing a triple group template data and a template structure topological graph of the electrical connector, and obtaining an electrical connector binary mask, comprises: after disassembling the electrical connector, establishing a triple group template data and a template structure topological graph of the electrical connector, the triple group template data comprising: structure data, geometric partition data and material attribute data; obtaining an electrical connector image of the electrical connector, performing edge detection on the electrical connector image, and obtaining an electrical connector binary mask.
[0008] Specifically, after disassembling the electrical connector, a triple group template data and a template structure topological graph of the electrical connector are established, the triple group template data comprising: structure data, geometric partition data and material attribute data; comprising: disassembling the physical structure of the electrical connector, and identifying the structure unit of the electrical connector; performing template construction on the structure unit of the electrical connector according to a preset triple structure; assigning an independent structure identifier to each structure unit, and constructing a triple group template data and a template structure topological graph.
[0009] Specifically, comprising: generating an electrical connector topological graph according to the electrical connector binary mask; The electrical connector topology graph and the template structure topology graph are matched by a subgraph isomorphism algorithm to generate a topology graph structure matching value.
[0010] Specifically, an electrical connector foreground image is generated according to the electrical connector binary mask and the electrical connector image, and material matching processing is performed on the electrical connector foreground image to generate a material attribute matching degree, including: The electrical connector binary mask and the electrical connector image are superimposed, and a foreground region is screened out to generate an electrical connector foreground image; Optical feature analysis is performed on the electrical connector foreground image to obtain foreground image material features; The Euclidean distance between the foreground image material features and the material attribute data is calculated to generate a material attribute matching degree.
[0011] Specifically, a matching degree calculation is performed on the topology graph structure matching value and the material attribute matching degree, and an electrical connector change image is obtained, and an electrical connector detection result is generated according to the electrical connector change image, including: The topology graph structure matching value and the material attribute matching degree are matched to generate an electrical connector comprehensive matching degree; According to the electrical connector comprehensive matching degree, the triple template data corresponding to the electrical connector image is obtained; According to the structure data in the triple template data, non-rigid changes are performed on the electrical connector foreground image to obtain an electrical connector change image; According to the electrical connector change image, a graph morphology analysis is performed, and an electrical connector detection result is generated.
[0012] Specifically, according to the electrical connector change image, a graph morphology analysis is performed, and an electrical connector detection result is generated, including: According to the electrical connector detection result, a graph morphology analysis is performed, and a local morphology factor is generated; According to the local morphology factor, a local difference value is generated; According to the local difference value, an electrical connector detection result is generated.
[0013] Specifically, an electrical connector detection system based on machine vision is also provided, and the system includes: A binary mask acquisition module is configured to establish triple template data and template structure topology graph of an electrical connector, and acquire an electrical connector binary mask; A structure matching generation module is configured to generate a topology graph structure matching value according to the electrical connector binary mask and the template structure topology graph; The attribute matching generation module is configured to generate an electrical connector foreground image according to the electrical connector binary mask and the electrical connector image, perform material matching processing on the electrical connector foreground image, and generate a material attribute matching degree. The detection result generation module is configured to perform matching degree calculation on the topological graph structure matching value and the material attribute matching degree, and obtain an electrical connector change image, and generate an electrical connector detection result according to the electrical connector change image.
[0014] Specifically, the binary mask acquisition module is further configured to: after disassembling the electrical connector, establish a triple group template data and a template structure topological graph of the electrical connector, the triple group template data including: structure data, geometric partition data and material attribute data; acquire an electrical connector image of the electrical connector, and perform edge detection on the electrical connector image to obtain an electrical connector binary mask.
[0015] Specifically, the binary mask acquisition module is further configured to: disassemble the physical structure of the electrical connector, and identify a structure unit of the electrical connector; perform template construction on the structure unit of the electrical connector according to a preset triple structure; assign an independent structure identifier to each structure unit, and construct a triple group template data and a template structure topological graph.
[0016] Specifically, the structure matching generation module is further configured to: generate an electrical connector topological graph according to the electrical connector binary mask; and perform matching on the electrical connector topological graph and the template structure topological graph through a subgraph isomorphism algorithm to generate a topological graph structure matching value.
[0017] Specifically, the attribute matching generation module is further configured to: superimpose the electrical connector binary mask and the electrical connector image, and filter out a foreground region to generate an electrical connector foreground image; perform optical feature analysis on the electrical connector foreground image to obtain a foreground image material feature; calculate a Euclidean distance between the foreground image material feature and the material attribute data to generate a material attribute matching degree.
[0018] Specifically, the detection result generation module is further configured to: perform matching degree calculation on the topological graph structure matching value and the material attribute matching degree to generate an electrical connector comprehensive matching degree; obtain triple group template data corresponding to the electrical connector image according to the electrical connector comprehensive matching degree; perform non-rigid change on the electrical connector foreground image according to the structure data in the triple group template data to obtain an electrical connector change image; perform graph morphology analysis according to the electrical connector change image, and generate an electrical connector detection result.
[0019] Specifically, the detection result generation module is further configured to: perform graph pattern analysis according to the electrical connector detection result, and generate a local morphology factor; generate a local difference value according to the local morphology factor; and generate an electrical connector detection result according to the local difference value.
[0020] Optionally, a computer device is also provided, which comprises a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above-mentioned machine vision-based electrical connector detection method when executing the computer program.
[0021] Optionally, a computer readable storage medium is also provided, which stores a computer program, and the computer program implements the steps of the above-mentioned machine vision-based electrical connector detection method when executed by a processor.
[0022] The present application relates to machine learning and image recognition technology, which achieves the following technical effects: (1) By constructing a standard triple template containing structure data, geometric partition data and material attribute data and a template structure topology graph, combining real-time image acquisition and edge detection, connected component analysis, subgraph isomorphism matching, optical feature analysis and non-rigid transformation, etc. Key technologies, multi-dimensional detection of electrical connector structure topology, material properties and local morphology is realized. By calculating the topology graph structure matching value, material attribute matching degree and comprehensive matching degree, and based on the difference analysis of the local morphology factor and the preset threshold value, the structure abnormality, material deviation or morphology defect of the electrical connector can be accurately located, forming a complete detection process from feature modeling to defect warning; (2) By subgraph isomorphism algorithm, the electrical connector topology graph and the template structure topology graph are matched, which can effectively analyze the spatial relationship (including, adjacent, sequential, etc.) between each structure unit (such as terminal pin, shell skeleton, positioning buckle, etc.) of the electrical connector, and realize semantic-level verification of structure topology through quantitative matching of nodes and edges (number of successfully matched nodes, consistent edge number ratio). This method breaks through the limitation of traditional detection which only focuses on single geometric size, and can quickly identify hidden defects caused by abnormal structure unit layout or connection relationship error, ensuring the overall structural integrity and functional reliability of the electrical connector; (3) By calculating the Euclidean distance between the foreground image material feature and the material attribute data to obtain the material attribute matching degree, the material type (such as phosphor bronze, nylon) and physical properties (surface roughness, reflectivity) of each structure unit of the electrical connector can be quantitatively analyzed. This process converts optical features (reflectivity, contrast, reflectivity, etc.) into comparable numerical indicators, realizing the leap from qualitative description to quantitative detection of material properties, and accurately identifying performance risks caused by material deviation or surface treatment defects. BRIEF DESCRIPTION OF DRAWINGS
[0023] Figure 1 a flowchart of a method for detecting an electrical connector based on machine vision in an embodiment; Figure 2 a block diagram of a structure of a system for detecting an electrical connector based on machine vision in an embodiment; Figure 3 a block diagram of a structure of a computer device in an embodiment. DETAILED DESCRIPTION
[0024] In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular architectures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, circuits, and
[0025] It will be understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0026] It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0027] As used in the description of the application and the appended claims, the term "if' can be interpreted to mean "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [a described condition or event] is detected" can be interpreted to mean "upon determining" or "in response to determining" or "upon [the described condition or event] being detected" or "in response to [the described condition or event] being detected," depending on the context.
[0028] In addition, the description in the specification and the appended claims of this application uses the term "first," "second," "third," etc. to refer to different elements, components, steps, etc. in order to distinguish between them. However, it should be understood that these designations are merely used to distinguish between the different elements, components, steps, etc. and are not intended to imply or suggest relative importance of the different elements, components, steps, etc.
[0029] Reference within the specification to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places within specified
[0030] In one embodiment, a terminal is provided, configured to: establish triad template data and template structure topology map of an electrical connector, and acquire an electrical connector binary mask; generate a topology structure matching value according to the electrical connector binary mask and the template structure topology map; generate an electrical connector foreground image according to the electrical connector binary mask and an electrical connector image, perform material matching processing on the electrical connector foreground image, and generate a material attribute matching degree; perform matching degree calculation on the topology structure matching value and the material attribute matching degree, and obtain an electrical connector change image, and generate an electrical connector detection result according to the electrical connector change image.
[0031] The terminal can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
[0032] In one embodiment, as shown in Figure 1 An electrical connector detection method based on machine vision is provided, and the method includes: Step S100: Establish triad template data and template structure topology map of an electrical connector, and acquire an electrical connector binary mask; Step S200: Generate a topology structure matching value according to the electrical connector binary mask and the template structure topology map; Step S300: Generate an electrical connector foreground image according to the electrical connector binary mask and an electrical connector image, perform material matching processing on the electrical connector foreground image, and generate a material attribute matching degree; Step S400: Perform matching degree calculation on the topology structure matching value and the material attribute matching degree, obtain an electrical connector change image, and generate an electrical connector detection result according to the electrical connector change image.
[0033] In the present application, a ternary template data and a template structure topology graph of the electrical connector are established, and a binary mask of the electrical connector is obtained; a topology graph structure matching value is generated according to the binary mask of the electrical connector and the template structure topology graph; an electrical connector foreground image is generated, and a material attribute matching degree is generated; a matching degree calculation is performed on the topology graph structure matching value and the material attribute matching degree, and an electrical connector change image is obtained, and an electrical connector detection result is generated according to the electrical connector change image. The present application calculates the comprehensive matching degree of the electrical connector by combining the topology graph structure matching value and the material attribute matching degree, can fuse the dual constraints of structure topology and material attribute, form a comprehensive evaluation of the model attribution and quality level of the electrical connector, and improve the accuracy of the electrical connector detection.
[0034] In one embodiment, step S100: establishing ternary template data and template structure topology graph of the electrical connector, and obtaining binary mask of the electrical connector, comprises: Step S110: after disassembling the electrical connector, ternary template data and template structure topology graph of the electrical connector are established, and the ternary template data comprises: structure data, geometric partition data and material attribute data; Step S120: obtaining an electrical connector image of the electrical connector, performing edge detection on the electrical connector image, and obtaining a binary mask of the electrical connector.
[0035] In the present embodiment, in order to establish ternary template data and template structure topology graph of the electrical connector, the ternary template data and the template structure topology graph of the electrical connector are established after disassembling the electrical connector, and the ternary template data comprises: structure data, geometric partition data and material attribute data. Then, in order to perform topology comparison subsequently, the binary mask of the electrical connector needs to be generated first, so that the electrical connector image of the electrical connector is obtained, edge detection is performed on the electrical connector image, and the binary mask of the electrical connector is obtained.
[0036] In one embodiment, step S110: after disassembling the electrical connector, ternary template data and template structure topology graph of the electrical connector are established, and the ternary template data comprises: structure data, geometric partition data and material attribute data; comprising: Step S110: disassembling the physical structure of the electrical connector, and identifying the structure unit of the electrical connector; Step S120: constructing a template according to a preset ternary structure for the structure unit of the electrical connector; Step S130: giving an independent structure identification to each structure unit, and constructing ternary template data and template structure topology graph.
[0037] In this example, the physical structure of the electrical connector is first disassembled to identify and define key structural units, such as the terminal pins, housing frame, and positioning clips, as the basic objects for template modeling. A typical electrical connector sample, such as the JSTPH series 2.0mm pitch connector, is manually disassembled to separate the terminal pins, nylon housing, metal clips, and other components. Basic dimensions, such as pin diameter and housing wall thickness, are measured using precision calipers. Typical pin diameters range from 0.3 to 0.6 mm, and typical housing wall thicknesses range from 0.8 to 1.2 mm.
[0038] Next, a template is constructed for the structural unit of each electrical connector according to the preset ternary structure of "structural area + geometric partition data + material property data".
[0039] The structural area defines the connections between structural units, such as the distance between terminal pins and retaining clips, which should be less than 2mm. The geometric area extracts parameters such as the shape, size, and spatial position of each unit and sets tolerances, such as pin diameter, housing aspect ratio, and pin pitch. Material properties indicate the material type and physical properties, such as phosphor bronze for metal elastic components, nylon for insulating injection molding, and its surface roughness. Each structural unit is then assigned a unique structural identifier, and the functional, geometric, and material properties are linked to the identifier to form structured data. It should be noted that the "structural area + geometric area + material attribute" ternary structure is used to construct each connector model. For example, for an electrical connector terminal pin; the structural area specifies the distance between the terminal pin and retaining clip, which should be less than 2mm. Geometric areas include rectangular / circular shapes with diameters of 0.3-1.0mm, lengths of 3-10mm, and array pitch accuracy of ±0.05mm. Material properties include glossiness, contrast, and reflectivity.
[0040] A template topology diagram is then constructed to illustrate the spatial relationships between the various structural features of the electrical connector. Nodes represent the connector's structural elements, while edges describe relationships such as containment, adjacency, and order, along with parameter constraints. Finally, the triplet template data and the template topology diagram form a template database. Matching verification is performed on typical models, and parameters are adjusted to ensure template robustness. This provides semantic-level structural constraints and prior knowledge for subsequent image reconstruction and detection.
[0041] In one embodiment, step S120: obtaining an electrical connector image of the electrical connector, performing edge detection on the electrical connector image, and obtaining a binary mask of the electrical connector, as follows: First, edge detection is performed on the electrical connector image using the Sobel operator to find closed areas, such as rectangular shells, circular pins, and trapezoidal buckles. Each area is regarded as a "node" and a preliminary semantic label is given to each node, such as "suspected shell" and "suspected pin".
[0042] Further, the step of performing edge detection on the electrical connector image by a Sobel operator:
[0043] wherein, is a horizontal gradient value of the electrical connector image at coordinate (x, y); is a vertical gradient value of the electrical connector image at coordinate (x, y); is a pixel value of the electrical connector image at coordinate (x, y); is a horizontal gradient operator of the Sobel operator; is a vertical gradient operator of the Sobel operator.
[0044] It should be noted that the Sobel operator is an image processing operator for edge detection, which has high calculation efficiency, real-time practicability, and can improve the calculation efficiency when processing large-scale images.
[0045] Specifically, the weights of the left (-1) and right (+1) pixels of the convolution kernel of the Sobel operator are set to opposite values. If the value of the left pixel is large (i.e., dark area) and the value of the right pixel is small (i.e., bright area), a large positive value will be caused, and vice versa. The weight of the middle row is 0, which means that the current pixel value does not directly affect the result. The purpose of this design is to only focus on the difference between the left and right pixels, without considering the current pixel. The weights of the upper and lower rows (-1 and 1) are equal, but the weights of the middle row are twice those of the upper and lower rows (-2 and 2). This means that the pixels of the upper and lower rows have a greater impact.
[0046] According to the horizontal gradient value and the vertical gradient value, the gradient amplitude and the corresponding gradient direction of the electrical connector image are calculated: ; ; wherein, is a gradient amplitude of the electrical connector image at coordinate (x, y); is a gradient direction of the electrical connector image at coordinate (x, y); is a horizontal gradient value of the electrical connector image at coordinate (x, y); is a vertical gradient value of the electrical connector image at coordinate (x, y).
[0047] For the gradient amplitude and the gradient direction of the electrical connector image at coordinate (x, y), an edge intensity image NMS(x, y) is obtained by a non-maximum suppression method. Specifically, the gradient direction of the electrical connector image at coordinate (x, y) is discretized into four main directions :
[0048] wherein, are four main directions after discretization, is the gradient direction of the electrical connector image at coordinates (x, y).
[0049] The adjacent pixels to be compared are determined by the four main directions after discretization:
[0050] wherein, are the coordinates of two adjacent pixels of the electrical connector image at coordinates (x, y), x and y are horizontal and vertical coordinates, are four main directions after discretization.
[0051] The non-maximum suppression calculation is performed:
[0052] wherein, is the edge intensity image, is the gradient magnitude of the electrical connector image at coordinates (x, y), and is the gradient magnitude of two adjacent pixels of the electrical connector image at coordinates (x, y), are the coordinates of two adjacent pixels of the electrical connector image at coordinates (x, y).
[0053] The edge intensity image is processed using morphological operations to remove noise, fill small holes, connect broken edges, and obtain the connected domain part of the edge intensity image, and the morphological operations include but are not limited to traditional methods such as dilation, erosion, and opening operation.
[0054] The edge intensity image is binarized to obtain an electrical connector binary mask:
[0055] wherein, is the binary mask, is the edge intensity image.
[0056] It should be noted that the connected domain part of the edge intensity image is also the connected domain part of the binary mask. Therefore, the application binarizes the result obtained after non-maximum suppression, divides the pixel values of the image into 0 and 1, and changes the pixel values contained in the connected domain in the edge intensity to 1, and changes the pixel values that are not in the connected domain to 0.
[0057] In one embodiment, step S200: generating a topology structure matching value according to the electrical connector binary mask and the template structure topology; comprising: Step S210: generating an electrical connector topology map according to the electrical connector binary mask; Step S220: matching the electrical connector topology graph and the template structure topology graph using a subgraph isomorphism algorithm to generate a topology structure matching value.
[0058] In this embodiment, for each connected domain of the binary mask, each area of the electrical connector is identified by the contour features of the connected domain, namely the aspect ratio of the connected domain and the roundness of the connected domain. First, the aspect ratio of the connected domain is calculated:
[0059] Where AR is the aspect ratio of the connected domain, W is the width of the connected domain, and H is the height of the connected domain. It should be noted that for each connected domain (a region consisting of adjacent target pixels) in the binary mask, when calculating the aspect ratio of the connected domain, the smallest rectangle that exactly contains all the pixels in the connected domain is obtained. The width of this rectangle is the horizontal distance between the left and right boundaries of the rectangle, and the height of the rectangle is the vertical distance between the upper and lower boundaries. The width and height of this rectangle are used as the width and height of the connected domain to calculate the aspect ratio of the connected domain.
[0060] Next, calculate the circularity of the connected domain:
[0061] Among them, C is the circularity of the connected domain, P is the perimeter of the connected domain, and A is the area of the connected domain.
[0062] It should be noted that the perimeter of a connected domain is the total Euclidean length of the connected domain contour chain code, and the area of a connected domain is the total number of pixels contained in the connected domain.
[0063] In addition, the area of the electrical connector corresponding to the connected domain is determined by the morphological characteristics of each connected domain. The aspect ratio, roundness and area are used to determine the type of the connected domain. The connected domain is roughly divided first to reduce the influence of noise. For example, the area A is small (such as <1000 pixels) and the aspect ratio is large. The connected domain with large area (such as 3-10) and low roundness (such as 0.2-0.4) is determined as the terminal pin area of the electrical connector; the connected domain with moderate area A (such as 1000-5000 pixels), moderate aspect ratio AR (such as 1.5-3), and moderate roundness (such as 0.4-0.7) is divided into the buckle area; the connected domain with high area A (such as >5000 pixels), moderate aspect ratio AR (1-3), and high roundness C (such as 0.7-0.9) is determined as the shell area. Further division is performed, for example, for the shell area, the connected domain with roundness >0.8 and aspect ratio 1.2 is divided into a cylindrical shell, and the shell region with a circularity <0.8 and an aspect ratio >1.2 is divided into a rectangular shell.
[0064] By performing connected component analysis on the binary mask of the electrical connector, an electrical connector topology graph is constructed, for example, a large rectangular contour (node A, labeled "shell") is detected in the binary mask; 8 small circular contours (nodes B1-B8, labeled "pin"); a trapezoidal contour (node C, labeled "clasp").
[0065] Then, the spatial relationship parameters between nodes are calculated as the attributes of "edges". For example, the inclusion relationship, specifically if all circular nodes are located inside the rectangular node → edge A-Bi (i=1-8) is labeled "contains". For example, the adjacent relationship, if the distance between the trapezoidal node and the right edge of the rectangular node is <0.5mm → edge A-C is labeled "right adjacent". Also, the arrangement relationship, specifically, the 8 circular nodes are equally spaced horizontally → edge Bi-Bi+1 is labeled "equidistant linear arrangement". The nodes of the electrical connector topology graph and the template structure topology graph are grouped according to the type of the nodes.
[0066] Next, candidate matching pairs are constructed, specifically for each node of the template structure topology graph, a list of nodes in the electrical connector topology graph that match in type is generated.
[0067] Then, a backtracking search matching path is performed, specifically starting from the root node of the template structure topology graph, for example, from the shell, recursively attempting to map the nodes of the template structure topology graph to the nodes of the electrical connector topology graph, and verifying that the connection relationships of the edges are consistent, for example, the spacing error between two pins in the electrical connector topology graph and the template structure topology graph is less than a threshold value, for example, recursively attempting to map a depth-first traversal starting from the root node (such as the shell node): first select the electrical connector nodes of the corresponding type (such as all connected domains labeled "shell") as the initial candidate for the template root node; for each candidate node, recursively verify whether its child nodes (such as the terminal pins contained by the shell) exist in the electrical connector topology graph with type matching and consistent spatial relationship corresponding nodes - for example, check if the pin nodes are inside the candidate shell (inclusion relationship), the distance between adjacent clasps is <0.5mm (adjacent relationship), and the pin spacing is equidistant (sequential relationship); if a branch fails, backtrack to the upper node and replace the candidate; if all child nodes are successfully mapped and the edge relationship error is within the threshold (such as pin spacing tolerance ±0.05mm), a complete matching path is formed, and finally the proportion of successfully mapped nodes and the proportion of edges with consistent relationships are calculated to generate a topology graph structure matching value (PP value).
[0068] Next, the electrical connector topology graph and the template structure topology graph are matched by a subgraph isomorphism algorithm to obtain a topology graph structure matching value:
[0069] wherein PP is a topology structure matching value, represents the number of successfully matched nodes, is the total number of nodes of the template structure topology graph, is the number of consistent edges between the matched nodes, is the total number of edges of the template structure topology graph, is a node matching weight, is an edge relationship matching weight, + = 1.
[0070] It should be noted that when the structural integrity is greater than the spatial relationship, for example, the pin / housing missing is more serious than the mismatch of the spacing, 0.7 can be taken, 0.3 can be taken; when the spatial relationship > structural integrity, for example, matching high-precision connectors, 0.3 can be taken, 0.7 can be taken; when the structural integrity is equal to the spatial relationship, for example, automobile electrical connectors (need to ensure structure and assembly at the same time), at this time and 0.5 can be taken.
[0071] It should be noted that the topology graph of the electrical connector is matched with the template structure topology graph by the subgraph isomorphism algorithm, and the topology structure matching value is obtained, so as to realize the semantic level verification and quantitative evaluation of the spatial relationship of the structure unit of the electrical connector. Specifically, the template structure topology graph constructs a standard structure model of the electrical connector through nodes (such as terminal pins, housing skeletons, etc. structure units) and edges (such as containing, adjacent, sequential, etc. spatial relationship and parameter constraints), and the topology graph of the electrical connector extracts the structure units and their spatial relationship based on the connected domain analysis of the real-time image.
[0072] Through the recursive matching and constraint verification (such as node type matching, edge connection relationship and parameter error threshold judgment) of the subgraph isomorphism algorithm, it can be accurately analyzed whether the actual electrical connector has problems such as structure unit missing, layout abnormality or connection relationship error, for example, the pin is not contained in the housing, the buckle adjacent distance is out of tolerance, etc.
[0073] The topology structure matching value (PP value) quantifies the structural consistency through the ratio of the number of successfully matched nodes and the number of consistent edges, which provides a key index of the structure topology dimension for subsequent comprehensive matching degree calculation, so that the detection process can not only identify single geometric size deviation, but also determine the design compliance of the electrical connector from the overall level of “structure unit-spatial relationship”, effectively making up for the missed detection of traditional detection methods for implicit structural defects, and laying a structured analysis foundation for multi-dimensional quality evaluation.
[0074] In one embodiment, step S310: generating an electrical connector foreground image according to the electrical connector binarization mask and the electrical connector image, performing material matching processing on the electrical connector foreground image to generate a material attribute matching degree, comprising: Step S310: superimposing the electrical connector binarization mask and the electrical connector image and screening out a foreground region to generate an electrical connector foreground image; Step S320: performing optical feature analysis on the electrical connector foreground image to obtain foreground image material characteristics; Step S330: calculating the Euclidean distance between the foreground image material characteristics and the material attribute data to generate a material attribute matching degree.
[0075] In this embodiment, the electrical connector binarization mask and the electrical connector image are superimposed and the foreground region is screened out to obtain an electrical connector foreground image:
[0076] Wherein, is the electrical connector foreground image, is the binarization mask, is the pixel of the electrical connector image at coordinates (x, y).
[0077] It should be noted that the foreground region screened out by superimposing the binarization mask and the electrical connector image is also a connected domain region of the binarization mask, and the foreground region of the electrical connector image has color, while the connected domain region of the binarization mask has a pixel value of 1. In addition, it should be noted that superimposing the electrical connector binarization mask and the electrical connector image and screening out the foreground region to obtain the electrical connector foreground image has the core significance of realizing accurate segmentation of the electrical connector target region and the background. The binarization mask has clearly defined the outline of the electrical connector and the connected domain of each structural unit (such as the shell, the pin, the buckle, etc.) through edge detection and morphological operation, and the region with a pixel value of 1 corresponds to the actual physical structure of the electrical connector. After superimposing it with the original electrical connector image, the foreground region of the electrical connector can be accurately extracted from the original image based on the connected domain range of the mask, the irrelevant background noise is stripped, and then the subsequent optical feature analysis (such as material characteristic extraction of reflectivity, contrast, reflectivity, etc.) of the foreground image can focus on the structural units of the electrical connector itself, avoiding feature deviation caused by background interference.
[0078] Meanwhile, combined with the constructed electrical connector topology graph, each region in the foreground image can be clearly labeled as a specific structural unit (such as "pin" "shell"), thereby forming a semantic-level corresponding relationship with the material attribute (such as phosphor bronze gold plating, surface reflectivity of nylon material) in the standard triple template data, laying a foundation for calculating the Euclidean distance of the foreground image material feature and the template material attribute data, and realizing accurate matching of the material attribute.
[0079] In general, this step is the key link between image preprocessing and material detection, ensuring the pertinence and accuracy of material analysis, and thus improving the reliability of the overall detection process.
[0080] Based on the electrical connector topology graph, the type of each foreground region in the electrical connector foreground image (such as terminal pin, buckle, etc.) is known, and by performing optical feature analysis on each foreground region of the electrical connector foreground image, the foreground image material feature , [ ]i=1,2,3,..., j=1,2,3,..., , is the i-th material feature of the j-th foreground region of the electrical connector foreground image, is the total number of features of the foreground region material feature, is the total number of foreground regions.
[0081] Wherein, the optical feature analysis refers to the quantitative extraction process of the surface optical properties of each classified foreground region (such as terminal pin, shell skeleton, positioning buckle, etc.) in the electrical connector foreground image: first, in a standard light source environment (usually using a 45° ring LED light source), calculate the maximum reflectivity of the metal terminal pin region (the 95th percentile of the region's gray value, reflecting the metal plating luster), the gray standard deviation of the plastic shell region (characterizing the uniformity of injection molding texture), and the reflectivity gradient of the buckle edge (the gray scale change rate along the normal direction, judging the surface oxidation degree); At the same time, analyze the material type (such as phosphor bronze showing brass color, nylon showing low saturation gray) by combining the saturation histogram of the HSV color space, and finally integrate the optical parameters such as reflectivity, texture contrast, and reflectivity distribution into a dimensionally normalized feature vector, providing quantifiable physical characteristic indicators for subsequent material attribute matching.
[0082] It should be noted that by performing optical feature analysis on each foreground region of the electrical connector foreground image, the optical feature analysis includes the reflectivity, contrast, and reflectivity of each foreground region.
[0083] Next, by calculating the Euclidean distance of the foreground image material feature and the material attribute data, the material attribute matching degree is obtained as follows:
[0084] wherein CL is the material attribute matching degree, is the total number of foreground regions, j is the index of the jth foreground region, is the total number of feature of material attribute of foreground region, i is the index of the feature of material attribute of foreground region, is the i-th feature of material attribute of the j-th foreground region of the electrical connector foreground image, is the i-th feature of material attribute of the j-th foreground region of the material attribute data.
[0085] It should be noted that the material attribute matching degree (CL) realizes the quantitative evaluation of the material deviation through multi-level mapping: first, the Euclidean distance between the optical feature vector (containing reflectivity, contrast, reflectivity, etc. n1-dimensional parameters) of each foreground region (such as terminal pin) and the template material attribute data is calculated to obtain the single-region material deviation; Then, the distance values of all foreground regions (a total of n2) are arithmetically averaged to obtain the overall material deviation; Then, through the arctangent function arctan, the deviation is nonlinearly mapped to the interval (0, π / 2) to suppress extreme value disturbance; Finally, multiply the coefficient 2 / π to normalize the output to the range (0, 1), and take the reciprocal, wherein CL tends to 1, which represents that the material completely meets the standard (such as the reflectivity of phosphor bronze plating reaching the standard), and CL tends to 0, which represents a serious deviation (such as surface oxidation causing abnormal reflectivity), realizing scientific conversion from multi-dimensional optical features to a single quality score.
[0086] In one embodiment, step S400: the topology graph structure matching value and the material attribute matching degree are matched to calculate the matching degree, and an electrical connector change image is obtained, and an electrical connector detection result is generated according to the electrical connector change image, including: Step S410: The topology graph structure matching value and the material attribute matching degree are matched to calculate the matching degree, and an electrical connector comprehensive matching degree is generated; Step S420: According to the electrical connector comprehensive matching degree, the triple template data corresponding to the electrical connector image is obtained; Step S430: According to the structure data in the triple template data, the electrical connector foreground image is subjected to non-rigid change to obtain an electrical connector change image; Step S440: According to the electrical connector change image, a graph morphology analysis is performed, and an electrical connector detection result is generated.
[0087] In this embodiment, the topology graph structure matching value and the material attribute matching degree are combined to calculate the electrical connector comprehensive matching degree:
[0088] Wherein, ZP is the comprehensive matching degree of the electrical connector, PP is the topological graph structure matching value, and CL is the material attribute matching degree.
[0089] The embodiment quantifies the risk of defect synergy by constructing the comprehensive matching degree ZP of the electrical connector.
[0090] Specifically, the numerator (PP*CL) requires that the structure and material must meet the standard at the same time to have basic matching value, emphasizing that defects in any dimension will significantly reduce product reliability; the denominator introduces (1-PP)(1-CL) to build a double-defect penalty mechanism, which will sharply increase (up to 1) when the structure is mismatched (PP is low) and the material is abnormal (CL is low), causing the ZP value to drop sharply, simulating the risk multiplication phenomenon of chain failure caused by composite defects in industrial scenarios. The PP*CL in the denominator keeps the formula stable and convergent, preventing numerical explosion, for example, if PP is 0.99 and CL is 0.99, without PP*CL in the denominator, at this time .
[0091] Therefore, such a nonlinear design, on the one hand, maintains tolerance in the presence of a single defect, such as PP being 0.9 and CL being 1, ZP being 0.94, and on the other hand, imposes exponential punishment on double defects, such as PP being 0.7 and CL being 0.7, ZP being 0.66, so that the evaluation result directly maps the failure probability of the electrical connector under complex working conditions.
[0092] Next, the triple template data corresponding to the electrical connector image with the maximum comprehensive matching degree of the electrical connector is selected, and the electrical connector foreground image is non-rigidly changed according to the length ratio of the geometric data in the triple template data.
[0093] Specifically, the feature point set P of the electrical connector foreground image is defined as , is the oth feature point of the electrical connector foreground image, N is the total number of feature points, and the geometric data in the triple template data contains the ideal distance set of feature points , represents the ideal distance of the kth pair of feature points, M is the total number of ideal distances of the kth pair of feature points in the template feature point ideal distance set, and the length ratio constraint is calculated as: wherein, is the length ratio of the kth pair of feature points, and are the kth pair of feature points of the template feature point set.
[0094] It should be noted that the feature point set of the electrical connector foreground image is a set of key position points extracted from the electrical connector foreground image. These feature points correspond to the geometric features of the various structural units of the electrical connector (such as the terminal pin end points, the shell corners, the positioning buckle edges, etc.), and are used to characterize the actual structural form of the electrical connector. The feature point set is obtained by marking and extracting the key positions such as the outlines and corners of each structural unit in the foreground image. Each feature point is expressed in coordinates ( ) represents its position in the image, and N is the total number of feature points. These feature points not only carry the spatial position information of each structural unit of the electrical connector, but also form a corresponding relationship with the geometric data in the standard triplet template data, serving as the basic input for non-rigid transformations. During the thin plate spline transformation process, the feature point set is compared with the ideal distance set of the template feature points to calculate the length ratio constraint, driving the deformation function to perform nonlinear adjustments to the foreground image. This achieves high-precision structural alignment between the detection object and the standard template, thereby eliminating interference on detection accuracy caused by factors such as image acquisition perspective and deformation, and providing a unified benchmark for subsequent local morphological analysis.
[0095] Furthermore, the deformation function of the thin plate spline transformation method is:
[0096] in, is the deformation function, which means mapping the point p of the foreground image of the electrical connector to the target position p+u(p), where u(p) is the displacement vector, u(p)=( (p), (p)), (p) is the elastic displacement of point p in the x-axis direction, (p) represents the nonlinear distortion of point p in the y-axis direction, is the coefficient vector of the oth control point, U() is the radial basis function, N is the total number of feature points, and o is the index of the oth feature point.
[0097] It should be noted that the deformation function of the thin plate spline transformation method simulates the non-rigid deformation of the image as the elastic bending behavior of a thin metal plate, and constructs the displacement field by minimizing the bending energy (i.e., the integral of the square of the second-order derivative); the first term on the right side of the equation Represents the original coordinates (deformation reference), and the second displacement vector u(p) is formed by linear superposition of radial basis functions U(), where It is a control point coefficient vector, which is obtained by solving the distance constraints between feature point pairs (such as the ratio of the pin spacing to the length of the template geometry data) and the bending energy minimization objective function to ensure that the relative positions of adjacent structural units after transformation (such as the terminal pin spacing) are consistent with the template.
[0098] Specifically, the energy objective function is as follows:
[0099] wherein, is an energy minimization objective function, is a bending stiffness regularization coefficient, default is 0.1, M is the total number of ideal distances of feature point pairs of the template feature point set, denotes the ideal distance of the kth pair of feature points, and is the kth pair of feature points of the template feature point set, and is the kth pair of feature points of the electrical connector foreground image, denotes the point of the electrical connector foreground image, is mapped to the target position +u( ), is a deformation function, which denotes the point of the electrical connector foreground image, is mapped to the target position +u( ), denotes the second-order partial derivative of the displacement vector in the x direction, is the mixed second-order partial derivative of the displacement vector u with respect to x and y,
[0100] denotes the second-order partial derivative of the displacement vector in the y direction. By least squares, the nonlinear coefficients and affine coefficients of the deformation function are solved in the case of minimizing the energy objective function. Finally, we get: = wherein, is the electrical connector variation image,
[0101] denotes the mapping variation of the electrical connector foreground image by the deformation function. Specifically, denotes the distance of the kth pair of feature points in the electrical connector image after the thin plate spline transformation, is subtracted from
[0102] and squared, which is a nonlinear amplification of the deviation. In one embodiment, step S440: according to the electrical connector variation image, a graph morphology analysis is performed, and an electrical connector detection result is generated, including: Step S441: according to the electrical connector detection result, a graph morphology analysis is performed, and a local morphology factor is generated; Step S442: a local difference value is generated according to the local morphology factor; Step S443: an electrical connector detection result is generated according to the local difference value.
[0103] In this embodiment, for each foreground region in the electrical connector change image, a local morphological factor of the foreground region is calculated, which includes the curvature, symmetry, etc. of the foreground region.
[0104] By calculating the difference between the local morphological factor and the geometric partition data, a local difference value is obtained:
[0105] wherein, is the local difference value of the jth foreground region, is the local morphological factor of the jth foreground region in the electrical connector change image, is the jth local morphological factor of the geometric partition data, is the inverse of the covariance matrix of the local morphological factor of the electrical connector image and the local morphological factor of the geometric partition data.
[0106] When the local difference value is greater than a preset threshold, the system will trigger a multi-level early warning mechanism: first, real-time warning is performed through sound and light signals, and at the same time, the abnormal region in the electrical connector change image is marked in the form of a visual heat map on the operation interface, and is accurately positioned to a specific structural unit (such as a terminal pin, a shell skeleton, or a positioning buckle, etc.). Combined with the topological graph structure information, the system can further analyze the defect type, for example: if the local difference value of the terminal pin region exceeds the limit, it can be determined that the pin is deformed; if the local difference value of the shell region exceeds the limit, it indicates that there is an injection defect or assembly offset, and a detection report containing the defect position and type is automatically generated, which provides accurate basis for subsequent repair, process adjustment or quality traceability, realizes the whole-process closed loop from defect detection to positioning analysis-cause tracing-decision support, and significantly improves the intelligentization and refinement level of electrical connector detection.
[0107] Therefore, the electrical connector detection method based on machine vision of the present application realizes multi-dimensional detection of the structure topology, material attribute and local morphology of the electrical connector by constructing a standard triple template including structure data, geometric partition data and material attribute data and a template structure topological graph, combining real-time image acquisition and edge detection, connected domain analysis, subgraph isomorphism matching, optical feature analysis and non-rigid transformation, etc. key technologies. By calculating the topological graph structure matching value, the material attribute matching degree and the comprehensive matching degree, and based on the difference analysis of the local morphological factor and the preset threshold, the structure anomaly, material deviation or morphology defect of the electrical connector can be accurately positioned, forming a complete detection process from feature modeling to defect early warning.
[0108] Then, using a subgraph isomorphism algorithm, the electrical connector topology is matched with the template structural topology. This effectively analyzes the spatial relationships (including inclusion, adjacency, and order) between the various structural elements of the electrical connector (such as terminal pins, housing skeleton, and positioning clips). This method also achieves semantic-level verification of the structural topology through quantitative node and edge matching (number of successfully matched nodes and percentage of consistent edges). This method transcends the limitations of traditional inspection, which focuses solely on single geometric dimensions, and can quickly identify hidden defects caused by abnormal structural unit layout or incorrect connection relationships, ensuring the overall structural integrity and functional reliability of the electrical connector.
[0109] Next, by calculating the Euclidean distance between the material features of the foreground image and the material property data, the material property match is determined. This allows for quantitative analysis of the material type (e.g., phosphor bronze, nylon) and physical properties (surface roughness, reflectivity) of each structural unit of the electrical connector. This process converts optical characteristics (reflectivity, contrast, reflectivity, etc.) into comparable numerical indicators, transforming material properties from qualitative description to quantitative detection. This allows for precise identification of performance risks caused by material deviations or surface treatment defects, providing a scientific basis for material consistency testing of electrical connectors.
[0110] Finally, by combining the topological structure matching value with the material property matching to calculate the comprehensive matching degree of the electrical connector, the dual constraints of structural topology and material properties can be integrated to form a comprehensive assessment of the model attribution and quality level of the electrical connector. Based on the comprehensive matching degree, the optimal template is selected and non-rigid transformation is performed to eliminate the influence of factors such as image acquisition perspective and deformation on the detection accuracy, so that the detection object and the standard template can be aligned with high precision. The local morphological analysis carried out on this basis can further achieve accurate positioning and degree quantification of defect positions by calculating the differences in factors such as curvature and symmetry, and finally build an intelligent detection closed loop from "multi-dimensional feature matching" to "defect location warning", significantly improving the accuracy, comprehensiveness and engineering practicality of electrical connector detection.
[0111] In one embodiment, Figure 2 As shown, a machine vision-based electrical connector detection system is also provided, the system comprising: A binary mask acquisition module is used to establish triple template data and a template structure topology diagram of the electrical connector, and to obtain a binary mask of the electrical connector; A structure matching generation module, configured to generate a topology structure matching value based on the electrical connector binary mask and the template structure topology; an attribute matching generation module, configured to generate an electrical connector foreground image based on the electrical connector binary mask and the electrical connector image, perform material matching processing on the electrical connector foreground image, and generate a material attribute matching degree; The detection result generation module is configured to perform matching degree calculation on the topology graph structure matching value and the material attribute matching degree, and obtain an electric connector change image, and generate an electric connector detection result according to the electric connector change image.
[0112] In one embodiment, the binarization mask acquisition module is further configured to, after disassembling the electric connector, establish a triple group template data and a template structure topology graph of the electric connector, the triple group template data including structure data, geometric partition data and material attribute data; acquire an electric connector image of the electric connector, and perform edge detection on the electric connector image to obtain an electric connector binarization mask.
[0113] In one embodiment, the binarization mask acquisition module is further configured to disassemble the physical structure of the electric connector, and identify a structure unit of the electric connector; perform template construction on the structure unit of the electric connector according to a preset triple group structure; assign an independent structure identifier to each structure unit, and construct a triple group template data and a template structure topology graph.
[0114] In one embodiment, the structure matching generation module is further configured to generate an electric connector topology graph according to the electric connector binarization mask; and perform matching on the electric connector topology graph and the template structure topology graph through a subgraph isomorphism algorithm to generate a topology graph structure matching value.
[0115] In one embodiment, the attribute matching generation module is further configured to superimpose the electric connector binarization mask and the electric connector image, and filter out a foreground region to generate an electric connector foreground image; perform optical feature analysis on the electric connector foreground image to obtain a foreground image material feature; calculate a Euclidean distance between the foreground image material feature and the material attribute data to generate a material attribute matching degree.
[0116] In one embodiment, the detection result generation module is further configured to perform matching degree calculation on the topology graph structure matching value and the material attribute matching degree to generate an electric connector comprehensive matching degree; obtain triple group template data corresponding to the electric connector image according to the electric connector comprehensive matching degree; perform non-rigid change on the electric connector foreground image according to the structure data in the triple group template data to obtain an electric connector change image; perform graph morphology analysis according to the electric connector change image, and generate an electric connector detection result.
[0117] In one embodiment, the detection result generation module is further configured to perform graph morphology analysis according to the electric connector detection result, and generate a local morphology factor; generate a local difference value according to the local morphology factor; and generate an electric connector detection result according to the local difference value.
[0118] In one embodiment, as Figure 3As shown, a computer device is also provided, comprising a memory and a processor, the memory storing a computer program and an operating system, the processor implementing the steps of the above machine vision-based separation detection method for a screening surface of a separator when executing the computer program. The computer device further comprises a system bus, an internal memory, a network structure, a display screen, an input device, and the like.
[0119] In one embodiment, a computer-readable storage medium is also provided, which stores a computer program, the computer program being executed by a processor to implement the steps of the above machine vision-based electrical connector detection method.
[0120] It should be noted that the information interaction, execution process and the like between the above modules are based on the same concept as the method embodiments of the present application, and the specific functions and technical effects brought about can be referred to the method embodiments part, which will not be repeated here.
[0121] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above division of each functional unit and module is exemplified, and in actual application, the above functions can be completed by different functional units and modules according to needs, i.e., the internal structure of the device is divided into different functional units or modules to complete all or part of the above-described functions. Each functional unit and module in the embodiments can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit, and the integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the above system can refer to the corresponding process in the above method embodiments, which will not be repeated here.
[0122] It should be noted that the information interaction, execution process and the like between the above modules are based on the same concept as the method embodiments of the present application, and the specific functions and technical effects brought about can be referred to the method embodiments part, which will not be repeated here.
[0123] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is exemplified, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to complete all or part of the above described functions. Each functional unit or module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit. In addition, the specific name of each functional unit or module is only for convenient distinction, and does not limit the protection scope of the present application. The specific working process of the unit or module in the system can refer to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0124] The embodiments of the present application further provide a network device, which comprises at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps in any of the method embodiments described above when executing the computer program.
[0125] The embodiments of the present application further provide a computer readable storage medium, which stores a computer program, wherein the computer program is executable on a processor to implement the steps in any of the method embodiments described above.
[0126] The embodiments of the present application provide a computer program product, which, when running on a mobile terminal, enables the mobile terminal to implement the steps in any of the method embodiments described above.
[0127] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the present application can implement all or part of the processes in the above-mentioned embodiment methods through a computer program to instruct relevant hardware to complete, and the computer program can be stored in a computer readable storage medium. When the computer program is executed by a processor, the steps of each method embodiment described above can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms. The computer readable medium can at least include any entity or device capable of carrying the computer program code to the photographing device / terminal equipment, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium can not be an electrical carrier signal and a telecommunication signal.
[0128] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0129] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be realized by electronic hardware, or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0130] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / network device and method can be implemented in other ways. For example, the above-described apparatus / network device embodiments are merely schematic, for example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed each other can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0131] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e., may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0132] The above-described embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
[0133] An embodiment of the present application further provides a computer device, the computer device of the embodiment comprising: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps in any of the above methods when executing the computer program.
[0134] The computer device can include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the above description is an example of the computer device, and does not constitute a limitation on the computer device, and can include more or fewer components than the above description, or combine certain components, or different components, for example, can also include input / output devices, network access devices, etc.
[0135] The processor can be a central processing unit (CPU), and the processor can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0136] The memory can be an internal storage unit of the computer device in some embodiments, such as a hard disk or a memory of the computer device. The memory can also be an external storage device of the computer device in other embodiments, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, and the like. Further, the memory can include both an internal storage unit and an external storage device of the computer device. The memory is used to store an operating system, an application program, a boot loader, data, and other programs, such as program codes of the computer program, and the like. The memory can also be used to temporarily store data that has been output or is to be output.
[0137] The technical features of the above embodiments can be combined in any manner. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described, but it should be understood that any combination of the technical features is within the scope of the present disclosure as long as the combination does not result in a contradiction.
[0138] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the scope of the present application. It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present application, and these are within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A method for detecting an electrical connector based on machine vision, characterized in that: The method comprises: Establishing triplet template data and template structure topology of the electrical connector, and obtaining a binary mask of the electrical connector; Generate a topology structure matching value according to the electrical connector binary mask and the template structure topology; generating an electrical connector foreground image based on the electrical connector binary mask and the electrical connector image, performing material matching processing on the electrical connector foreground image to generate a material property matching degree; A matching degree calculation is performed on the topological structure matching value and the material property matching degree, and an electrical connector change image is obtained, and an electrical connector detection result is generated according to the electrical connector change image.
2. The method for detecting an electrical connector based on machine vision according to claim 1, wherein: Establishing the triplet template data and template structure topology of the electrical connector and obtaining the binary mask of the electrical connector includes: After disassembling the electrical connector, establishing triple template data and a template structure topology diagram of the electrical connector, wherein the triple template data includes: structure data, geometric partition data, and material attribute data; An electrical connector image of the electrical connector is acquired, and edge detection is performed on the electrical connector image to obtain a binary mask of the electrical connector.
3. The method for detecting electrical connectors based on machine vision according to claim 2, wherein: After disassembling the electrical connector, a triplet template data and a template structure topology diagram of the electrical connector are established, wherein the triplet template data includes: structure data, geometric partition data and material attribute data; including: Disassemble the physical structure of the electrical connector and identify the structural units of the electrical connector; Building a template for the structural unit of the electrical connector according to a preset ternary structure; Each structural unit is given an independent structural identifier, and triple template data and template structure topology graph are constructed.
4. The method for detecting electrical connectors based on machine vision according to claim 1, wherein: Generating a topology structure matching value according to the electrical connector binary mask and the template structure topology; comprising: generating an electrical connector topology map according to the electrical connector binary mask; The electrical connector topology graph and the template structure topology graph are matched by a subgraph isomorphism algorithm to generate a topology structure matching value.
5. The method for detecting electrical connectors based on machine vision according to claim 1, wherein: Generating an electrical connector foreground image according to the electrical connector binary mask and the electrical connector image, performing material matching processing on the electrical connector foreground image to generate a material property matching degree, including: Superimposing the electrical connector binary mask and the electrical connector image and filtering out the foreground area to generate an electrical connector foreground image; Performing optical feature analysis on the foreground image of the electrical connector to obtain material features of the foreground image; The Euclidean distance between the material features of the foreground image and the material attribute data is calculated to generate a material attribute matching degree.
6. The method for detecting electrical connectors based on machine vision according to claim 1, wherein: Calculating the matching degree of the topological structure matching value and the material property matching degree to obtain an electrical connector change image, and generating an electrical connector detection result based on the electrical connector change image, including: Performing a matching calculation on the topological structure matching value and the material property matching to generate a comprehensive matching degree of the electrical connector; Obtaining triplet template data corresponding to the electrical connector image according to the comprehensive matching degree of the electrical connector; Performing a non-rigid change on the electrical connector foreground image according to the structural data in the triplet template data to obtain a changed electrical connector image; Perform image morphology analysis based on the electrical connector change image and generate an electrical connector detection result.
7. The method for detecting electrical connectors based on machine vision according to claim 1, wherein: Performing image morphology analysis based on the electrical connector change image and generating an electrical connector detection result includes: Performing a morphological analysis based on the electrical connector detection result and generating a local morphological factor; generating a local difference value according to the local morphological factor; An electrical connector detection result is generated according to the local difference value.
8. An electrical connector detection system based on machine vision, characterized in that: The system comprises: A binary mask acquisition module is used to establish triple template data and a template structure topology diagram of the electrical connector, and to obtain a binary mask of the electrical connector; A structure matching generation module, configured to generate a topology structure matching value based on the electrical connector binary mask and the template structure topology; an attribute matching generation module, configured to generate an electrical connector foreground image based on the electrical connector binary mask and the electrical connector image, perform material matching processing on the electrical connector foreground image, and generate a material attribute matching degree; The detection result generating module is used to perform matching degree calculation on the topological structure matching value and the material property matching degree, obtain an electrical connector change image, and generate an electrical connector detection result according to the electrical connector change image.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Electrical connector detecting device and method based on machine vision
CN108269255A
Circuit board detection method and system based on machine vision
CN120563463A
Cable bridge fault detection method and system based on deep learning
CN120563471A
Method and system for machine vision detection
US11151405B1
Radiation detector module including application specific integrated circuit with through-substrate vias
US20240134071A1
Cited By
Metering acquisition full-scene automatic simulation detection method and system
CN121978449A