A PCB single element recognition method based on variable threshold

By adopting a variable threshold-based recognition method in the PCB graphic editing system, the shortest distance between the cursor and the element is calculated, and the problem of low element recognition efficiency in high-density environments is solved, and more efficient element recognition and lower element recognition are achieved error rate.

CN114049521BActive Publication Date: 2024-12-06ZHEJIANG SHUREN UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111381432.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-21
Publication Date
2024-12-06
Estimated Expiration
2041-11-21

AI Technical Summary

Technical Problem

In the prior art, it is difficult for PCB graphic editing systems to accurately identify entries in high-density environments, resulting in null identification problems and affecting identification efficiency.

Method used

The PCB single element recognition method based on variable threshold is adopted to calculate the shortest distance between the identification cursor and the element and compare it with the associated threshold to achieve accurate identification of the element. The method includes classifying the primitives in the PCB board, establishing a coordinate system, traversing the primitives to determine the shortest distance value, which is suitable for line segments, circles and polygonal primitives.

Benefits of technology

It improves the efficiency of PCB element recognition and reduces the error rate. It is especially suitable for auxiliary manufacturing of high-density PCB boards, and improves the yield rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114049521B_ABST
    Figure CN114049521B_ABST
Patent Text Reader

Abstract

The present invention relates to a PCB single-element recognition method based on a variable threshold value, which calculates the shortest distance between a recognition cursor and any PCB element, compares the shortest distance with a threshold value associated with a PCB element point, and realizes the recognition of the PCB element point. The present invention is particularly suitable for the auxiliary manufacturing of high-density PCB boards, solves the problem of empty recognition of PCB boards in the prior art, improves the recognition efficiency of PCB elements, especially single elements, reduces the error rate, and has a high yield rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of calculation, deduction or counting, and in particular to a PCB single-element recognition method based on a variable threshold, which is applied to a graphic editing technology for PCB auxiliary manufacturing production. Background Art

[0002] PCB is an important electronic component. As the support of electronic components, it is the carrier for the electrical connection of electronic components. With the improvement of manufacturing technology, PCB is developing towards high density.

[0003] Due to the characteristics of PCB primitives such as nanometer-level size, huge number of primitives and irregularity, in the prior art, the commonly used PCB graphic editing system uses whether the primitive is selected by the mouse point as the recognition basis. At present, as the density of primitives on PCB boards is increasing, it is difficult to accurately select the primitives with the mouse in actual operations, which easily leads to the problem of empty primitive recognition, seriously affecting the efficiency of PCB primitive recognition. Summary of the invention

[0004] The present invention solves the problems existing in the prior art, provides an optimized PCB single-element recognition method based on a variable threshold, improves the efficiency of PCB element recognition, and is particularly suitable for high-density PCB boards.

[0005] The technical solution adopted by the present invention is a PCB single-element recognition method based on a variable threshold. The method calculates the shortest distance between the recognition cursor and any PCB element, compares the shortest distance with the threshold associated with the PCB element, and realizes the recognition of a single PCB element.

[0006] Preferably, the method comprises the following steps:

[0007] Step 1: Classify all the graphics elements in the PCB board based on shape, set and store the graphics element classification code and identification information; establish an XOY coordinate system based on the PCB board;

[0008] Step 2: Identify the cursor movement and obtain the corresponding identification cursor P, the coordinates are (x p ,y p );

[0009] Step 3: Use the identification cursor to traverse all stored entities by category, based on the threshold T associated with the PCB entity point s Supplement the identification cursor with the shortest distance value between any PCB element for each element;

[0010] Step 4: Identify the PCB element corresponding to the minimum value among all the shortest distance values.

[0011] Preferably, in step 1, all primitives are divided into line segment primitives, circular primitives and polygonal primitives based on shapes; and the primitive classification codes corresponding to the line segment primitives, circular primitives and polygonal primitives are different from each other.

[0012] Preferably, in step 1, the identification information is a unique identification number corresponding to each graphic element.

[0013] Preferably, in step 3, identifying the line segment primitives that the cursor traverses and stores, and obtaining the shortest distance value comprises the following steps:

[0014] Step 3.1.1: Let the coordinates of the two vertices A and B of any line segment primitive be (x1, y1) and (x2, y2);

[0015] Step 3.1.2: Take the two vertices A and B as endpoints and set auxiliary lines l1 and l2 perpendicular to the line segment primitive respectively;

[0016] Step 3.1.3: If the recognition cursor falls in the space between l1 and l2, the shortest distance between the recognition cursor and the line segment primitive is D L_min =|PE|, where E is the foot of the perpendicular between P and line segment AB;

