Method and system for detecting position deviation of electrical pin, and electronic equipment
By determining the reference area and detection point in the electrical pin detection system, obtaining the standard template and confirming the alignment area, the problems of low efficiency and high error rate of human identification of electrical pin pin position offset are solved, and efficient and accurate are achieved detection effect.
Patent Information
- Application Number
- CN202510045116.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-02-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, artificially identifying the problems of skewed or top displacement of electrical pins is low efficiency and has a high error rate, which affects production and shipment efficiency.
By detecting the offset state of the electrical pin, it is applied to the detection plane that intersects the extension direction of the electrical pin, determines the reference area and reference point, obtains the standard template, confirms the alignment area and detection point, and determines whether the electrical pin is There is a position offset.
Improves the efficiency and accuracy of electrical pin position offset detection, reduces the fatigue and error rate of manual identification, and improves production efficiency and shipment yield.
Smart Images

Figure CN119437046A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of visual processing technology, and specifically relates to a method, system and electronic device for detecting electrical pin position deviation. Background Art
[0002] With the advancement of automobile technology, energy storage technology and electronic control technology, the development of electric vehicles is becoming more and more mature. Compared with fuel vehicles, due to the green travel mode and lower cost of electric vehicles, consumers are more inclined to choose electric vehicles as a means of transportation, making the market share of electric vehicles increase day by day.
[0003] The electric control equipment used to control the energy storage battery in electric vehicles includes a BMU (Battery Management Unit), which is connected to the energy storage device through a wiring harness. The port in the BMU used to connect the wiring harness is equipped with a PIN (electrical pin) needle, which realizes the electrical connection between the wiring harness and the BMU through the electrical pin needle. However, the electrical pin needle is mostly a slender metal needle-shaped piece, which is very easy to produce skew or top displacement during production, making it impossible for the needle head to align with the connection hole on the wiring harness, resulting in difficulty in plugging, affecting production, and even causing contact failure. However, the efficiency of manual identification is low, and the identification error rate is high, which inevitably reduces the delivery efficiency and yield. Summary of the invention
[0004] Purpose of the invention: This application develops a method, system and electronic device for detecting the position deviation of electrical pins, aiming to solve the technical problems of low efficiency and high error rate in the prior art of manually identifying the problem of skewness or top displacement of electrical pins.
[0005] Technical solution: In the first aspect, the present application provides a method for detecting the position offset of an electrical pin needle, which is used to detect the offset state of the electrical pin needle in a workpiece to be tested. The detection method is applied to a detection plane intersecting with the extension direction of the electrical pin needle, comprising: Confirming a reference area and a reference point, wherein the reference area is a projection area of an area outside the electrical pin in the workpiece on the detection plane, and the reference point is a point in the projection area of the electrical pin on the detection plane; Acquire a standard template for characterizing the reference area and the reference point based on a standard workpiece; Acquire a detection image of the workpiece to be detected, and confirm an alignment area in the detection image based on the standard template, where the alignment area is a corresponding area of the reference area in the detection image; Based on the relative positional relationship between the reference area and the reference point, and taking the alignment area as a reference, confirming a first detection point in the detection image; extracting image elements from the detection image, and confirming a second detection point based on the image elements; In response to the distance between the first detection point and the second detection point being outside a distance threshold, it is determined that the electrical pin is positionally offset.
[0006] In some embodiments, the step of acquiring a standard template for characterizing the reference area and the reference point based on a standard workpiece includes: confirming a standard coordinate system based on the standard workpiece; The position of the reference area and the position of the reference point are confirmed in the standard coordinate system, and the relative position relationship between the center point of the reference area and the reference point is confirmed to obtain the standard template.
[0007] In some embodiments, the step of confirming the alignment area in the detection image based on the standard template includes: confirming a detection coordinate system based on the detection image; In the detection image, performing template matching based on the reference area to obtain a preliminary position of the alignment area; Based on the position of the center point of the reference area in the standard coordinate system, the position of the detection image is adjusted in the detection coordinate system so that the center point of the alignment area is aligned with the center point of the reference area, and the final position of the alignment area is obtained.
[0008] In some embodiments, the step of confirming the first detection point in the detection image based on the relative positional relationship between the reference area and the reference point and taking the alignment area as a reference comprises: Acquire the relative position relationship between the center point of the reference area and the reference point; The center point of the alignment area is acquired, and based on the relative positional relationship between the center point of the reference area and the reference point, the first detection point is confirmed in the detection image with the center point of the alignment area as a reference.
[0009] In some embodiments, the image element includes a grayscale value of a pixel, and the step of extracting the image element from the detection image and confirming the second detection point based on the image element includes: Confirming a search area in the detection image, wherein the image in the search area includes a grayscale image; Determining the grayscale value of a pixel in the grayscale image; Identify the grayscale value range used to distinguish pixel clusters; In the grayscale image, based on the grayscale value of the pixel point and the grayscale value range, binary large object processing is performed to identify a target pixel cluster; The centroid of the target pixel cluster is determined to be the second detection point.
[0010] In some embodiments, the step of performing binary large object processing based on the grayscale value of the pixel point and the grayscale value range to confirm the target pixel cluster includes: Determine a target pixel point, the target pixel point being the pixel point whose grayscale value satisfies the grayscale value range; Confirm the search box; In the search area, the search box is used to select the target area, and the target pixel point number meets the target pixel number threshold. The target area is subjected to binary large object processing to identify a target pixel cluster.
[0011] In some embodiments, the detection method is applied to a detection plane perpendicular to an extension direction of the electrical pins.
[0012] In a second aspect, an embodiment of the present application provides a detection system for position offset of an electrical pin needle, which is used to detect the offset state of an electrical pin needle in a workpiece to be tested, and the detection system is applied to a detection plane intersecting with the extension direction of the electrical pin needle, comprising: A reference confirmation module, used to confirm a reference area and a reference point, wherein the reference area is a projection area of an area outside the electrical pin in the workpiece on the detection plane, and the reference point is a point in the projection area of the electrical pin on the detection plane; A template confirmation module, used for acquiring a standard template for characterizing the reference area and the reference point based on a standard workpiece; An alignment region confirmation module, used for acquiring a detection image of the workpiece to be detected, and confirming an alignment region in the detection image based on the standard template, wherein the alignment region is a corresponding region of the reference region in the detection image; A first detection point confirmation module, configured to confirm a first detection point in the detection image based on a relative positional relationship between the reference area and the reference point and taking the alignment area as a reference; A second detection point confirmation module is used to extract image elements from the detection image and confirm a second detection point based on the image elements; The position offset determination module is configured to determine that the electrical pin has a position offset in response to a distance between the first detection point and the second detection point being outside a distance threshold.
[0013] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program executable by the processor, and when the processor executes the computer program, the steps of the method for detecting the position offset of an electrical pin as described in any one of the first aspects are implemented.
[0014] Beneficial effect: Compared with the prior art, the present invention provides a method for detecting the position offset of an electrical pin needle, which is used to detect the offset state of an electrical pin needle in a workpiece to be tested, and is applied to a detection plane intersecting with the extension direction of the electrical pin needle. First, a reference area and a reference point are determined, and then a standard template for aligning and matching images is determined through the reference area and the reference point in the standard workpiece; after obtaining the detection image, the alignment area is determined through the corresponding position of the reference area in the reference template in the detection image, and then the position of the first detection point is determined in the detection image with the alignment area as a reference through the relative position relationship between the reference area and the reference point. The first detection point is a point aligned with the reference point in the detection image, and is also a reference point for position offset determination; an image element is determined, and a second detection point is confirmed in the detection image based on the image element, and the second detection point is a target point for position offset determination; by determining whether the distance between the first detection point and the second detection point is outside the distance threshold, it is determined whether the electrical pin needle has position offset. The method for detecting the position offset of an electrical pin needle provided by the present invention can replace manual position offset detection, does not have manual fatigue properties, and has high detection efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 A flowchart of the steps of a method for detecting an electrical pin position deviation provided in an embodiment of the present application; Figure 2 A specific flow chart of step 200 in the method for detecting the position deviation of an electrical pin provided in an embodiment of the present application; Figure 3 A specific flow chart of step 300 in the method for detecting the position deviation of an electrical pin provided in an embodiment of the present application; Figure 4 A specific flow chart of step 400 in the method for detecting the position deviation of an electrical pin provided in an embodiment of the present application; Figure 5A specific flow chart of step 500 in the method for detecting the position deviation of an electrical pin provided in an embodiment of the present application; Figure 6 A module connection diagram of a detection system for electrical pin position deviation provided in an embodiment of the present application; Figure 7 A structural connection diagram of an electronic device provided in an embodiment of the present application; Figure 8 An image of an alignment area and a center point of the alignment area in a plane perpendicular to the length direction of the electrical pin in the method for detecting the position deviation of the electrical pin provided in an embodiment of the present application (the center coordinates in the figure are the coordinates of the center point of the alignment area); Fig. 9 An image of a first detection point determined in a plane perpendicular to the length direction of the electrical pin in the method for detecting the position deviation of the electrical pin provided in an embodiment of the present application; Fig.10 An image of a second detection point determined in a plane perpendicular to the length direction of the electrical pin in the method for detecting the position deviation of the electrical pin provided in an embodiment of the present application; Figure numerals: 10, reference confirmation module; 20, template confirmation module; 30, alignment area confirmation module; 40, first detection point confirmation module; 50, second detection point confirmation module; 60, position offset determination module; 100, memory; 200, processor. DETAILED DESCRIPTION
[0017] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0018] With the advancement of automobile technology, energy storage technology and electronic control technology, the development of electric vehicles is becoming more and more mature. Compared with fuel vehicles, due to the green travel mode and lower cost of electric vehicles, consumers are more inclined to choose electric vehicles as a means of transportation, making the market share of electric vehicles increase day by day.
[0019] The electric control equipment used to control the energy storage battery in electric vehicles includes a BMU (Battery Management Unit), which is connected to the energy storage device through a wiring harness. The port in the BMU used to connect the wiring harness is equipped with a PIN (electrical pin) needle, which realizes the electrical connection between the wiring harness and the BMU through the electrical pin needle. However, the electrical pin needle is mostly a slender metal needle-shaped piece, which is very easy to produce skew or top displacement during production, making it impossible for the needle head to align with the connection hole on the wiring harness, resulting in difficulty in plugging, affecting production, and even causing contact failure. However, the efficiency of manual identification is low, and the identification error rate is high, which inevitably reduces the delivery efficiency and yield.
[0020] In view of this, the embodiment of the present application provides a detection method for the position offset of an electrical pin needle, which is used to detect the offset state of an electrical pin needle in a workpiece to be tested, and is applied to a detection plane intersecting with the extension direction of the electrical pin needle. First, a reference area and a reference point are determined, and then a standard template for aligning and matching images is determined through the reference area and the reference point in the standard workpiece; after obtaining the detection image, the alignment area is determined through the corresponding position of the reference area in the reference template in the detection image, and then the position of the first detection point is determined in the detection image with the alignment area as a reference through the relative position relationship between the reference area and the reference point. The first detection point is a point aligned with the reference point in the detection image, and is also a reference point for position offset determination; an image element is determined, and a second detection point is confirmed in the detection image based on the image element, and the second detection point is a target point for position offset determination; by determining whether the distance between the first detection point and the second detection point is outside the distance threshold, it is determined whether the electrical pin needle has position offset. The detection method for the position offset of an electrical pin needle provided in the embodiment of the present application can replace manual position offset detection, does not have manual fatigue properties, and has high detection efficiency and accuracy.
[0021] In some embodiments, see Figure 1 , Figure 1 The flowchart of the step of the method for detecting the position deviation of the electrical pin provided in the embodiment of the present application is specifically implemented through steps 100 to 600: The detection method of the electrical pin position offset provided in the embodiment of the present application is used to detect the offset state of the electrical pin in the workpiece to be tested, for example, it can be used to detect the offset state of the electrical pin on the BMU (Battery Management Unit), BDU (Battery Disconnect Unit) and PDU (Power Distribution Unit). It is applied to the detection plane that intersects with the extension direction of the electrical pin, specifically, the detection plane is perpendicular to the extension direction of the electrical pin, that is, perpendicular to the length direction of the electrical pin.
[0022] Step 100: confirming a reference area and a reference point, wherein the reference area is a projection area of an area outside the electrical pins in the workpiece in the detection plane, and the reference point is a point in the projection area of the electrical pins in the detection plane.
[0023] In some embodiments, the present application determines a reference area and a reference point in a plane perpendicular to the length direction of the electrical pin needle. The embodiments of the present application perform position offset detection on the electrical pin needle of the BMU, and during the detection process, the rectangular area to which the connector above the electrical pin needle belongs is determined as the reference area. It can be understood that the contour shape of the reference area should be a regular, symmetrical polygon so that the midpoint of the reference area can be found in subsequent steps. Specifically, the reference area can be a symmetrical triangle, rectangle, square, pentagon, hexagon or other shape. The reference area in the present application is a symmetrical rectangle. At the same time, the center point of the orthographic projection of the electrical pin needle in the length direction is determined as the reference point.
[0024] Step 200: Acquire a standard template for characterizing a reference area and reference points based on a standard workpiece.
[0025] In some embodiments, see Figure 2 , Figure 2 This is a specific flow chart of step 200 in the method for detecting the position deviation of the electrical pin provided in the embodiment of the present application. The method for obtaining the standard template in the present application is implemented through steps 210 to 220: Step 210: Confirm the standard coordinate system based on the standard workpiece.
[0026] Step 220: confirm the position of the reference area and the position of the reference point in the standard coordinate system, and confirm the relative position relationship between the center point of the reference area and the reference point to obtain a standard template.
[0027] It can be understood that after determining the reference area and the reference point in the plane perpendicular to the length direction of the electrical pin needle, the present application uses a product without electrical pin position deviation and skew as the standard workpiece, and obtains a standard image in the plane perpendicular to the length direction of the electrical pin needle of the standard workpiece. In the standard image, two orthogonal coordinate axes are set along the horizontal and vertical extensions to establish a standard coordinate system. In the standard coordinate system, the position of the reference area and the position of the reference point are confirmed, and the relative position relationship between the center point of the reference area and the reference point is confirmed to obtain a standard template for use in subsequent steps.
[0028] Step 300: Acquire a test image of the workpiece to be tested, and confirm an alignment area in the test image based on a standard template, where the alignment area is a corresponding area of the reference area in the test image.
[0029] In some embodiments, see Figure 3 , Figure 3 This is a specific flow chart of step 300 in the method for detecting the position deviation of the electrical pin provided in the embodiment of the present application. The method for confirming the alignment area in the present application is specifically implemented through steps 310 to 330: Step 310: Confirm the detection coordinate system based on the detection image.
[0030] Step 320: In the detection image, perform template matching based on the reference area to obtain a preliminary position of the alignment area; Step 330: Based on the position of the center point of the reference area in the standard coordinate system, adjust the position of the detection image in the detection coordinate system so that the center point of the alignment area is aligned with the center point of the reference area, and obtain the final position of the alignment area.
[0031] Understandably, see Figure 8 , Figure 8In the detection method for the position deviation of the electrical pin needle provided in the embodiment of the present application, the image of the alignment area and the center point of the alignment area is determined in a plane perpendicular to the length direction of the electrical pin needle. After the standard template is determined in the plane perpendicular to the length direction of the electrical pin needle, the image acquisition is performed on the workpiece to be measured in the plane perpendicular to the length direction of the electrical pin needle to obtain the detection image of the workpiece to be measured. In the detection image, two orthogonal coordinate axes are respectively set along the horizontal and longitudinal extensions to establish a detection coordinate system. The standard template is slid on the detection image, and the matching degree of the reference area in the detection image is calculated during the sliding process. The area with the highest matching degree or the position that meets the matching degree threshold is obtained as the alignment area to obtain the preliminary position of the alignment area. After determining the preliminary position of the alignment area, the center point of the alignment area is found, and based on the positional relationship between the center point of the reference area and the reference point obtained in the previous step, the position of the detection image is adjusted in the detection coordinate system so that the center point of the alignment area is aligned with the center point of the reference area, and the final position of the alignment area is determined.
[0032] Specifically, methods for calculating the matching degree of the reference area in the detection image include a normalized correlation coefficient method, a square difference method, a cross-correlation method, and the like.
[0033] Specifically, when determining the position of the alignment region, the position of the maximum matching degree is determined by functions such as cv2.minMaxLoc() (in OpenCV).
[0034] Step 400: Based on the relative positional relationship between the reference area and the reference point, the first detection point is confirmed in the detection image with the alignment area as a reference.
[0035] In some embodiments, see Figure 4 , Figure 4 This is a specific flow chart of step 400 in the method for detecting the position deviation of the electrical pin provided in an embodiment of the present application. The method for confirming the first detection point in the present application is implemented through steps 410 to 420: Step 410: Obtain the relative position relationship between the center point of the reference area and the reference point.
[0036] Step 420: Acquire the center point of the alignment area, and based on the relative positional relationship between the center point of the reference area and the reference point, confirm the first detection point in the detection image with the center point of the alignment area as a reference.
[0037] Understandably, see Figure 8 and Fig. 9 , Figure 8 In the method for detecting the position deviation of the electrical pin provided in the embodiment of the present application, an image of the alignment area and the center point of the alignment area is determined in a plane perpendicular to the length direction of the electrical pin, Fig. 9In the detection method for the position deviation of the electrical pin provided in the embodiment of the present application, an image of the first detection point is determined in a plane perpendicular to the length direction of the electrical pin. In the detection coordinate system, the image of the first detection point is determined based on the relative position relationship between the center point of the reference area and the reference point, with the center point of the alignment area as the reference. Fig. 9 shown.
[0038] Step 500: extracting image elements from the detection image, and confirming a second detection point based on the image elements.
[0039] See also Figure 5 , Figure 5 This is a specific flow chart of step 500 in the method for detecting the position deviation of the electrical pin provided in the embodiment of the present application. The method for confirming the second detection point in the present application is specifically implemented through steps 510 to 550: Step 510: Confirm a search area in the detection image, where the image in the search area includes a grayscale image.
[0040] Step 520: Determine the grayscale value of the pixel in the grayscale image.
[0041] Step 530: Determine the grayscale value range used to distinguish pixel clusters.
[0042] Step 540: In the grayscale image, based on the grayscale value and grayscale value range of the pixel points, perform binary large object processing to identify the target pixel cluster.
[0043] In some embodiments, when determining a target pixel cluster, the target pixel points are first determined. Specifically, the pixel points with grayscale values of 1-255 are sorted in descending order from high to low, and the top 5% of the pixel points with the highest grayscale values are determined as the target pixel points, wherein the range of the grayscale values of the top 5% of the pixel points with the highest grayscale values is the grayscale value range in this application. In specific implementation, the percentage value can be determined based on the actual engineering accuracy requirements. Then a search box is determined for performing area selection in the search area. In this application, the search box is a rectangular box. Next, it is determined that the selected area whose number of target pixels meets the quantity threshold is the target area. Finally, binary large object processing is performed on the target area to confirm the target pixel cluster.
[0044] Step 550: Confirm that the centroid of the target pixel cluster is the second detection point.
[0045] Understandably, see Fig.10 , Fig.10In the detection method for the position offset of the electrical pin needle provided in the embodiment of the present application, an image of the second detection point is determined in a plane perpendicular to the length direction of the electrical pin needle. In the detection image, the position of the actual projection point of the electrical pin needle is determined as the retrieval area, and the retrieval area is grayed to obtain a gray image of the retrieval area. The grayed retrieval image can also be directly obtained when taking a photo, or the image is grayed after taking a photo. In the gray image of the retrieval area, the gray value of each pixel is determined, and then the gray value range used to distinguish the pixel groups is confirmed, so as to cluster the pixels in the retrieval area. Perform binary large object (BLOB) analysis, divide the pixels whose gray values meet the gray value range requirements into a pixel group, and confirm them as the target pixel cluster, and divide the pixels whose gray values do not meet the gray value range requirements into another pixel group to achieve binarization. Confirm the centroid of the target pixel cluster as the second detection point.
[0046] Step 600: In response to the distance between the first detection point and the second detection point being outside a distance threshold, determining that there is a position offset of the electrical pin.
[0047] It can be understood that the detection method of electrical pin position offset provided in the embodiment of the present application is used to detect the offset state of the electrical pin in the workpiece to be tested, and is applied to the detection plane intersecting with the extension direction of the electrical pin. First, the reference area and the reference point are determined, and then the standard template for aligning and matching the image is determined by the reference area and the reference point in the standard workpiece; after the detection image is acquired, the alignment area is determined by the corresponding position of the reference area in the reference template in the detection image, and then the position of the first detection point is determined in the detection image with the alignment area as the reference through the relative position relationship between the reference area and the reference point. The first detection point is a point aligned with the reference point in the detection image and is also a reference point for position offset determination; the image element is determined, and the second detection point is confirmed based on the image element in the detection image. The second detection point is the target point for position offset determination; by determining whether the distance between the first detection point and the second detection point is outside the distance threshold, it is determined whether the electrical pin has position offset. The detection method of electrical pin position offset provided in the embodiment of the present application can replace manual position offset detection, there is no manual fatigue attribute, and the detection efficiency and accuracy are high.
[0048] Accordingly, see Figure 6 , Figure 6 The module connection diagram of the detection system for the position deviation of the electrical pin needle provided in the embodiment of the present application, the embodiment of the present application also provides a detection system for the position deviation of the electrical pin needle, which is used to detect the deviation state of the electrical pin needle in the workpiece to be tested, and the detection system is applied to the detection plane intersecting with the extension direction of the electrical pin needle, including: The reference confirmation module 10 is used to confirm the reference area and the reference point, the reference area is the projection area of the area outside the electrical pin needle in the workpiece in the detection plane, and the reference point is the point in the projection area of the electrical pin needle in the detection plane; A template confirmation module 20, for acquiring a standard template for characterizing a reference area and a reference point based on a standard workpiece; An alignment region confirmation module 30 is used to obtain a detection image of the workpiece to be detected, and to confirm an alignment region in the detection image based on a standard template, where the alignment region is a corresponding region of the reference region in the detection image; A first detection point confirmation module 40 is used to confirm the first detection point in the detection image based on the relative position relationship between the reference area and the reference point and taking the alignment area as a reference; A second detection point confirmation module 50 is used to extract image elements from the detection image and confirm the second detection point based on the image elements; The position offset determination module 60 is configured to determine that the electrical pin has a position offset in response to the distance between the first detection point and the second detection point being outside a distance threshold.
[0049] In some embodiments, the template confirmation module 20 is specifically used to: Confirm the standard coordinate system based on the standard workpiece; The position of the reference area and the position of the reference point are confirmed in the standard coordinate system, and the relative positional relationship between the center point of the reference area and the reference point is confirmed to obtain a standard template.
[0050] In some embodiments, the alignment area confirmation module 30 is specifically used to: confirming the detection coordinate system based on the detection image; In the detection image, template matching is performed based on the reference area to obtain the preliminary position of the alignment area; Based on the position of the center point of the reference area in the standard coordinate system, the position of the detection image is adjusted in the detection coordinate system so that the center point of the alignment area is aligned with the center point of the reference area, and the final position of the alignment area is obtained.
[0051] In some embodiments, the first detection point confirmation module 40 is specifically used to: Obtain the relative position relationship between the center point of the reference area and the reference point; The center point of the alignment area is obtained, and based on the relative positional relationship between the center point of the reference area and the reference point, the first detection point is confirmed in the detection image with the center point of the alignment area as a reference.
[0052] In some embodiments, the second detection point confirmation module 50 is specifically used to: Confirming a search area in the detection image, the image in the search area including a grayscale image; Confirm the grayscale value of the pixel in the grayscale image; Identify the grayscale value range used to distinguish pixel clusters; In the grayscale image, binary large object processing is performed based on the grayscale value and grayscale value range of the pixel points to confirm the target pixel cluster; The centroid of the target pixel cluster is identified as the second detection point.
[0053] In some embodiments, the second detection point confirmation module 50 is specifically used to: Determine a target pixel point, where the target pixel point is a pixel point whose grayscale value satisfies the grayscale value range; Confirm the search box; In the search area, a search box is used to select the target area, and the target pixel point number that meets the target pixel number threshold is determined as the target area. Perform blob processing on the target area to identify the target pixel cluster.
[0054] Accordingly, see Figure 7 , Figure 7 This is a structural connection diagram of an electronic device provided in an embodiment of the present application. The electronic device provided in an embodiment of the present application includes: The memory 100 and the processor 200 are connected to each other in communication, the memory 100 stores computer instructions, and the processor 200 executes the computer instructions to perform the method for detecting the position deviation of the electrical pin provided in the embodiment of the present application. Specifically, the memory 100 and the processor 200 are connected via a communication bus.
[0055] In some embodiments, the processor 200 may be a central processing unit (CPU). The processor 200 may 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, or a combination of the above chips.
[0056] In some embodiments, the memory 100 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the methods in the method embodiments of the present application. The processor 200 executes various functional applications and data processing of the processor 200 by running the non-transitory software programs, instructions and modules stored in the memory 100, that is, implementing the methods in the above method embodiments.
[0057] In some embodiments, the memory 100 may include a program storage area and a data storage area, wherein the program storage area may store an application required for operating the device or at least one function; the data storage area may store data created by the processor 200, etc. In addition, the memory 100 may include a high-speed random access memory 100, and may also include a non-volatile memory 100, such as at least one disk memory 100, a flash memory device, or other non-volatile solid-state memory 100. In some embodiments, the memory 100 may optionally include a memory 100 remotely arranged relative to the processor 200, and these remote memories 100 may be connected to the processor 200 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0058] In some embodiments, one or more modules are stored in the memory 100 and when executed by the processor 200, the methods in the above method embodiments are performed.
[0059] In some embodiments, the specific details of the above-mentioned electronic device can be understood by referring to the corresponding related descriptions and effects in the above-mentioned method embodiments, and will not be repeated here.
[0060] The present application has introduced in detail a method, system and electronic device for detecting the position deviation of an electrical pin provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for detecting electrical pin position deviation, characterized in that: The method is used to detect the offset state of an electrical pin in a workpiece to be tested, and the detection method is applied to a detection plane intersecting with the extension direction of the electrical pin, comprising: Confirming a reference area and a reference point, wherein the reference area is a projection area of an area outside the electrical pin in the workpiece on the detection plane, and the reference point is a point in the projection area of the electrical pin on the detection plane; Acquire a standard template for characterizing the reference area and the reference point based on a standard workpiece; Acquire a detection image of the workpiece to be detected, and confirm an alignment area in the detection image based on the standard template, where the alignment area is a corresponding area of the reference area in the detection image; Based on the relative positional relationship between the reference area and the reference point, and taking the alignment area as a reference, confirming a first detection point in the detection image; extracting image elements from the detection image, and confirming a second detection point based on the image elements; In response to the distance between the first detection point and the second detection point being outside a distance threshold, it is determined that the electrical pin is positionally offset.
2. The method for detecting the position deviation of an electrical pin according to claim 1, characterized in that: The step of acquiring a standard template for characterizing the reference area and the reference point based on a standard workpiece comprises: confirming a standard coordinate system based on the standard workpiece; The position of the reference area and the position of the reference point are confirmed in the standard coordinate system, and the relative position relationship between the center point of the reference area and the reference point is confirmed to obtain the standard template.
3. The method for detecting the position deviation of an electrical pin according to claim 2, characterized in that: The step of confirming the alignment area in the detection image based on the standard template comprises: confirming a detection coordinate system based on the detection image; In the detection image, performing template matching based on the reference area to obtain a preliminary position of the alignment area; Based on the position of the center point of the reference area in the standard coordinate system, the position of the detection image is adjusted in the detection coordinate system so that the center point of the alignment area is aligned with the center point of the reference area, and the final position of the alignment area is obtained.
4. The method for detecting the position deviation of an electrical pin according to claim 1, characterized in that: The step of confirming the first detection point in the detection image based on the relative positional relationship between the reference area and the reference point and taking the alignment area as a reference comprises: Acquire the relative position relationship between the center point of the reference area and the reference point; The center point of the alignment area is acquired, and based on the relative positional relationship between the center point of the reference area and the reference point, the first detection point is confirmed in the detection image with the center point of the alignment area as a reference.
5. The method for detecting the position deviation of an electrical pin according to claim 1, characterized in that: The image elements include grayscale values of pixels, and the steps of extracting the image elements from the detection image and confirming the second detection point based on the image elements include: Confirming a search area in the detection image, wherein the image in the search area includes a grayscale image; Determining the grayscale value of a pixel in the grayscale image; Identify the grayscale value range used to distinguish pixel clusters; In the grayscale image, based on the grayscale value of the pixel point and the grayscale value range, binary large object processing is performed to identify a target pixel cluster; The centroid of the target pixel cluster is determined to be the second detection point.
6. The method for detecting the position deviation of an electrical pin according to claim 5, characterized in that: The step of performing binary large object processing based on the grayscale value of the pixel point and the grayscale value range to confirm the target pixel cluster comprises: Determine a target pixel point, the target pixel point being the pixel point whose grayscale value satisfies the grayscale value range; Confirm the search box; In the search area, the search box is used to select the target area, and the target pixel point number meets the target pixel number threshold. The target area is subjected to binary large object processing to identify a target pixel cluster.
7. The method for detecting electrical pin position deviation according to claim 1, characterized in that: The detection method is applied to a detection plane perpendicular to the extension direction of the electrical pins.
8. A system for detecting electrical pin position deviation, characterized in that: Used to detect the offset state of an electrical pin in a workpiece to be tested, the detection system is applied to a detection plane intersecting with the extension direction of the electrical pin, comprising: A reference confirmation module (10) is used to confirm a reference area and a reference point, wherein the reference area is a projection area of an area outside the electrical pin in the workpiece on the detection plane, and the reference point is a point in the projection area of the electrical pin on the detection plane; A template confirmation module (20) is used to obtain a standard template for characterizing the reference area and the reference point based on a standard workpiece; An alignment region confirmation module (30) is used to obtain a detection image of the workpiece to be detected, and to confirm an alignment region in the detection image based on the standard template, wherein the alignment region is a corresponding region of the reference region in the detection image; A first detection point confirmation module (40) is used to confirm a first detection point in the detection image based on the relative position relationship between the reference area and the reference point and taking the alignment area as a reference; A second detection point confirmation module (50), used for extracting image elements from the detection image and confirming a second detection point based on the image elements; The position deviation determination module (60) is used for determining that the electrical pin has a position deviation in response to the distance between the first detection point and the second detection point being outside a distance threshold.
9. An electronic device, characterized in that: The invention comprises a memory (100) and a processor (200), wherein the memory (100) stores a computer program executable by the processor (200), and when the processor (200) executes the computer program, the steps of the method for detecting the position deviation of an electrical pin as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Element detection method and device, computer equipment and storage medium
CN111784674A
Template, member to be processed, and alignment method
CN115113496A
Product processing defect detection method and device, storage medium and terminal
CN115619783A
Connector pin position deviation detection method
CN116152147A
Product detection method and device and electronic equipment
CN117147564A
Cited By
Pin coplanarity detection method and system of integrated circuit
CN119850609A
Multifunctional test board card detection method and system based on image analysis
CN119887777A
Alignment detection equipment and method
CN121953816A