[0017] If the recognition cursor falls on the space outside l1 or l2, the shortest distance between the recognition cursor and the line segment primitive is D L_min =|PA| or

[0018] If the recognition light falls on l1 or l2, the shortest distance between the recognition cursor and the line segment element is D L_min =|PA| or

[0019] Step 3.1.4: If |D L_min |<T s , then |D L_min | is the shortest distance value and is stored.

[0020] Preferably, in step 3, identifying the circular primitives that the cursor traverses and stores, and obtaining the shortest distance value comprises the following steps:

[0021] Step 3.2.1: Let the center of the circular primitive be C(x c ,y c ), the radius is r;

[0022] Step 3.2.2: Calculate the shortest distance D between the recognition cursor and the circular element C_min ,

[0023] Step 3.2.3: If D C_min≤0, the recognition cursor selects the circular element and stores it with 0 as the shortest distance value; if 0<D C_min <T s , then D C_min The shortest distance value is stored.

[0024] Preferably, in step 3, identifying the polygonal primitives stored by the cursor traversal and obtaining the shortest distance value comprises the following steps:

[0025] Step 3.3.1: Let the vertex coordinate set of the target polygon primitive be P q , P q ={P1(x1,y1),P2(x2,y2),...,P n (x n ,y n )}, n is the number of vertices of the polygon, n≥3;

[0026] Step 3.3.2: Take the edges of the polygonal primitives, corresponding to n line segments P k+1 P k , P k , P k+1 ∈P2, 1≤k≤n-1; with N r_p Count the intersections between the target polygon primitive and either side of the recognition cursor; initialize N r_p is 0;

[0027] Step 3.3.3: If point P is located on any line segment P k+1 P k If the cursor is on, the polygonal primitive is selected and stored with 0 as the shortest distance value; otherwise, from point P, to any line segment P k+1 P k Draw a ray l from any point on the i , if N r_p If is an odd number, the polygonal primitive is selected by the cursor and stored with 0 as the shortest distance value. If it is an even number, the recognition cursor falls outside the polygonal primitive and the next step is performed;

[0028] Step 3.3.4: Initialize i=1;

[0029] Step 3.3.5: Take the i-th edge of the polygonal primitive, and the coordinates of the two vertices of the corresponding edge are P i+1 (x i+1 ,y i+1 ), P i (x i ,y i ), 1≤i≤n-1;

[0030] Step 3.3.6: Use the vector inner product to traverse and calculate the positional relationship R between P and each edge extension line of the polygon primitive p_seg_i , R p_seg_i =(x i -x p )*(y i+1 -y p )-(x i+1 -x p )*(y i -y p );

[0031] Step 3.3.7: Calculate the distance D between P and line segment Pi+1Pi p_ seg_i, for temporary storage;

[0032] Step 3.3.8: If i < n-1, then i = i + 1, repeat step 3.3.5, otherwise proceed to step 3.3.9;

[0033] Step 3.3.9: Remove all temporarily stored D p_seg_i , D R_min =min{D p_seg_i |0<i<n}, with D R_min The shortest distance value is stored.

[0034] Preferably, in step 3.3.7,

[0035] If R p_seg_i >1, then

[0036]

[0037] If R p_seg_i <0, then

[0038]

[0039] In other cases, let d x =x i +R p_seg_i *(x i+1 -x i ), d y =y i +R p_seg_i *(y i+1 -y i ),

[0040]

[0041] Preferably, in step 3, T s =T*Scaling, T is the initial threshold, Scaling is the graph scaling ratio, Scaling>0.

[0042] Preferably, T = |D pel_min | / 2, where |D pel_min | is the minimum distance between any two primitives.

[0043] The present invention relates to an optimized PCB single-element recognition method based on a variable threshold value, which calculates the shortest distance between a recognition cursor and any PCB element, compares the shortest distance with a threshold value associated with a PCB element point, and realizes the recognition of the PCB element point.

[0044] The present invention is particularly suitable for the auxiliary manufacturing of high-density PCB boards, solves the problem of space recognition of PCB boards in the prior art, improves the recognition efficiency of PCB graphics, especially single graphics, reduces the error rate, and has a high yield rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 The present invention is a flow chart of the method. DETAILED DESCRIPTION

[0046] The present invention is further described in detail below in conjunction with embodiments, but the protection scope of the present invention is not limited thereto.

[0047] The invention relates to a PCB single-element recognition method based on a variable threshold value. The method calculates the shortest distance between a recognition cursor and any PCB element, compares the shortest distance with a threshold value associated with the PCB element, and realizes the recognition of a single PCB element.

[0048] The method comprises the following steps:

[0049] Step 1: Classify all the graphics elements in the PCB board based on shape, assign graphics element classification codes and identification information to the classified graphics elements, and store them; establish an XOY coordinate system based on the PCB board;

[0050] In step 1, all primitives are divided into line segment primitives, circular primitives and polygonal primitives based on their shapes; and the primitive classification codes corresponding to the line segment primitives, circular primitives and polygonal primitives are different from each other.

[0051] In the step 1, the identification information is a unique identification number corresponding to each graphic element.

[0052] In the present invention, primitives are classified based on shapes, and primitives include but are not limited to line segment primitives, circular primitives and polygonal primitives. In practical applications, line segment primitives, circular primitives and polygonal primitives are common primitives, among which circular primitives are not dots but exist as solid circles. For these three types of primitives, the primitive classification codes are different, such as the primitive classification code of the line segment primitive is 1, the primitive classification code of the circular primitive is 2, and the primitive classification code of the polygonal primitive is 3.

[0053] In the present invention, the unique identification number of the graphic element is the unique identification information of each graphic element. For example, the unique identification number of a certain line segment graphic element is set to L1001, where L represents the line segment and 1001 represents the number.

[0054] In the present invention, during the actual processing, the primitive classification code and identification information are stored in a nested key-value pair container mapPel, and a position for storing the shortest distance value is set, and the initial value is empty; the mapPel container structure is defined as <primitive classification code, <primitive unique identification number, shortest distance value>>.

[0055] Step 2: Identify the cursor movement and obtain the corresponding identification cursor P, the coordinates are (x p ,y p );

[0056] In the present invention, generally speaking, the cursor is identified as a mouse point.

[0057] Step 3: Use the identification cursor to traverse all stored entities by category, based on the threshold T associated with the PCB entity point s Supplement the identification cursor with the shortest distance value between any PCB element for each element;

[0058] In step 3, T s =T*Scaling, T is the initial threshold, Scaling is the graph scaling ratio, Scaling>0.

[0059] T=|D pel_min | / 2, where |D pel_min | is the minimum distance between any two primitives.

[0060] In the present invention, the PCB graphic editing system is an infinitely scalable graphic system, and a fixed threshold cannot be used as a basis for identifying the effective distance. Therefore, a variable distance threshold T is set at different graphic scaling ratios. s .

[0061] In the present invention, under clear circumstances, the initial threshold can be directly set or obtained by calculating the minimum spacing.

[0062] In the present invention, the acquisition or calculation of the shortest distance value is determined for three different types of primitives.

[0063] In the present invention, the threshold T generally adopts the same value. For example, for three random primitives A, B, and C, the distance between A and B is 2, the distance between B and C is 1, and the distance between A and C is 3. Then the distance between B and C is the minimum distance between every two primitives, that is, the threshold T = D BC / 2.

[0064] In step 3, identifying the line segment primitives that the cursor traverses and stores, and obtaining the shortest distance value includes the following steps:

[0065] Step 3.1.1: Let the coordinates of the two vertices A and B of any line segment primitive be (x1, y1) and (x2, y2);

[0066] Step 3.1.2: Take the two vertices A and B as endpoints and set auxiliary lines l1 and l2 perpendicular to the line segment primitive respectively;

[0067] Step 3.1.3: If the recognition cursor falls in the space between l1 and l2, the shortest distance between the recognition cursor and the line segment primitive is D L_min =|PE|, where E is the foot of the perpendicular between P and line segment AB;

[0068] If the recognition cursor falls on the space outside l1 or l2, the shortest distance between the recognition cursor and the line segment primitive is D L_min =|PA| or

[0069] If the recognition light falls on l1 or l2, the shortest distance between the recognition cursor and the line segment element is D L_min =|PA| or

[0070] Step 3.1.4: If |D L_min |<T s , then |D L_min | is the shortest distance value and is stored.

[0071] In the present invention, for line segment primitives, when the recognition cursor falls on different positions, the calculation method of the shortest distance is different, and this position is distinguished by auxiliary lines l1 and l2; specifically:

[0072] When the recognition cursor falls between l1 and l2, the shortest distance between the recognition cursor and line segment AB must be the distance between the recognition cursor and the vertical intersection point E of AB, that is, |PE|;

[0073] If the recognition cursor falls in the space outside l1 and l2, the shortest distance between the recognition cursor and line segment AB must be the distance between the recognition cursor and A or B, that is, |PA| or |PB|;

[0074] When the recognition cursor falls on l1 and l2, the shortest distance between the recognition cursor and line segment AB must be the distance between the recognition cursor and A or B, that is, |PA| or |PB|, but at this time |PA| or |PB| is actually equal to the distance between the recognition cursor and the vertical intersection point E of AB.

[0075] In step 3, identifying the circular primitives that the cursor traverses and stores, and obtaining the shortest distance value includes the following steps:

[0076] Step 3.2.1: Let the center of the circular primitive be C(x c ,y c ), the radius is r;

[0077] Step 3.2.2: Calculate the shortest distance D between the recognition cursor and the circular element C_min ,

[0078] Step 3.2.3: If D C_min ≤0, the recognition cursor selects the circular element and stores it with 0 as the shortest distance value; if 0<D C_min <T s , then D C_min The shortest distance value is stored

[0079] In step 3, identifying the polygonal primitives stored by the cursor traversal and obtaining the shortest distance value includes the following steps:

[0080] Step 3.3.1: Let the vertex coordinate set of the target polygon primitive be P q , P q ={P1(x1,y1),P2(x2,y2),...,P n (x n ,y n )}, n is the number of vertices of the polygon, n≥3;

[0081] Step 3.3.2: Take the edges of the polygonal primitives, corresponding to n line segments P k+1 P k , P k , P k+1 ∈P q , 1≤k≤n-1; N r_p Count the intersections between the target polygon primitive and either side of the recognition cursor; initialize N r_p is 0;

[0082] Step 3.3.3: If point P is located on any line segment P k+1 P k If the cursor is on, the polygonal primitive is selected and stored with 0 as the shortest distance value; otherwise, from point P, to any line segment P k+1 P k Draw a ray l from any point on the i , if N r_p If is an odd number, the polygonal primitive is selected by the cursor and stored with 0 as the shortest distance value. If it is an even number, the recognition cursor falls outside the polygonal primitive and the next step is performed;

[0083] Step 3.3.4: Initialize f=1;

[0084] Step 3.3.5: Take the i-th edge of the polygonal primitive, and the coordinates of the two vertices of the corresponding edge are P i+1 (x i+1 ,y i+1 ), P i (x i ,y i ), 1≤i≤n-1;

[0085] Step 3.3.6: Use the vector inner product to traverse and calculate the positional relationship R between P and each edge extension line of the polygon primitive p_seg_i , R p_seg_i =(x i -x p )*(y i+1 -y p )-(x i+1 -x p )*(y i -y p );

[0086] Step 3.3.7: Calculate P and line segment P i+1 P i The distance D p_seg_i , for temporary storage;

[0087] In step 3.3.7,

[0088] If R p_seg_i >1, then

[0089]

[0090] If R p_seg_i <0, then

[0091]

[0092] In other cases, let d x =x i +R p_seg_i *(x i+1 -x i ), d y =y i +R p_seg_i *(y i+1 -y i ),

[0093]

[0094] Step 3.3.8: If i < n-1, then i = i + 1, repeat step 3.3.5, otherwise proceed to step 3.3.9;

[0095] Step 3.3.9: Remove all temporarily stored D p_seg_i , D R_min =min{D p_seg_i |0<i<n}, with D R_min The shortest distance value is stored.

[0096] In the present invention, firstly, it is confirmed whether the identification cursor is inside the polygonal primitive, and the number of intersections N between the identification cursor and the polygonal primitive is calculated by the ray method. r_p To determine the positional relationship between the recognition cursor and the polygon primitive; that is, draw a ray from the recognition cursor to any side of the polygon primitive. If the number of intersection points is odd, then the point is inside the polygon, otherwise the point is outside the polygon. At the same time, there is an exception, that is, the recognition cursor is located on any line segment P. k+1 P k In this case, it may affect N r_p , so 0 is directly used as the shortest distance value for storage.

[0097] In the present invention, after confirming that the identification cursor is outside the polygonal primitive, the vector inner product is calculated to confirm the distance between the identification cursor and each edge of the polygonal primitive in each case, and finally the minimum value is taken as the shortest distance value.

[0098] Step 4: Identify the PCB single element corresponding to the minimum value among all the shortest distance values.

[0099] In the present invention, in order to avoid the problem of excessive calculation, the coordinates (x p ,y p ), first calculate a screening range, such as a circular range with P as the center and a radius of r, where r can be set to T s n times, 0<n≤20, and then the shortest distance of the graphics elements within the screening range is calculated.

[0100] In the present invention, the shortest distance value in the container mapPel is screened, and the primitive with the smallest shortest distance value is identified.

Claims

1. A PCB single-element recognition method based on a variable threshold, characterized in that: The method calculates the shortest distance between the identification cursor and any PCB graphic element, compares the shortest distance with a threshold value associated with the PCB graphic element, and realizes the identification of a single PCB graphic element; the method comprises the following steps: Step 1: Classify all the primitives in the PCB board based on shape, set and store the primitive classification code and identification information; establish an XOY coordinate system based on the PCB board; all the primitives are divided into line segment primitives, circular primitives and polygonal primitives based on shape; the primitive classification codes corresponding to the line segment primitives, circular primitives and polygonal primitives are different from each other; the identification information is the primitive unique identification number corresponding to each primitive; Step 2: Identify cursor movement and obtain the corresponding identification cursor , the coordinates are ; Step 3: Use the identification cursor to traverse all stored entities by category, based on the threshold value associated with the PCB entity point Supplement the identification cursor with the shortest distance value between any PCB element for each element; In step 3, identifying the line segment primitives that the cursor traverses and stores, and obtaining the shortest distance value includes the following steps: Step 3.1.1: Let the coordinates of the two vertices A and B of any line segment primitive be and ; Step 3.1.2: Take the two vertices A and B as endpoints and set auxiliary lines perpendicular to the line segment primitives. and ; Step 3.1.3: If the recognition cursor is on and In the space between, the shortest distance between the recognition cursor and the line segment primitive is , where E is the foot of the perpendicular between P and line segment AB; If the recognition cursor is on or The shortest distance between the recognition cursor and the line segment primitive is or ; If the recognition light does not fall on or , then the shortest distance between the identification cursor and the line segment primitive is or ; Step 3.1.4: If , then The shortest distance value is stored; Step 4: Identify the PCB element corresponding to the minimum value among all the shortest distance values.

2. The PCB single element recognition method based on variable threshold according to claim 1, characterized in that: In step 3, identifying the circular primitives that the cursor traverses and stores, and obtaining the shortest distance value includes the following steps: Step 3.2.1: Let the center of the circular primitive be , the radius is r; Step 3.2.2: Calculate the shortest distance between the recognition cursor and the circular element , ; Step 3.2.3: If 0, the cursor is identified to select the circular element, and 0 is used as the shortest distance value for storage; if , then The shortest distance value is stored.

3. The PCB single-element recognition method based on a variable threshold according to claim 1, characterized in that: In step 3, identifying the polygonal primitives stored by the cursor traversal and obtaining the shortest distance value includes the following steps: Step 3.3.1: Let the vertex coordinate set of the target polygon primitive be , , is the number of vertices of the polygon, ; Step 3.3.2: Take the edge of the polygonal primitive, corresponding to Line segment , , ;by Count the intersections between the target polygon primitive and either side of the recognition cursor; initialize is 0; Step 3.3.3: If Point on any line segment If the cursor is on, the polygonal primitive is identified and stored with 0 as the shortest distance value; otherwise, From point to any line segment Draw a ray from any point on the ,like If is an odd number, the polygonal primitive is selected by the cursor, and 0 is used as the shortest distance value for storage. If it is an even number, the recognition cursor falls outside the polygonal primitive and the next step is performed; Step 3.3.4: Initialization ; Step 3.3.5: Take the first The coordinates of the two vertices of the corresponding edge are , , ; Step 3.3.6: Use vector inner product to traverse and calculate The positional relationship with each edge extension line of the polygon primitive , ; Step 3.3.7: Calculation With line segment Distance , for temporary storage; Step 3.3.8: If ,but , repeat step 3.3.5, otherwise proceed to step 3.3.9; Step 3.3.9: Remove all temporary storage , ,by The shortest distance value is stored.

4. The PCB single-element recognition method based on a variable threshold according to claim 3 is characterized in that: In step 3.3.7, like ,but ; like ,but ; In other cases, , , 。 5. The PCB single-element recognition method based on a variable threshold according to claim 1, characterized in that: In step 3, , is the initial threshold, is the graphic scaling factor, .

6. The PCB single-element recognition method based on a variable threshold according to claim 5 is characterized in that: ,in, The minimum distance between any two primitives.

Citation Information

Patent Citations

  • Computer-vision system for classification and spatial localization of bounded 3d-objects

    CA2535828A1

  • Method and device for selecting elements in primitives, electronic equipment and storage medium

    CN113204297A