WO2022000973A1 - Hole set registration method, apparatus and device, and storage medium - Google Patents

Hole set registration method, apparatus and device, and storage medium Download PDF

Info

Publication number
WO2022000973A1
WO2022000973A1 PCT/CN2020/132199 CN2020132199W WO2022000973A1 WO 2022000973 A1 WO2022000973 A1 WO 2022000973A1 CN 2020132199 W CN2020132199 W CN 2020132199W WO 2022000973 A1 WO2022000973 A1 WO 2022000973A1
Authority
WO
WIPO (PCT)
Prior art keywords
coordinates
holes
hole
engineering drawing
workpiece
Prior art date
Application number
PCT/CN2020/132199
Other languages
French (fr)
Chinese (zh)
Inventor
管凌乾
常远
Original Assignee
苏州维嘉科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 苏州维嘉科技股份有限公司 filed Critical 苏州维嘉科技股份有限公司
Publication of WO2022000973A1 publication Critical patent/WO2022000973A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • G06T7/001Industrial image inspection using an image reference approach
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • G06T7/33Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/30Determination of transform parameters for the alignment of images, i.e. image registration
    • G06T7/33Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods
    • G06T7/337Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods involving reference images or patches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30141Printed circuit board [PCB]

Definitions

  • the embodiments of the present application relate to the field of automated processing, for example, to a method, apparatus, device, and storage medium for hole set registration.
  • PCB Printed Circuit Board
  • the detection of the PCB hole position accuracy often requires manual selection of the positioning holes on the drilling drawing, and manual adjustment of the holes on the PCB board.
  • the corresponding holes are photographed to obtain the rigid body transformation matrix.
  • the coordinates of the positioning holes on the drawing and the holes on the actual PCB are matched to calculate the relative offset and aperture error of each hole on the PCB board.
  • the method, device, device, and storage medium for hole set registration provided by the embodiments of the present application can quickly register and position theoretical holes in drilling drawings and actual holes on a PCB board, thereby improving the matching accuracy. Reduce the technological process, improve the efficiency of matching, and realize fully automated production.
  • An embodiment of the present application provides a method for hole set registration, and the method for hole set registration includes:
  • the coordinates of any four holes in the engineering drawing are determined to form a first engineering drawing coordinate set; wherein, among the four holes, the straight line where two holes are located and the straight line where the other two holes are located intersect;
  • the congruent points of all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set forming a set of congruent points; the shape of the graph formed by the congruent points of each group is the same as that of the four holes in the first engineering drawing coordinate set;
  • the rigid body transformation matrix corresponding to the congruent points of each group is calculated to form a rigid body transformation matrix set ;
  • the coordinates in the engineering drawing coordinate system can be converted to the workpiece coordinate system through the rigid body transformation matrix;
  • the coordinates of any four holes in the engineering drawing are determined to form a first engineering drawing coordinate set; including:
  • the coordinates of any four holes in the engineering drawing are determined to form a first engineering drawing coordinate set; including:
  • the coordinates of all holes on the workpiece are determined to form a first workpiece coordinate set, including:
  • Congruent points, and form a set of congruent points including:
  • a first scale factor r1 and a second scale factor r2 are calculated, wherein the first scale factor second scale factor Among them, Lae is the distance from hole a to intersection e, Lab is the distance from hole a to hole b, Lce is the distance from hole c to intersection e, and Lcd is the distance from hole c to hole d.
  • the rigid body transformation matrix corresponding to the congruent points of each group including :
  • the angles between the intersection point e and the four holes a, b, c, and d are A1, A2, A3, and A4, respectively.
  • the included angles between one of the first virtual intersection and the second virtual intersection corresponding to the congruent points of each group and the congruent points of each group are B1, B2, B3, B4, is the difference between the included angle A1 and the included angle B1; ⁇ x is the difference between the intersection point e and the x-coordinate of the one virtual intersection point, and ⁇ y is the y-coordinate of the intersection point e and the one virtual intersection point difference value.
  • a registration score is performed on each rigid body transformation matrix to obtain a registration score.
  • the registration score of each rigid body transformation matrix is determined according to the offset set corresponding to each rigid body transformation matrix, and the registration score result is obtained.
  • the registration score of each rigid body transformation matrix is determined according to the offset set corresponding to each rigid body transformation matrix, and the registration score result is obtained, including:
  • a registration score is performed on each rigid body transformation matrix according to the scoring standard with the standard deviation from small to large, and a registration score result is obtained.
  • the registration score of each rigid body transformation matrix is determined according to the offset set corresponding to each rigid body transformation matrix, and the registration score result is obtained, including:
  • the registration score is performed on each rigid body transformation matrix, and the registration score result is obtained.
  • the embodiment of the present application also provides a hole set registration device, and the hole set registration device includes:
  • the first engineering drawing coordinate set operation module is set to determine the coordinates of any four holes in the engineering drawing in the engineering drawing coordinate system to form the first engineering drawing coordinate set; wherein, among the four holes, two holes The line where it is located intersects the line where the other two holes are located;
  • the first workpiece coordinate set operation module is set to determine the coordinates of all holes on the workpiece in the workpiece coordinate system to form the first workpiece coordinate set;
  • the full isopoint set operation module is configured to determine, according to the first engineering drawing coordinate set and the first workpiece coordinate set, in the workpiece coordinate system, the distance between the four holes in the first engineering drawing coordinate set and the four holes in the first engineering drawing coordinate set.
  • the congruent points of all groups corresponding to the coordinates form a set of congruent points; the shape of the graph formed by the congruent points of each group is the same as the shape of the graph formed by the four holes in the coordinate set of the first engineering drawing;
  • the congruent rigid body transformation matrix set operation module is set to calculate the congruence of each group according to the coordinates of the congruent points of each group in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set
  • the rigid body transformation matrix corresponding to the point forms a rigid body transformation matrix set; the coordinates in the engineering drawing coordinate system can be converted to the workpiece coordinate system through the rigid body transformation matrix;
  • the scoring module is set to select the coordinates of any plurality of holes in the engineering drawing to form a second engineering drawing coordinate set, and convert the coordinates of the plurality of holes in the second engineering drawing coordinate set through the rigid body transformation matrix set
  • Each rigid body transformation matrix in is converted to the workpiece coordinate system to form a second workpiece coordinate set; according to the coordinates of each hole in the second workpiece coordinate set and the nearest neighbor corresponding to each hole on the workpiece
  • the coordinates of the hole perform registration scoring for each rigid body transformation matrix, and obtain the registration scoring result;
  • the processing module is set to determine the optimal rigid body transformation matrix according to the registration scoring result; and obtain the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered according to the optimal rigid body transformation matrix , which is converted into the coordinates of the workpiece coordinate system to realize the registration of the hole to be registered with the hole on the workpiece.
  • the embodiment of the present application also provides a terminal device, and the terminal device includes:
  • processors one or more processors
  • storage means arranged to store one or more programs
  • the one or more programs are executed by the one or more processors, so that the one or more processors implement the method for hole set registration provided by the embodiments of the present application.
  • Embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, implements the method for hole set registration provided by the embodiments of the present application.
  • FIG. 1 is a schematic flowchart of a method for hole set registration provided in Embodiment 1 of the present application;
  • FIG. 2 is a schematic flowchart of a method for hole set registration provided in Embodiment 2 of the present application;
  • FIG. 3 is a schematic flowchart of a method for hole set registration provided in Embodiment 3 of the present application;
  • FIG. 4 is a schematic flowchart of a method for hole set registration provided in Embodiment 4 of the present application;
  • FIG. 5 is a schematic structural diagram of a device for hole set registration provided by an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a device for hole set registration provided by an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a method for hole set registration provided in Embodiment 1 of the present application.
  • the method can be applied to the case of hole set registration processing.
  • the method can be executed by a hole set registration device, which can be implemented by software and/or It is implemented in hardware and is generally integrated on the host computer.
  • the host computer includes but is not limited to a computer.
  • a method for hole set registration includes:
  • the engineering drawing coordinate system refers to the coordinate system in the processing drawing.
  • the coordinates of the four holes are determined in the engineering drawing coordinate system, and the coordinates are formed into the first engineering drawing coordinate set.
  • the coordinates of the holes a, b, c, and d are selected to form the first engineering drawing coordinate set P
  • the coordinates of the four holes are selected to form the first engineering drawing coordinate set, so that the coordinates of the four holes can be easily and conveniently calculated.
  • the congruent points corresponding to the coordinates reduce the computational complexity.
  • the workpiece coordinate system refers to the coordinate system established by the modeling application after scanning the workpiece to the host computer.
  • the coordinates of all holes are selected to form the first workpiece coordinate set.
  • all the holes on the workpiece are respectively q1, q2, q3, q4, q5, and the coordinates of q1, q2, q3, q4, and q5 constitute the first workpiece coordinate set Q.
  • the congruent points corresponding to the first engineering drawing coordinate set can be conveniently and quickly found from the workpiece, thereby improving the calculation efficiency.
  • the rigid body transformation matrix corresponding to each group of congruent points is obtained to form a rigid body transformation matrix set B.
  • the second engineering drawing coordinate set refers to a set consisting of coordinates of a plurality of holes arbitrarily selected in the engineering drawing coordinate system.
  • select P6, P7, P8 in the engineering drawing coordinate system to form the second engineering drawing coordinate set M and use the calculation program to calculate the second workpiece coordinate set M according to the second engineering drawing coordinate set M through the rigid body transformation matrix set B. '.
  • the closest hole refers to the hole in the workpiece coordinate system that is closest to the horizontal and vertical coordinates in the second workpiece coordinate set.
  • the closest hole around the coordinate (251, 50) is the coordinate of P6, and the coordinate is (265, 80), then P6 is the coordinate of the closest hole corresponding to M1'.
  • an offset can be used as a reference standard for scoring, and the larger the offset, the lower the score.
  • S108 Acquire the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the difference between the hole to be registered and the workpiece. Registration of holes.
  • the coordinates of the holes to be registered on the engineering drawing can be converted into coordinate positions in the workpiece coordinate system through the rigid body transformation matrix.
  • the hole to be registered in the engineering drawing is E
  • the rigid body transformation matrix is B1
  • the hole E to be registered is converted into the hole E' in the workpiece coordinate system through the rigid body transformation matrix B1
  • the hole E' The coordinates can determine the position of the hole E' in the workpiece coordinate system, then the hole E' is the hole corresponding to the hole E in the engineering drawing.
  • a first engineering drawing coordinate set is selected in the engineering drawing coordinate system; secondly, a first workpiece coordinate set is selected in the workpiece coordinate system, and the first engineering drawing coordinate set and The first workpiece coordinate set finds the congruent points with all the holes in the first engineering drawing coordinate set to form a congruent point set; then calculates the rigid body transformation matrix corresponding to all coordinates in the congruent point set to form a rigid body transformation matrix set; Then, a second engineering drawing coordinate set is formed in the engineering drawing coordinates, and the second workpiece coordinate set is calculated according to the rigid body transformation matrix; finally, each rigid body transformation matrix is registered and scored using the second workpiece coordinate set, and the optimal rigid body is selected.
  • the optimal rigid body transformation matrix is quickly calculated, and the holes in the engineering drawing and the holes on the workpiece are accurately registered through the optimal rigid body transformation matrix, which reduces the process of manually calculating the rigid body transformation matrix and reduces manual calculation. Error rate, improve calculation effect, shorten process time, improve work efficiency, and realize fully automatic detection.
  • FIG. 2 is a schematic flowchart of a method for hole set registration provided in Embodiment 2 of the present application. Embodiment 2 is described on the basis of the foregoing embodiment. As shown in FIG. 2 , a method for hole set registration provided in Embodiment 2 of the present application includes the following steps:
  • S101 may include: in the coordinate system of the engineering drawing, determining the coordinates of all the holes in the engineering drawing; randomly selecting the coordinates of any four holes from the coordinates of all the holes in the engineering drawing to form the first project The set of graph coordinates; among the four holes, the lines where two holes are located intersect with the lines where the other two holes are located.
  • the coordinates of all holes in the drawing are determined in the drawing coordinate system, which is automatically selected by the software.
  • the computer automatically obtains the coordinates of all holes in the engineering drawing, and automatically selects the coordinates of four holes randomly according to the program from the coordinates of all the holes, and forms the coordinates of the four holes into the first engineering drawing set. Automatic selection by computer avoids manual operation, saves manual operation time and improves work efficiency.
  • S101 may further include: acquiring coordinate information of any four holes in the engineering drawing coordinate system in the engineering drawing coordinate system to form a first engineering drawing coordinate set; wherein, among the four holes, two holes are located in the coordinate system of the engineering drawing. The line intersects the line where the other two holes are.
  • Obtaining the coordinate information of any four holes in the drawing coordinate system in the drawing refers to manually selecting any four holes and inputting the coordinates of the four holes into the computer.
  • the computer composes the coordinates of the four holes into the first engineering drawing according to the received coordinate information of the four holes.
  • a collection of coordinates By manually and autonomously selecting the four holes in the engineering drawing, it can be selected independently according to specific needs, and at the same time, the methods and methods of selecting the four holes are enriched, and the applicability of the system calculation is increased.
  • the scanned image of the workpiece is obtained by scanning, and the workpiece image is formed in the workpiece coordinate system.
  • the workpiece can be scanned by a scanner, and the scanned image of the workpiece can be obtained quickly and conveniently.
  • the hole position is determined on the scanned image.
  • the position of the dark color is the position of the hole, and the coordinates of the color depth are recorded as the coordinates of the hole.
  • S1023 Determine the coordinates of all holes in the workpiece coordinate system to form a first workpiece coordinate set.
  • the coordinates of all positions with dark colors are sequentially obtained, and the obtained coordinates are formed into a workpiece coordinate set.
  • the first workpiece coordinate set is quickly and accurately obtained by means of image processing, so as to improve work efficiency and avoid manual operation errors.
  • the coordinates of the four holes in the first engineering drawing coordinate set are a(0,0), b(100,100), c(0,100), d(100,0), then it is easy to obtain two The intersection coordinates e(50, 50) of the straight line where one hole a, b is located and the straight line where the other two holes c, d are located.
  • the virtual intersection point refers to the intersection point of the congruent point connecting lines corresponding to the first engineering drawing coordinate set in the matrix transformation.
  • the coordinates of the congruent points are q1 (100, 0), q2 (250, 50), q3 (100, 100), q4 (200, 100), q5 (200, 0), then 5 groups can be obtained For a quadrilateral, use r1 and r2 to calculate the possible 20 intersection points respectively.
  • the possible intersection points of the line segments composed of congruent points q1 and q4 are e1 (150, 50), e2 (150, 50), and congruent points q3
  • the possible intersection points of the line segments composed of q5 are e1 (150, 50), e2 (150, 50), then it can be obtained that e1 composed of congruent points q1 and q4 is equal to e2 composed of q3 and q5, then q1, q3, q4, q5 are the four congruent points of the group to be found.
  • the four congruent points of the multiple groups to be searched can be quickly and effectively calculated, and it is not necessary to search manually, thereby improving work efficiency and saving work time.
  • the points selected in the example are the four endpoints of the square, so the values of r1 and r2 are equal. In fact, in practical applications, most of r1 and r2 are not equal, so I won't repeat them here.
  • the coordinates of the intersection e in the coordinate system of the engineering drawing are (50, 50), and the coordinates of the virtual intersection in the coordinate system of the workpiece are (150, 50).
  • the included angles of points c and d are 135 degrees, 45 degrees, -45 degrees, and -135 degrees, respectively, that is, A1 is 135 degrees, A2 is 45 degrees, A3 is -45 degrees, and A4 is -135;
  • the included angles of points q1, q3, q4, and q5 are also 135 degrees, 45 degrees, -45 degrees, and -135 degrees, respectively, that is, B1 is 135 degrees, B2 is 45 degrees, B3 is -45 degrees, and B4 is -135 degrees.
  • the rigid body transformation moment can be obtained as: .
  • the included angle A1 corresponds to the included angle B1
  • the included angle A2 corresponds to the included angle B2
  • the included angle A3 corresponds to the included angle B3
  • the included angle A4 corresponds to the included angle B4
  • the intersection point e corresponds to the virtual intersection point.
  • the angle deviation is the difference between the included angle A1 and the included angle B1, or the difference between the included angle A2 and the included angle B2, or the difference between the included angle A3 and the included angle B3, or is the difference between the included angle A4 and the included angle B4, or the average value of the above four groups of differences.
  • f'(251, 50), g'(264, 80), h'(176, 65) are obtained, and f', g', h' form the second workpiece coordinate set M', according to
  • the second workpiece coordinate set M' finds the corresponding three points f' ⁇ p2, g' ⁇ p6, h' ⁇ p7, and obtains the three-point coordinates p2(251,50), p6(265,80), p7(175, 65).
  • the offset when the offset is larger, it is determined that the score of the rigid body transformation matrix is lower.
  • the offset can be quickly calculated, the optimal rigid body transformation matrix can be selected accurately, and the calculation is reduced. complexity and improve the efficiency of the operation.
  • S108 Acquire the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the difference between the hole to be registered and the workpiece. Registration of holes.
  • FIG. 3 is a schematic flowchart of a method for hole set registration provided in Embodiment 3 of the present application. As shown in FIG. 3 , the method includes:
  • S1023 Determine the coordinates of all holes in the workpiece coordinate system to form a first workpiece coordinate set.
  • S10632 Perform a registration score for each rigid body transformation matrix according to a scoring standard with a standard deviation from small to large, and obtain a registration score result.
  • the standard deviation of all congruent points is calculated, and the standard deviations are compared. If the standard deviation of another congruent point is 0.312, since 0.312 is less than 0.471, the matching degree of this point is The better, the higher the rating.
  • S108 Acquire the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the difference between the hole to be registered and the workpiece. Registration of holes.
  • FIG. 4 is a schematic flowchart of a method for hole set registration provided in Embodiment 4 of the present application. As shown in FIG. 4 , the method includes:
  • S1023 Determine the coordinates of all holes in the workpiece coordinate system to form a first workpiece coordinate set.
  • ⁇ f', ⁇ g', and ⁇ h' are respectively 0, 1, and 1, and the preset offset is 1, and the number of qualified points is 3. If the preset preset offset is 0.5, the qualified points are The number of holes is 1. By presetting the offset, the number of qualified holes can be simply and effectively determined, the calculation amount is reduced, and the calculation efficiency is improved.
  • the scoring result can be obtained quickly, and in the case of a large number of hole sets, the scoring can be obtained quickly, and an appropriate matrix can be selected to improve convenience.
  • FIG. 5 is a schematic structural diagram of a device for hole set registration provided by an embodiment of the present application.
  • a hole set registration device includes:
  • the first engineering drawing coordinate set operation module 1 is set to determine the coordinates of any four holes in the engineering drawing in the engineering drawing coordinate system to form the first engineering drawing coordinate set; wherein, among the four holes, two holes are located in intersects the line where the other two holes are located.
  • the first workpiece coordinate set operation module 2 is configured to determine the coordinates of all holes on the workpiece in the workpiece coordinate system to form a first workpiece coordinate set.
  • the full-equipoint set operation module 3 is configured to, according to the first engineering drawing coordinate set and the first workpiece coordinate set, in the workpiece coordinate system, determine the complete set of all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set.
  • Congruent points constitute a set of congruent points; the shape of a graph composed of congruent points of each group is the same as that of a graph composed of four holes in the coordinate set of the first engineering drawing.
  • the congruent rigid body transformation matrix set operation module 4 is set to calculate the corresponding congruent points of each group according to the coordinates of the congruent points of each group in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set
  • the rigid body transformation matrix constitutes a rigid body transformation matrix set; the coordinates in the engineering drawing coordinate system can be converted to the workpiece coordinate system through the rigid body transformation matrix.
  • the second workpiece coordinate set operation module 5 is set to select the coordinates of any number of holes in the engineering drawing to form a second engineering drawing coordinate set, and transform the coordinates of the multiple holes in the second engineering drawing coordinate set through rigid body transformation Each rigid body transformation matrix in the matrix set is converted to the workpiece coordinate system to form a second workpiece coordinate set;
  • the scoring module 6 is configured to perform registration and scoring on each rigid body transformation matrix according to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to each hole on the workpiece to obtain registration Scoring results.
  • the processing module 7 is set to determine the optimal rigid body transformation matrix according to the registration score result; and obtain the coordinates of the hole to be registered on the engineering drawing, and according to the optimal rigid body transformation matrix, the coordinates of the hole to be registered are obtained, Convert to the coordinates of the workpiece coordinate system to realize the registration of the hole to be registered with the hole on the workpiece.
  • the coordinates of four holes are determined by the first engineering drawing coordinate set computing module to form a first engineering drawing coordinate set;
  • the coordinates of all holes on the workpiece are determined to form the first workpiece coordinate set, and then through the congruent point set operation module 3, according to the first engineering drawing coordinate set and the first workpiece coordinate set, find out the coordinates of the first engineering drawing coordinate set.
  • the coordinates of the four holes are congruent points, and form a congruent point set; then calculate the rigid body transformation matrix corresponding to the congruent points of each group through the congruent rigid body transformation matrix set operation module 4, and form a rigid body transformation matrix set; then A second engineering drawing coordinate set is formed by the second workpiece coordinate set operation module 5, and a second workpiece coordinate set is formed; and then the scoring module 6 is used according to the coordinates of each hole in the second workpiece coordinate set and the The coordinates of the nearest hole corresponding to the hole, perform registration scoring on each rigid body transformation matrix, and obtain the registration scoring result; finally, the processing module 7 determines the optimal rigid body transformation matrix according to the registration scoring result; and obtain the engineering drawing.
  • the coordinates of the holes to be registered are converted into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the registration of the holes.
  • the optimal rigid body transformation matrix can be quickly calculated, and the holes in the engineering drawing and the holes on the workpiece can be accurately registered through the optimal rigid body transformation matrix, which reduces the process of manually calculating the rigid body transformation matrix and reduces the labor cost. Calculate the error rate, improve the calculation effect, shorten the process time, improve the work efficiency, and realize the automatic detection.
  • the first engineering drawing coordinate set operation module 1 includes: a coordinate determining unit 11, which is set to determine the coordinates of all holes in the engineering drawing in the engineering drawing coordinate system; Among the coordinates of all the holes in , the coordinates of any four holes are randomly selected to form the first engineering drawing coordinate set; wherein, among the four holes, the lines where two holes are located intersect with the lines where the other two holes are located.
  • the first engineering drawing coordinate set operation module further includes: a coordinate obtaining unit 13, configured to obtain coordinate information of any four holes in the engineering drawing in the engineering drawing coordinate system to form the first engineering drawing coordinate set; wherein , among the four holes, the line where two holes are located intersects the line where the other two holes are located.
  • a coordinate obtaining unit 13 configured to obtain coordinate information of any four holes in the engineering drawing in the engineering drawing coordinate system to form the first engineering drawing coordinate set; wherein , among the four holes, the line where two holes are located intersects the line where the other two holes are located.
  • the first workpiece coordinate set operation module 2 includes: a scanning information acquisition unit 21, configured to obtain a scanned image of the workpiece; an image processing unit 22, configured to identify all holes in the scanned image through image processing; workpiece coordinates
  • the determining unit 23 is configured to determine the coordinates of all the holes in the workpiece coordinate system to form a first workpiece coordinate set.
  • the congruent point set operation module 3 includes: an intersection determination unit 31, configured to determine, among the four holes a, b, c, and d of the first engineering drawing coordinate set, the straight lines where two holes a, b are located. The intersection point e of the straight line where the other two holes c and d are located; the scale factor calculation unit 32 is set to calculate the first scale factor r1 and The second scale factor r2, where the first scale factor second scale factor Wherein, Lae is the distance from hole a to intersection e, Lab is the distance from hole a to hole b, Lce is the distance from hole c to intersection e, and Lcd is the distance from hole c to hole d; the virtual intersection calculation unit 33 is set as According to the first scale factor r1 and the second scale factor r2, the coordinates of the first virtual intersection point and the second virtual intersection point on the straight line where every two holes of all the holes on the workpiece are calculated, respectively forming the first virtual intersection point set and the second virtual intersection set; the comparison unit
  • the congruent rigid body transformation matrix set operation module 4 is set according to the formula: Calculate the rigid body transformation matrix corresponding to the congruent points of each group.
  • the angles between the intersection point e and the four holes a, b, c, and d are A1, A2, A3, and A4, respectively.
  • the included angles between one of the first virtual intersection and the second virtual intersection corresponding to the congruent points of each group and the congruent points of each group are B1, B2, B3, and B4, respectively, is the difference between the included angle A1 and the included angle B1; ⁇ x is the difference between the intersection point e and the x-coordinate of the one virtual intersection point, and ⁇ y is the y-coordinate of the intersection point e and the one virtual intersection point difference value.
  • the scoring module 6 includes: an adjacent hole coordinate determination unit 61, configured to determine the workpiece corresponding to each hole according to the coordinates of each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix.
  • the coordinates of the nearest hole the offset determination unit 62 is set to determine the coordinates of the nearest hole corresponding to each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix on the workpiece
  • the offset of each hole in the second workpiece coordinate set constitutes the offset set corresponding to each rigid body transformation matrix
  • the scoring calculation unit 63 is set to the offset corresponding to each rigid body transformation matrix. The set determines the registration score of each rigid body transformation matrix, and obtains the registration score result.
  • the score calculation unit 63 includes: a first score calculation subunit 631 or a second score calculation subunit 632; the first score calculation subunit 631 is configured to calculate the offset set corresponding to each rigid body transformation matrix. The standard deviation of the offset, and according to the scoring standard of the standard deviation from small to large, each rigid body transformation matrix is registered and scored, and the registration score result is obtained; the second score calculation subunit 632 is set to count each rigid body.
  • the offset set corresponding to the transformation matrix the number of holes whose offsets are located within the preset offset range, and the scoring criteria according to the number of holes located within the preset offset range from large to small, Perform registration scoring on each rigid body transformation matrix to obtain the registration scoring result.
  • the above hole set registration apparatus can execute the hole set registration method provided by any embodiment of the present application, and has corresponding functional modules for executing the method.
  • FIG. 6 is a schematic structural diagram of a device for hole set registration provided by an embodiment of the present application.
  • a terminal device includes: one or more processors 41; a storage device 42, the processor in the device 41 can be one or more, and a processor 41 is taken as an example in FIG. 10; the storage device 42 is used to store one or more programs; the one or more programs are executed by one or more processors 41, so that one or more The plurality of processors 41 implement the hole set registration method described in any one of the embodiments of the present application.
  • the apparatus may further include: an input device 43 and an output device 44 .
  • the processor 41 , the storage device 42 , the input device 43 and the output device 44 in the device may be connected by a bus or in other ways, and the connection by a bus is taken as an example in FIG. 9 .
  • the storage device 42 in the device may be configured to store one or more programs, and the programs may be software programs, computer-executable programs, and modules, as described in Embodiment 1 or Embodiment 2 of the present application.
  • Program instructions/modules corresponding to the provided hole set registration method for example, the modules in the hole set registration device shown in FIG. 8 ).
  • the processor 41 executes various functional applications and data processing of the terminal device by running the software programs, instructions and modules stored in the storage device 42 , that is, to implement the hole set registration method in the above method embodiments.
  • the storage device 42 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the device, and the like. Additionally, storage device 42 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, storage device 42 may include memory located remotely from processor 41, which may be connected to the device through a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
  • the input device 43 may be configured to receive input numerical or character information, and to generate key signal input related to user settings and function control of the device.
  • the output device 44 may include a display device such as a display screen.
  • the coordinates of any four holes in the engineering drawing are determined to form the first engineering drawing coordinate set; among the four holes, the lines where two holes are located intersect with the lines where the other two holes are located.
  • the coordinates of all holes on the workpiece are determined to form the first workpiece coordinate set.
  • the congruent points of all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set are determined to form a congruent point set;
  • the shape of the graph composed of congruent points of the group is the same as the graph shape composed of the four holes in the first drawing coordinate set.
  • the workpiece coordinate system forms a second workpiece coordinate set; according to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to each hole on the workpiece, each rigid body transformation matrix is registered Score, get the registration score results.
  • the optimal rigid body transformation matrix is determined according to the registration score results.
  • Embodiment 7 of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, is used to execute a method for hole set registration, and the method includes:
  • the coordinates of any four holes in the engineering drawing are determined to form the first engineering drawing coordinate set; among the four holes, the lines where two holes are located intersect with the lines where the other two holes are located.
  • the coordinates of all holes on the workpiece are determined to form the first workpiece coordinate set.
  • the congruent points of all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set are determined to form a congruent point set;
  • the shape of the graph composed of congruent points of the group is the same as the graph shape composed of the four holes in the first drawing coordinate set.
  • the workpiece coordinate system forms a second workpiece coordinate set; according to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to each hole on the workpiece, each rigid body transformation matrix is registered Score, get the registration score results.
  • the optimal rigid body transformation matrix is determined according to the registration score results.
  • the program when executed by the processor, it can also be used to execute the method for hole set registration provided in any embodiment of the present application.
  • the computer storage medium of the embodiments of the present application may adopt any combination of one or more computer-readable media.
  • the computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium.
  • the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above.
  • Computer readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (Read Only Memory, ROM), Erasable Programmable Read Only Memory (EPROM), Flash Memory, Optical Fiber, Portable Disc-Read-Only Memory (Compact Disc-Read-Only Memory, CD-ROM), Optical storage devices, magnetic storage devices, or any suitable combination of the above.
  • a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with computer-readable program code embodied in the computer-readable signal medium. Such propagated data signals may take a variety of forms including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
  • Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
  • suitable medium including but not limited to: wireless, wire, optical fiber cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
  • Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, but also conventional Procedural programming language - such as the "C" language or similar programming language.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or it can be connected to an external computer (eg using an internet service provider to connect via the internet).
  • LAN Local Area Network
  • WAN Wide Area Network

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Numerical Control (AREA)

Abstract

A hole set registration method, apparatus and device, and a storage medium. The method comprises: determining the coordinates of any four holes to form a first engineering drawing coordinate set; determining the coordinates of all holes on a workpiece to form a first workpiece coordinate set; determining, according to the first engineering drawing coordinate set and the first workpiece coordinate set, congruent points corresponding to the coordinates of the four holes to form a congruent point set; calculating a rigid body transformation matrix corresponding to each group of congruent points to form a rigid body transformation matrix set; selecting the coordinates of any multiple holes to form a second engineering drawing coordinate set, and forming a second workpiece coordinate set by means of the rigid body transformation matrix set; performing registration scoring on each rigid body transformation matrix according to the coordinates of each hole in the second workpiece coordinate set to determine an optimal rigid body transformation matrix; and obtaining the coordinates of holes to be registered, and implementing registration of said holes with the holes on the workpiece according to the optimal rigid body transformation matrix.

Description

孔集配准的方法、装置、设备及存储介质Method, device, device and storage medium for hole set registration
本申请要求在2020年07月01日提交中国专利局、申请号为202010628894.4的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application with application number 202010628894.4 filed with the China Patent Office on July 1, 2020, the entire contents of which are incorporated herein by reference.
技术领域technical field
本申请实施例涉及自动化加工领域,例如涉及一种孔集配准的方法、装置、设备及存储介质。The embodiments of the present application relate to the field of automated processing, for example, to a method, apparatus, device, and storage medium for hole set registration.
背景技术Background technique
印刷电路板(Printed Circuit Board,PCB),普遍应用于工业生产的多个方面中。Printed Circuit Board (PCB) is widely used in many aspects of industrial production.
根据加工的需要,PCB上往往需要加工出数以千计的孔,相关技术中,对PCB孔位精度的检测,往往需要人工通过选择钻孔图纸上的定位孔,同时手动对PCB板上的相应孔进行拍照,从而获得刚体变换矩阵,根据刚体变换矩阵进行图纸上的定位孔与实际PCB上的孔的坐标匹配,从而计算出PCB板上每一个孔相对的偏移量、孔径误差等。According to the needs of processing, thousands of holes often need to be processed on the PCB. In the related art, the detection of the PCB hole position accuracy often requires manual selection of the positioning holes on the drilling drawing, and manual adjustment of the holes on the PCB board. The corresponding holes are photographed to obtain the rigid body transformation matrix. According to the rigid body transformation matrix, the coordinates of the positioning holes on the drawing and the holes on the actual PCB are matched to calculate the relative offset and aperture error of each hole on the PCB board.
通过人工的方式对工程图上的孔和实际PCB上的孔进行匹配,对操作人员的技术要求较高,同时通过人工操作的方式难以避免出现匹配错误的情况发生,检测的准确性较低,另外,通过人工操作耗时较长,工作的效率较低。Manually matching the holes on the engineering drawing with the holes on the actual PCB requires high technical requirements for operators. At the same time, it is difficult to avoid matching errors through manual operation, and the detection accuracy is low. In addition, manual operation takes a long time, and the work efficiency is low.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供的一种孔集配准的方法、装置、设备及存储介质,能够快速的对钻孔图纸中的理论孔与PCB板上的实际孔进行配准定位,提高匹配的准确率,减少工艺流程,提高匹配的效率,实现全自动化生产。The method, device, device, and storage medium for hole set registration provided by the embodiments of the present application can quickly register and position theoretical holes in drilling drawings and actual holes on a PCB board, thereby improving the matching accuracy. Reduce the technological process, improve the efficiency of matching, and realize fully automated production.
本申请实施例提供了一种孔集配准的方法,该孔集配准的方法,包括:An embodiment of the present application provides a method for hole set registration, and the method for hole set registration includes:
在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,所述四个孔中,两个孔所在的直线与另外两个孔所在的直线相交;In the engineering drawing coordinate system, the coordinates of any four holes in the engineering drawing are determined to form a first engineering drawing coordinate set; wherein, among the four holes, the straight line where two holes are located and the straight line where the other two holes are located intersect;
在工件坐标系中,确定工件上所有孔的坐标,组成第一工件坐标集合;In the workpiece coordinate system, determine the coordinates of all holes on the workpiece to form the first workpiece coordinate set;
根据所述第一工程图坐标集合以及所述第一工件坐标集合,在所述工件坐标系中,确定与所述第一工程图坐标集合中四个孔的坐标对应的所有组的全等 点,组成全等点集合;每组的全等点组成的图形形状与所述第一工程图坐标集合中的四个孔组成的图形形状相同;According to the first engineering drawing coordinate set and the first workpiece coordinate set, in the workpiece coordinate system, determine the congruent points of all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set , forming a set of congruent points; the shape of the graph formed by the congruent points of each group is the same as that of the four holes in the first engineering drawing coordinate set;
根据所述全等点集合中每组的全等点的坐标以及所述第一工程图坐标集合中四个孔的坐标,计算每组的全等点对应的刚体变换矩阵,组成刚体变换矩阵集合;所述工程图坐标系中的坐标经所述刚体变换矩阵可转换至所述工件坐标系;According to the coordinates of the congruent points of each group in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set, the rigid body transformation matrix corresponding to the congruent points of each group is calculated to form a rigid body transformation matrix set ; The coordinates in the engineering drawing coordinate system can be converted to the workpiece coordinate system through the rigid body transformation matrix;
选择工程图中任意的多个孔的坐标,组成第二工程图坐标集合,并将所述第二工程图坐标集合中的多个孔的坐标,通过所述刚体变换矩阵集合中的每个刚体变换矩阵转换至所述工件坐标系,形成第二工件坐标集合;根据所述第二工件坐标集合中每个孔的坐标以及工件上与所述每个孔对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果;Select the coordinates of any number of holes in the engineering drawing to form a second engineering drawing coordinate set, and transform the coordinates of the multiple holes in the second engineering drawing coordinate set through each rigid body in the rigid body transformation matrix set The transformation matrix is converted to the workpiece coordinate system to form a second workpiece coordinate set; according to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to the each hole on the workpiece, to Perform registration scoring for each rigid body transformation matrix to obtain the registration scoring results;
根据所述配准评分结果确定最优的刚体变换矩阵;Determine the optimal rigid body transformation matrix according to the registration scoring result;
获取工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为所述工件坐标系的坐标以实现待配准的孔与工件上的孔的配准。Obtain the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the relationship between the hole to be registered and the workpiece. Registration of holes.
可选地,在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;包括:Optionally, in the engineering drawing coordinate system, the coordinates of any four holes in the engineering drawing are determined to form a first engineering drawing coordinate set; including:
在工程图坐标系中,确定工程图中所有孔的坐标;In the drawing coordinate system, determine the coordinates of all holes in the drawing;
从所述工程图中所有孔的坐标中,随机选择任意的四个孔的坐标,组成第一工程图坐标集合;其中,所述四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。From the coordinates of all holes in the engineering drawing, randomly select the coordinates of any four holes to form a first engineering drawing coordinate set; wherein, among the four holes, the straight line where the two holes are located and the other two holes where the lines intersect.
可选地,在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;包括:Optionally, in the engineering drawing coordinate system, the coordinates of any four holes in the engineering drawing are determined to form a first engineering drawing coordinate set; including:
获取工程图中任意的四个孔在工程图坐标系中的坐标信息,组成第一工程图坐标集合;其中,所述四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。Obtain the coordinate information of any four holes in the engineering drawing coordinate system in the engineering drawing coordinate system to form a first engineering drawing coordinate set; wherein, among the four holes, the lines where two holes are located and the lines where the other two holes are located are intersect.
可选地,在工件坐标系中,确定工件上所有孔的坐标,组成第一工件坐标集合,包括:Optionally, in the workpiece coordinate system, the coordinates of all holes on the workpiece are determined to form a first workpiece coordinate set, including:
获取工件的扫描图像;Obtain a scanned image of the workpiece;
通过图像处理识别所述扫描图像中的所有孔;Identify all holes in the scanned image by image processing;
确定所有孔在工件坐标系中的坐标,组成第一工件坐标集合。Determine the coordinates of all holes in the workpiece coordinate system to form the first workpiece coordinate set.
可选地,根据所述第一工程图坐标集合以及所述第一工件坐标集合,确定 在所述工件坐标系中与所述第一工程图坐标集合中四个孔的坐标对应的所有组的全等点,并组成全等点集合,包括:Optionally, according to the first engineering drawing coordinate set and the first workpiece coordinate set, determine the coordinates of all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set in the workpiece coordinate system. Congruent points, and form a set of congruent points, including:
确定所述第一工程图坐标集合的四个孔a、b、c、d中,两个孔a、b所在直线与另外两个孔c、d所在直线的交点e;Determine the intersection point e of the straight line where two holes a, b are located and the straight line where the other two holes c, d are located among the four holes a, b, c, and d of the first engineering drawing coordinate set;
根据所述四个孔a、b、c、d和所述交点e的坐标,计算第一比例因子r1和第二比例因子r2,其中第一比例因子
Figure PCTCN2020132199-appb-000001
第二比例因子
Figure PCTCN2020132199-appb-000002
其中,Lae为孔a到交点e的距离,Lab为孔a到孔b的距离,Lce为孔c到交点e的距离,Lcd为孔c到孔d的距离。
According to the coordinates of the four holes a, b, c, d and the intersection point e, a first scale factor r1 and a second scale factor r2 are calculated, wherein the first scale factor
Figure PCTCN2020132199-appb-000001
second scale factor
Figure PCTCN2020132199-appb-000002
Among them, Lae is the distance from hole a to intersection e, Lab is the distance from hole a to hole b, Lce is the distance from hole c to intersection e, and Lcd is the distance from hole c to hole d.
根据所述第一比例因子r1和所述第二比例因子r2,计算工件上所有孔中每两个孔所在直线上的第一虚拟交点的坐标和第二虚拟交点的坐标,分别组成第一虚拟交点集合和第二虚拟交点集合;According to the first scale factor r1 and the second scale factor r2, the coordinates of the first virtual intersection and the coordinates of the second virtual intersection on the straight line where every two holes of all the holes in the workpiece are calculated to form the first virtual intersection respectively. an intersection set and a second virtual intersection set;
将所述第一虚拟交点集合中的坐标与所述第二虚拟交点集合中的坐标进行比对,当一个第一虚拟交点的坐标和一个第二虚拟交点的坐标相同时,确定所述一个第一虚拟交点坐标对应的两个孔和所述一个第二虚拟交点坐标对应的两个孔为一组的全等点;Compare the coordinates in the first virtual intersection set with the coordinates in the second virtual intersection set, and when the coordinates of a first virtual intersection are the same as the coordinates of a second virtual intersection, determine the first virtual intersection. Two holes corresponding to a virtual intersection coordinate and two holes corresponding to the one second virtual intersection coordinate are a set of congruent points;
统计所有组的全等点,组成全等点集合。Count the congruent points of all groups to form a set of congruent points.
可选地,根据所述全等点集合中每组的全等点的坐标以及所述第一工程图坐标集合中四个孔的坐标,计算每组的全等点对应的刚体变换矩阵,包括:根据公式:
Figure PCTCN2020132199-appb-000003
计算每组的全等点对应的刚体变换矩阵,在工程图坐标系中,所述交点e与所述四个孔a、b、c、d的夹角分别为A1、A2、A3、A4,在工件坐标系中,所述每组的全等点对应的第一虚拟交点和第二虚拟交点中的一个虚拟交点与所述每组的全等点的夹角分别为B1、B2、B3、B4,
Figure PCTCN2020132199-appb-000004
为所述夹角A1与所述夹角B1之间的差值;Δx为所述交点e与所述一个虚拟交点x坐标的差值,Δy为所述交点e与所述一个虚拟交点y坐标的差值。
Optionally, according to the coordinates of the congruent points of each group in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set, calculate the rigid body transformation matrix corresponding to the congruent points of each group, including : According to the formula:
Figure PCTCN2020132199-appb-000003
Calculate the rigid body transformation matrix corresponding to the congruent points of each group. In the coordinate system of the engineering drawing, the angles between the intersection point e and the four holes a, b, c, and d are A1, A2, A3, and A4, respectively. In the workpiece coordinate system, the included angles between one of the first virtual intersection and the second virtual intersection corresponding to the congruent points of each group and the congruent points of each group are B1, B2, B3, B4,
Figure PCTCN2020132199-appb-000004
is the difference between the included angle A1 and the included angle B1; Δx is the difference between the intersection point e and the x-coordinate of the one virtual intersection point, and Δy is the y-coordinate of the intersection point e and the one virtual intersection point difference value.
可选地,根据所述第二工件坐标集合中每个孔的坐标以及工件上与所述每个对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果,包括:Optionally, according to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to each of the workpieces, a registration score is performed on each rigid body transformation matrix to obtain a registration score. Results, including:
根据每个刚体变换矩阵对应的所述第二工件坐标集合中每个孔的坐标,确定工件上与所述每个孔对应的最邻近的孔的坐标;According to the coordinates of each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix, determine the coordinates of the nearest hole corresponding to each hole on the workpiece;
根据工件上与每个刚体变换矩阵对应的所述第二工件坐标集合中每个孔对应的最邻近的孔的坐标,确定所述第二工件坐标集合中所述每个孔的偏移量,组成所述每个刚体变换矩阵对应的偏移量集合;Determine the offset of each hole in the second workpiece coordinate set according to the coordinates of the nearest hole corresponding to each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix on the workpiece, forming an offset set corresponding to each rigid body transformation matrix;
根据每个刚体变换矩阵对应的偏移量集合确定每个刚体变换矩阵的配准评分,获取配准评分结果。The registration score of each rigid body transformation matrix is determined according to the offset set corresponding to each rigid body transformation matrix, and the registration score result is obtained.
可选地,根据每个刚体变换矩阵对应的偏移量集合确定每个刚体变换矩阵的配准评分,获取配准评分结果,包括:Optionally, the registration score of each rigid body transformation matrix is determined according to the offset set corresponding to each rigid body transformation matrix, and the registration score result is obtained, including:
计算每个刚体变换矩阵对应的所述偏移量集合中偏移量的标准差;Calculate the standard deviation of the offsets in the offset set corresponding to each rigid body transformation matrix;
按照所述标准差由小到大的评分标准对每个刚体变换矩阵进行配准评分,获取配准评分结果。A registration score is performed on each rigid body transformation matrix according to the scoring standard with the standard deviation from small to large, and a registration score result is obtained.
可选地,根据每个刚体变换矩阵对应的偏移量集合确定每个刚体变换矩阵的配准评分,获取配准评分结果,包括:Optionally, the registration score of each rigid body transformation matrix is determined according to the offset set corresponding to each rigid body transformation matrix, and the registration score result is obtained, including:
统计每个刚体变换矩阵对应的所述偏移量集合中,偏移量位于预设偏移量范围内的孔的数量;Counting the number of holes whose offsets are within the preset offset range in the offset set corresponding to each rigid body transformation matrix;
按照位于预设偏移量范围内的孔的数量由大到小的评分标准,对每个刚体变换矩阵进行配准评分,获取配准评分结果。According to the scoring standard of the number of holes located in the preset offset range from large to small, the registration score is performed on each rigid body transformation matrix, and the registration score result is obtained.
本申请实施例还提供了一种孔集配准装置,该孔集配准装置包括:The embodiment of the present application also provides a hole set registration device, and the hole set registration device includes:
第一工程图坐标集合运算模块,设置为在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,所述四个孔中,两个孔所在的直线与另外两个孔所在的直线相交;The first engineering drawing coordinate set operation module is set to determine the coordinates of any four holes in the engineering drawing in the engineering drawing coordinate system to form the first engineering drawing coordinate set; wherein, among the four holes, two holes The line where it is located intersects the line where the other two holes are located;
第一工件坐标集合运算模块,设置为在工件坐标系中,确定工件上所有孔的坐标,组成第一工件坐标集合;The first workpiece coordinate set operation module is set to determine the coordinates of all holes on the workpiece in the workpiece coordinate system to form the first workpiece coordinate set;
全等点集合运算模块,设置为根据所述第一工程图坐标集合以及所述第一工件坐标集合,在所述工件坐标系中,确定与所述第一工程图坐标集合中四个孔的坐标对应的所有组的全等点,组成全等点集合;每组的全等点组成的图形形状与所述第一工程图坐标集合中的四个孔组成的图形形状相同;The full isopoint set operation module is configured to determine, according to the first engineering drawing coordinate set and the first workpiece coordinate set, in the workpiece coordinate system, the distance between the four holes in the first engineering drawing coordinate set and the four holes in the first engineering drawing coordinate set. The congruent points of all groups corresponding to the coordinates form a set of congruent points; the shape of the graph formed by the congruent points of each group is the same as the shape of the graph formed by the four holes in the coordinate set of the first engineering drawing;
全等点刚体变换矩阵集合运算模块,设置为根据所述全等点集合中每组的全等点的坐标以及所述第一工程图坐标集合中四个孔的坐标,计算每组的全等点对应的刚体变换矩阵,组成刚体变换矩阵集合;所述工程图坐标系中的坐标经所述刚体变换矩阵可转换至所述工件坐标系;The congruent rigid body transformation matrix set operation module is set to calculate the congruence of each group according to the coordinates of the congruent points of each group in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set The rigid body transformation matrix corresponding to the point forms a rigid body transformation matrix set; the coordinates in the engineering drawing coordinate system can be converted to the workpiece coordinate system through the rigid body transformation matrix;
评分模块,设置为选择工程图中任意的多个孔的坐标,组成第二工程图坐标集合,并将所述第二工程图坐标集合中的多个孔的坐标,通过所述刚体变换矩阵集合中的每个刚体变换矩阵转换至所述工件坐标系,形成第二工件坐标集合;根据所述第二工件坐标集合中每个孔的坐标以及工件上与所述每个孔对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果;The scoring module is set to select the coordinates of any plurality of holes in the engineering drawing to form a second engineering drawing coordinate set, and convert the coordinates of the plurality of holes in the second engineering drawing coordinate set through the rigid body transformation matrix set Each rigid body transformation matrix in is converted to the workpiece coordinate system to form a second workpiece coordinate set; according to the coordinates of each hole in the second workpiece coordinate set and the nearest neighbor corresponding to each hole on the workpiece The coordinates of the hole, perform registration scoring for each rigid body transformation matrix, and obtain the registration scoring result;
处理模块,设置为根据所述配准评分结果确定最优的刚体变换矩阵;并且获取工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为所述工件坐标系的坐标以实现待配准的孔与工件上的孔的配准。The processing module is set to determine the optimal rigid body transformation matrix according to the registration scoring result; and obtain the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered according to the optimal rigid body transformation matrix , which is converted into the coordinates of the workpiece coordinate system to realize the registration of the hole to be registered with the hole on the workpiece.
本申请实施例还提供了一种终端设备,该终端设备包括:The embodiment of the present application also provides a terminal device, and the terminal device includes:
一个或多个处理器;one or more processors;
存储装置,设置为存储一个或多个程序;storage means arranged to store one or more programs;
所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本申请实施例提供的孔集配准的方法。The one or more programs are executed by the one or more processors, so that the one or more processors implement the method for hole set registration provided by the embodiments of the present application.
本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现本申请实施例提供的孔集配准的方法。Embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, implements the method for hole set registration provided by the embodiments of the present application.
附图说明Description of drawings
图1是本申请实施例一提供的一种孔集配准的方法流程示意图;1 is a schematic flowchart of a method for hole set registration provided in Embodiment 1 of the present application;
图2是本申请实施例二提供的一种孔集配准的方法流程示意图;2 is a schematic flowchart of a method for hole set registration provided in Embodiment 2 of the present application;
图3是本申请实施例三提供的一种孔集配准的方法流程示意图;3 is a schematic flowchart of a method for hole set registration provided in Embodiment 3 of the present application;
图4是本申请实施例四提供的一种孔集配准的方法流程示意图;4 is a schematic flowchart of a method for hole set registration provided in Embodiment 4 of the present application;
图5是本申请实施例提供的一种孔集配准的装置结构示意图;5 is a schematic structural diagram of a device for hole set registration provided by an embodiment of the present application;
图6是本申请实施例提供的一种孔集配准的设备结构示意图。FIG. 6 is a schematic structural diagram of a device for hole set registration provided by an embodiment of the present application.
具体实施方式detailed description
下面结合附图和实施例对本申请进行说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本申请,而非对本申请的限定。为了便于描述,附图中仅示出了与本申请相关的部分而非全部结构。The present application will be described below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application. For convenience of description, the drawings only show some but not all structures related to the present application.
在讨论示例性实施例之前应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将多项操作(或步骤)描述成顺序的处理,但是多项操作中的许多操作可以被并行地、并发地或者同时实施。多项操 作的顺序可以被重新安排。当其操作完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。Before discussing the exemplary embodiments, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart depicts operations (or steps) as sequential processing, many of the operations may be performed in parallel, concurrently, or concurrently. The order of multiple operations can be rearranged. The process may be terminated when its operation is complete, but may also have additional steps not included in the figures. The processes may correspond to methods, functions, procedures, subroutines, subroutines, and the like.
本申请使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”。The term "including" and its variants used in this application are open to include, ie, "including but not limited to". The term "based on" is "based at least in part on." The term "one embodiment" means "at least one embodiment."
本申请中提及的“第一”、“第二”等概念仅用于对相应内容进行区分,并非用于限定顺序或者相互依存关系。Concepts such as "first" and "second" mentioned in this application are only used to distinguish the corresponding content, and are not used to limit the sequence or interdependence.
本申请中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。The modifications of "one" and "multiple" mentioned in this application are illustrative rather than limiting, and those skilled in the art should understand that unless the context clearly indicates otherwise, they should be understood as "one or more" .
实施例一Example 1
图1是本申请实施例一提供的一种孔集配准的方法流程示意图,该方法可适用于孔集配准加工的情况,该方法可以由孔集配准装置来执行,该装置可由软件和/或硬件实现,并一般集成在上位机上,在本实施例中上位机包括但不限于电脑。如图1所示,一种孔集配准的方法,包括:1 is a schematic flowchart of a method for hole set registration provided in Embodiment 1 of the present application. The method can be applied to the case of hole set registration processing. The method can be executed by a hole set registration device, which can be implemented by software and/or It is implemented in hardware and is generally integrated on the host computer. In this embodiment, the host computer includes but is not limited to a computer. As shown in Figure 1, a method for hole set registration includes:
S101、在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。S101. In the engineering drawing coordinate system, determine the coordinates of any four holes in the engineering drawing to form a first engineering drawing coordinate set; among the four holes, the straight line where two holes are located and the straight line where the other two holes are located intersect.
工程图坐标系是指在加工图纸中的坐标系,在工程图坐标系中确定四个孔的坐标,将该坐标组成第一工程图坐标集合。示例性的,选择孔a、b、c、d的坐标组成第一工程图坐标集合P,通过选择四个孔的坐标形成第一工程图坐标集合,能够简单方便的计算与该四个孔的坐标对应的全等点,降低计算复杂程度。The engineering drawing coordinate system refers to the coordinate system in the processing drawing. The coordinates of the four holes are determined in the engineering drawing coordinate system, and the coordinates are formed into the first engineering drawing coordinate set. Exemplarily, the coordinates of the holes a, b, c, and d are selected to form the first engineering drawing coordinate set P, and the coordinates of the four holes are selected to form the first engineering drawing coordinate set, so that the coordinates of the four holes can be easily and conveniently calculated. The congruent points corresponding to the coordinates reduce the computational complexity.
S102、在工件坐标系中,确定工件上所有孔的坐标,组成第一工件坐标集合。S102, in the workpiece coordinate system, determine the coordinates of all holes on the workpiece to form a first workpiece coordinate set.
工件坐标系是指将工件扫描到上位机后,利用建模应用程序建立的坐标系,在工件坐标系中,选择所有孔的坐标组成第一工件坐标集合。示例性的,工件上所有孔分别为q1、q2、q3、q4、q5,q1、q2、q3、q4、q5的坐标组成第一工件坐标集合Q。The workpiece coordinate system refers to the coordinate system established by the modeling application after scanning the workpiece to the host computer. In the workpiece coordinate system, the coordinates of all holes are selected to form the first workpiece coordinate set. Exemplarily, all the holes on the workpiece are respectively q1, q2, q3, q4, q5, and the coordinates of q1, q2, q3, q4, and q5 constitute the first workpiece coordinate set Q.
S103、根据第一工程图坐标集合以及第一工件坐标集合,在工件坐标系中,确定与第一工程图坐标集合中四个孔的坐标对应的所有组的全等点,组成全等点集合;每组的全等点组成的图形形状与第一工程图坐标集合中的四个孔组成的图形形状相同。S103, according to the first engineering drawing coordinate set and the first workpiece coordinate set, in the workpiece coordinate system, determine the congruent points of all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set to form a congruent point set ; The shape of the graph composed of congruent points of each group is the same as the graph shape composed of the four holes in the coordinate set of the first engineering drawing.
示例性的,根据第一工程图坐标集合P和第一工件坐标集合Q利用程序计算出与第一工程图坐标集合P中四个孔的坐标的全等点为q1、q3、q4、q5,并将q1、q3、q4、q5组成全等点集合D。通过确定工件上所有孔的坐标方便快速的从工件中找出与第一工程图坐标集合对应的全等点,提高计算效率。Exemplarily, according to the first engineering drawing coordinate set P and the first workpiece coordinate set Q, using a program to calculate the congruence points with the coordinates of the four holes in the first engineering drawing coordinate set P are q1, q3, q4, q5, And q1, q3, q4, q5 form the congruent point set D. By determining the coordinates of all holes on the workpiece, the congruent points corresponding to the first engineering drawing coordinate set can be conveniently and quickly found from the workpiece, thereby improving the calculation efficiency.
S104、根据全等点集合中每组的全等点的坐标以及第一工程图坐标集合中四个孔的坐标,计算每组的全等点对应的刚体变换矩阵,组成刚体变换矩阵集合;工程图坐标系中的坐标经刚体变换矩阵可转换至工件坐标系。S104, according to the coordinates of the congruent points of each group in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set, calculate the rigid body transformation matrix corresponding to the congruent points of each group, and form a rigid body transformation matrix set; engineering The coordinates in the drawing coordinate system can be transformed to the workpiece coordinate system through the rigid body transformation matrix.
示例性的,根据全等点q1、q3、q4、q5的坐标以及四个孔a、b、c、d的坐标得出每组的全等点对应的刚体变换矩阵,组成刚体变换矩阵集合B。Exemplarily, according to the coordinates of the congruent points q1, q3, q4, and q5 and the coordinates of the four holes a, b, c, and d, the rigid body transformation matrix corresponding to each group of congruent points is obtained to form a rigid body transformation matrix set B. .
S105、选择工程图中任意的多个孔的坐标,组成第二工程图坐标集合,并将第二工程图坐标集合中的多个孔的坐标,通过刚体变换矩阵集合中的每个刚体变换矩阵转换至工件坐标系,形成第二工件坐标集合。S105. Select the coordinates of any plurality of holes in the engineering drawing to form a second engineering drawing coordinate set, and convert the coordinates of the multiple holes in the second engineering drawing coordinate set through each rigid body transformation matrix in the rigid body transformation matrix set Convert to the workpiece coordinate system to form a second workpiece coordinate set.
第二工程图坐标集合是指由工程图坐标系中,任意选择的多个孔的坐标组成的集合。示例性的,选择工程图坐标系中P6、P7、P8组成第二工程图坐标集合M,利用计算程序,根据第二工程图坐标集合M通过刚体变换矩阵集合B计算出第二工件坐标集合M’。The second engineering drawing coordinate set refers to a set consisting of coordinates of a plurality of holes arbitrarily selected in the engineering drawing coordinate system. Exemplarily, select P6, P7, P8 in the engineering drawing coordinate system to form the second engineering drawing coordinate set M, and use the calculation program to calculate the second workpiece coordinate set M according to the second engineering drawing coordinate set M through the rigid body transformation matrix set B. '.
S106、根据第二工件坐标集合中每个孔的坐标以及工件上与所述每个孔对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果。S106. Perform a registration score on each rigid body transformation matrix according to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to each hole on the workpiece to obtain a registration score result.
最临近的孔是指在工件坐标系中,与第二工件坐标集合中横纵坐标最接近的孔,示例性的,第二工件坐标集合M’存在点M1’(251,50),在工件坐标系中,坐标(251,50)周边最临近的孔为P6的坐标为(265,80),则P6为M1’对应最临近的孔的坐标。The closest hole refers to the hole in the workpiece coordinate system that is closest to the horizontal and vertical coordinates in the second workpiece coordinate set. In the coordinate system, the closest hole around the coordinate (251, 50) is the coordinate of P6, and the coordinate is (265, 80), then P6 is the coordinate of the closest hole corresponding to M1'.
S107、根据配准评分结果确定最优的刚体变换矩阵。S107. Determine an optimal rigid body transformation matrix according to the registration scoring result.
评分越高则刚体变换矩阵越适合,示例性的,可以采用偏移量作为评分的 参考标准,偏移量越大,则评分越低。The higher the score, the more suitable the rigid body transformation matrix is. Exemplarily, an offset can be used as a reference standard for scoring, and the larger the offset, the lower the score.
S108、获取工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为工件坐标系的坐标以实现待配准的孔与工件上的孔的配准。S108: Acquire the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the difference between the hole to be registered and the workpiece. Registration of holes.
根据选择出来的最优刚体变换矩阵,作为孔集配准的刚体变换矩阵,通过工程图上待配准的孔的坐标,通过刚体变换矩阵,可以转换成为工件坐标系中的坐标位置。示例性的,工程图中待配准的孔为E,刚体变换矩阵为B1,则通过刚体变换矩阵B1将待配准的孔E转换成为工件坐标系中的孔E',通过孔E'的坐标可以在工件坐标系中确定孔E'的位置,则孔E'即为工程图中孔E所对应的孔。According to the selected optimal rigid body transformation matrix, as the rigid body transformation matrix for hole set registration, the coordinates of the holes to be registered on the engineering drawing can be converted into coordinate positions in the workpiece coordinate system through the rigid body transformation matrix. Exemplarily, the hole to be registered in the engineering drawing is E, and the rigid body transformation matrix is B1, then the hole E to be registered is converted into the hole E' in the workpiece coordinate system through the rigid body transformation matrix B1, and the hole E' The coordinates can determine the position of the hole E' in the workpiece coordinate system, then the hole E' is the hole corresponding to the hole E in the engineering drawing.
本申请实施例提供的一种孔集配准的方法,首先在工程图坐标系中选择第一工程图坐标集合;其次在工件坐标系中选择第一工件坐标集合,通过第一工程图坐标集合和第一工件坐标集合寻找出与第一工程图坐标集合中所有孔的全等点,组成全等点集合;然后计算出全等点集合中所有坐标对应的刚体变换矩阵,组成刚体变换矩阵集合;之后在工程图坐标中组成第二工程图坐标集合,根据刚体变换矩阵计算出第二工件坐标集合;最后利用第二工件坐标集合对每个刚体变换矩阵进行配准评分,选出最优的刚体变换矩阵。通过上述方法,快速计算出最优的刚体变换矩阵,通过最优的刚体变换矩阵对工程图中的孔与工件上的孔进行准确配准,减少了人工计算刚体变换矩阵的工序,降低人工计算错误率,提高计算效果,缩短工艺时长,提高工作效率,实现全自动检测。In a method for hole set registration provided by an embodiment of the present application, firstly, a first engineering drawing coordinate set is selected in the engineering drawing coordinate system; secondly, a first workpiece coordinate set is selected in the workpiece coordinate system, and the first engineering drawing coordinate set and The first workpiece coordinate set finds the congruent points with all the holes in the first engineering drawing coordinate set to form a congruent point set; then calculates the rigid body transformation matrix corresponding to all coordinates in the congruent point set to form a rigid body transformation matrix set; Then, a second engineering drawing coordinate set is formed in the engineering drawing coordinates, and the second workpiece coordinate set is calculated according to the rigid body transformation matrix; finally, each rigid body transformation matrix is registered and scored using the second workpiece coordinate set, and the optimal rigid body is selected. Transformation matrix. Through the above method, the optimal rigid body transformation matrix is quickly calculated, and the holes in the engineering drawing and the holes on the workpiece are accurately registered through the optimal rigid body transformation matrix, which reduces the process of manually calculating the rigid body transformation matrix and reduces manual calculation. Error rate, improve calculation effect, shorten process time, improve work efficiency, and realize fully automatic detection.
实施例二 Embodiment 2
图2是本申请实施例二提供的一种孔集配准的方法流程示意图,本实施例二在上述实施例的基础上进行说明。如图2所示,本申请实施例二提供的一种孔集配准的方法,包括如下步骤:FIG. 2 is a schematic flowchart of a method for hole set registration provided in Embodiment 2 of the present application. Embodiment 2 is described on the basis of the foregoing embodiment. As shown in FIG. 2 , a method for hole set registration provided in Embodiment 2 of the present application includes the following steps:
S101、在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。S101. In the engineering drawing coordinate system, determine the coordinates of any four holes in the engineering drawing to form a first engineering drawing coordinate set; among the four holes, the straight line where two holes are located and the straight line where the other two holes are located intersect.
在本实施例中,S101可以包括:在工程图坐标系中,确定工程图中所有孔的坐标;从工程图中所有孔的坐标中,随机选择任意的四个孔的坐标,组成第 一工程图坐标集合;其中,四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。In this embodiment, S101 may include: in the coordinate system of the engineering drawing, determining the coordinates of all the holes in the engineering drawing; randomly selecting the coordinates of any four holes from the coordinates of all the holes in the engineering drawing to form the first project The set of graph coordinates; among the four holes, the lines where two holes are located intersect with the lines where the other two holes are located.
在工程图坐标系中确定工程图中所有的孔的坐标,是通过软件自动选取。利用该方法,通过计算机自动获取工程图中所有孔的坐标,并在所有孔的坐标中,根据程序随机的自动选择四个孔的坐标,将该四个孔的坐标组成第一工程图集合。通过计算机自动选择,避免了人工操作,节省了人工操作的时间,提高工作效率。The coordinates of all holes in the drawing are determined in the drawing coordinate system, which is automatically selected by the software. Using this method, the computer automatically obtains the coordinates of all holes in the engineering drawing, and automatically selects the coordinates of four holes randomly according to the program from the coordinates of all the holes, and forms the coordinates of the four holes into the first engineering drawing set. Automatic selection by computer avoids manual operation, saves manual operation time and improves work efficiency.
在本实施例中,S101还可以包括:获取工程图中任意的四个孔在工程图坐标系中的坐标信息,组成第一工程图坐标集合;其中,四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。In this embodiment, S101 may further include: acquiring coordinate information of any four holes in the engineering drawing coordinate system in the engineering drawing coordinate system to form a first engineering drawing coordinate set; wherein, among the four holes, two holes are located in the coordinate system of the engineering drawing. The line intersects the line where the other two holes are.
获取工程图中任意四个孔在工程图坐标系中的坐标信息,是指人工选取任意四个孔的,并将四个孔的坐标输入到计算机中。通过人工自主选择工程图中任意的四个孔,并将所选的四个孔坐标信息传输到计算机中,计算机根据接收的四个孔的坐标信息,将四个孔的坐标组成第一工程图坐标集合。通过人工自主选择工程图中的四个孔,能够根据具体的需要,自主选择,同时丰富了选择四个孔的方式方法,增加系统计算的适用性。Obtaining the coordinate information of any four holes in the drawing coordinate system in the drawing refers to manually selecting any four holes and inputting the coordinates of the four holes into the computer. By manually selecting any four holes in the engineering drawing, and transmitting the coordinate information of the selected four holes to the computer, the computer composes the coordinates of the four holes into the first engineering drawing according to the received coordinate information of the four holes. A collection of coordinates. By manually and autonomously selecting the four holes in the engineering drawing, it can be selected independently according to specific needs, and at the same time, the methods and methods of selecting the four holes are enriched, and the applicability of the system calculation is increased.
S1021、获取工件的扫描图像。S1021 , acquiring a scanned image of the workpiece.
通过扫描的方式获取工件的扫描图像,在工件坐标系中形成工件图像,示例性的,可以通过扫描仪对工件进行扫描,快速便捷的获得工件的扫描图像。The scanned image of the workpiece is obtained by scanning, and the workpiece image is formed in the workpiece coordinate system. Exemplarily, the workpiece can be scanned by a scanner, and the scanned image of the workpiece can be obtained quickly and conveniently.
S1022、通过图像处理识别扫描图像中的所有孔。S1022. Identify all holes in the scanned image through image processing.
利用图像识别技术,对扫描图像进行孔位确定。示例性的,获取工件的扫描图像后,根据扫描图像中不同部分颜色的深浅,判断出颜色深的位置为孔所在位置,并记录颜色深处的坐标,作为孔的坐标。通过图像识别技术,能够准确的定位孔的位置,同时能够快速的获取所有孔的坐标,提高工作效率。Using image recognition technology, the hole position is determined on the scanned image. Exemplarily, after acquiring the scanned image of the workpiece, according to the color depth of different parts in the scanned image, it is determined that the position of the dark color is the position of the hole, and the coordinates of the color depth are recorded as the coordinates of the hole. Through the image recognition technology, the position of the hole can be accurately located, and the coordinates of all holes can be quickly obtained, which improves the work efficiency.
S1023、确定所有孔在工件坐标系中的坐标,组成第一工件坐标集合。S1023: Determine the coordinates of all holes in the workpiece coordinate system to form a first workpiece coordinate set.
示例性的,根据同样的原理,利用图像识别技术,依次获取所有颜色深的位置的坐标,将获取的坐标组成一工件坐标集合。通过图像处理的方式快速准确的获得第一工件坐标集合,提高工作效率,避免人工操作的错误。Exemplarily, according to the same principle, using image recognition technology, the coordinates of all positions with dark colors are sequentially obtained, and the obtained coordinates are formed into a workpiece coordinate set. The first workpiece coordinate set is quickly and accurately obtained by means of image processing, so as to improve work efficiency and avoid manual operation errors.
S1031、确定第一工程图坐标集合的四个孔a、b、c、d中,两个孔a、b所在直线与另外两个孔c、d所在直线的交点e。S1031 . Among the four holes a, b, c, and d of the first engineering drawing coordinate set, the intersection point e of the straight lines where the two holes a and b are located and the lines where the other two holes c and d are located is determined.
示例性的,确定第一工程图坐标集合的四个孔的坐标为a(0,0)、b(100,100)、c(0,100)、d(100,0),则容易得到两个孔a、b所在直线与另外两个孔c、d所在直线的交点坐标e(50,50)。Exemplarily, it is determined that the coordinates of the four holes in the first engineering drawing coordinate set are a(0,0), b(100,100), c(0,100), d(100,0), then it is easy to obtain two The intersection coordinates e(50, 50) of the straight line where one hole a, b is located and the straight line where the other two holes c, d are located.
S1032、根据四个孔a、b、c、d和交点e的坐标,计算第一比例因子r1和第二比例因子r2,其中第一比例因子
Figure PCTCN2020132199-appb-000005
第二比例因子
Figure PCTCN2020132199-appb-000006
其中,Lae为孔a到交点e的距离,Lab为孔a到孔b的距离,Lce为孔c到交点e的距离,Lcd为孔c到孔d的距离。
S1032. Calculate the first scale factor r1 and the second scale factor r2 according to the coordinates of the four holes a, b, c, d and the intersection e, wherein the first scale factor
Figure PCTCN2020132199-appb-000005
second scale factor
Figure PCTCN2020132199-appb-000006
Among them, Lae is the distance from hole a to intersection e, Lab is the distance from hole a to hole b, Lce is the distance from hole c to intersection e, and Lcd is the distance from hole c to hole d.
坐标中的距离一般通过距离公式进行计算,示例性的,根据上述a、b、c、d以及e的坐标,
Figure PCTCN2020132199-appb-000007
Figure PCTCN2020132199-appb-000008
则r1=Lae/Lab=1/2;同理可得r2=1/2。
The distance in the coordinates is generally calculated by the distance formula, exemplarily, according to the coordinates of the above a, b, c, d and e,
Figure PCTCN2020132199-appb-000007
Figure PCTCN2020132199-appb-000008
Then r1=Lae/Lab=1/2; in the same way, r2=1/2.
S1033、根据第一比例因子r1和第二比例因子r2,计算工件上所有孔中每两个孔所在直线上的第一虚拟交点的坐标和第二虚拟交点的坐标,分别组成第一虚拟交点集合和第二虚拟交点集合。S1033, according to the first scale factor r1 and the second scale factor r2, calculate the coordinates of the first virtual intersection point and the coordinates of the second virtual intersection point on the straight line where every two holes of all holes on the workpiece are located, and form a first virtual intersection point set respectively and the second virtual intersection set.
虚拟交点是指在矩阵变换中,与第一工程图坐标集合相对应的全等点连线的交点。示例性的,全等点的坐标为q1(100,0),q2(250,50),q3(100,100),q4(200,100),q5(200,0),则可以得到5组四边形,分别用r1和r2进行计算得到可能的20个交点,以q1,q4,q3、q5组成的线段为例,通过公式e1=q1+r1(q4-q1),e2=q1+r2(q4-q1),则e1.x=q1.x+r1*(q4.x-q1.x)=100+1/2*(200-100)=150;e1.y=q1.y+r1*(q4.y-q1.y)=0+1/2*(100-0)=50,得到q1和q4可能的一虚拟交点e1(150,50),同理,可得到q1和q4可能的另一虚拟交点e2(150,50)。根据相同的计算方式,q3,q5组成的线段分别计算可能的交点:e1(150,50),e2(150,50)。The virtual intersection point refers to the intersection point of the congruent point connecting lines corresponding to the first engineering drawing coordinate set in the matrix transformation. Exemplarily, the coordinates of the congruent points are q1 (100, 0), q2 (250, 50), q3 (100, 100), q4 (200, 100), q5 (200, 0), then 5 groups can be obtained For a quadrilateral, use r1 and r2 to calculate the possible 20 intersection points respectively. Taking the line segment composed of q1, q4, q3 and q5 as an example, through the formula e1=q1+r1(q4-q1), e2=q1+r2(q4 -q1), then e1.x=q1.x+r1*(q4.x-q1.x)=100+1/2*(200-100)=150; e1.y=q1.y+r1*( q4.y-q1.y)=0+1/2*(100-0)=50, a possible virtual intersection e1(150, 50) of q1 and q4 is obtained. Similarly, another possible intersection of q1 and q4 can be obtained. A virtual intersection e2(150, 50). According to the same calculation method, the line segments composed of q3 and q5 calculate the possible intersection points respectively: e1 (150, 50), e2 (150, 50).
S1034、将第一虚拟交点集合中的坐标与第二虚拟交点集合中的坐标进行比对,当一个第一虚拟交点的坐标和一个第二虚拟交点的坐标相同时,确定所述一个第一虚拟交点坐标对应的两个孔和所述一个第二虚拟交点坐标对应的两个 孔为一组的全等点。S1034. Compare the coordinates in the first virtual intersection set with the coordinates in the second virtual intersection set, and when the coordinates of a first virtual intersection are the same as the coordinates of a second virtual intersection, determine the first virtual intersection The two holes corresponding to the coordinates of the intersection and the two holes corresponding to the coordinates of the one second virtual intersection are a set of congruent points.
示例性的,全等点q1,q4,q3、q5组成的四边形中,全等点q1、q4组成的线段可能的交点为e1(150,50),e2(150,50),全等点q3、q5组成的线段可能的交点为e1(150,50),e2(150,50),则可以得到,全等点q1、q4组成得到的e1与q3、q5组成得到的e2相等,那么q1,q3,q4,q5为所要寻找的一组的四个全等点。可以理解的是,利用q1、q2计算出的可能交点为e1(175,25),e2(175,25),则q1、q2组成的线段可能的交点与其他全等点组成线段的交点均不相等,因此q2不是所要寻找的全等点。Exemplarily, in a quadrilateral composed of congruent points q1, q4, q3, and q5, the possible intersection points of the line segments composed of congruent points q1 and q4 are e1 (150, 50), e2 (150, 50), and congruent points q3 The possible intersection points of the line segments composed of q5 are e1 (150, 50), e2 (150, 50), then it can be obtained that e1 composed of congruent points q1 and q4 is equal to e2 composed of q3 and q5, then q1, q3, q4, q5 are the four congruent points of the group to be found. It can be understood that the possible intersection points calculated by q1 and q2 are e1 (175, 25) and e2 (175, 25), then the possible intersection points of the line segments composed of q1 and q2 are not the same as the intersection points of the line segments composed of other congruent points. are equal, so q2 is not the congruence point you are looking for.
S1035、统计所有组的全等点,组成全等点集合。S1035: Count congruent points of all groups to form a congruent point set.
通过上述方法,能够快速有效的计算出所要寻找的多个组的四个全等点,不必通过人工寻找,提高工作的效率,节约工作时间。为了让结果尽量简洁,故示例中选取的点为正方形四个端点,所以r1,r2的值相等,其实在实际应用中r1,r2大部分是不相等的,在此不再赘述。Through the above method, the four congruent points of the multiple groups to be searched can be quickly and effectively calculated, and it is not necessary to search manually, thereby improving work efficiency and saving work time. In order to make the result as concise as possible, the points selected in the example are the four endpoints of the square, so the values of r1 and r2 are equal. In fact, in practical applications, most of r1 and r2 are not equal, so I won't repeat them here.
S1041、根据公式:
Figure PCTCN2020132199-appb-000009
计算每组的全等点对应的刚体变换矩阵,在工程图坐标系中,交点e与四个孔a、b、c、d的夹角分别为A1、A2、A3、A4,在工件坐标系中,每组的全等点对应的第一虚拟交点和第二虚拟交点中的一个虚拟交点与所述每组的全等点的夹角分别为B1、B2、B3、B4,
Figure PCTCN2020132199-appb-000010
为夹角A1与夹角B1之间的差值;Δx为交点e与所述一个虚拟交点x坐标的差值,Δy为交点e与所述一个虚拟交点y坐标的差值。
S1041. According to the formula:
Figure PCTCN2020132199-appb-000009
Calculate the rigid body transformation matrix corresponding to the congruent points of each group. In the coordinate system of the engineering drawing, the angles between the intersection point e and the four holes a, b, c, and d are A1, A2, A3, and A4, respectively. In the workpiece coordinate system , the included angles between one of the first virtual intersection and the second virtual intersection corresponding to the congruent points of each group and the congruent points of each group are B1, B2, B3, B4, respectively,
Figure PCTCN2020132199-appb-000010
is the difference between the included angle A1 and the included angle B1; Δx is the difference between the intersection point e and the x coordinate of the one virtual intersection point, and Δy is the difference value between the intersection point e and the one virtual intersection point y coordinate.
示例性的,工程图坐标系中的交点e坐标为(50,50),工件坐标系中的虚拟交点坐标为(150,50),,在工程图坐标系中,e点与a、b、c、d点的夹角分别为135度、45度、-45度、-135度,即A1为135度、A2为45度、A3为-45度、A4为-135;虚拟交点与全等点q1、q3、q4、q5的夹角为也分别为135度、45度、-45度、-135度,即B1为135度、B2为45度、B3为-45度、B4为-135度;则交点e与虚拟交点之间的角度偏差就为0度,即交点e与虚拟交点的角度偏差没有改变,即为0,为100,为0。所以可以得到刚体变换矩为:。 可以理解的是,夹角A1与夹角B1相对应,夹角A2与夹角B2相对应,夹角A3与夹角B3相对应,夹角A4与夹角B4相对应,交点e与虚拟交点之间的角度偏为夹角A1与夹角B1之间的差值,或者为夹角A2与夹角B2之间的差值,或者为夹角A3与夹角B3之间的差值,或者为夹角A4与夹角B4之间的差值,或者为以上四组差值的平均值。Exemplarily, the coordinates of the intersection e in the coordinate system of the engineering drawing are (50, 50), and the coordinates of the virtual intersection in the coordinate system of the workpiece are (150, 50). The included angles of points c and d are 135 degrees, 45 degrees, -45 degrees, and -135 degrees, respectively, that is, A1 is 135 degrees, A2 is 45 degrees, A3 is -45 degrees, and A4 is -135; The included angles of points q1, q3, q4, and q5 are also 135 degrees, 45 degrees, -45 degrees, and -135 degrees, respectively, that is, B1 is 135 degrees, B2 is 45 degrees, B3 is -45 degrees, and B4 is -135 degrees. degree; then the angular deviation between the intersection e and the virtual intersection is 0 degrees, that is, the angular deviation between the intersection e and the virtual intersection has not changed, that is, 0, 100, and 0. Therefore, the rigid body transformation moment can be obtained as: . It can be understood that the included angle A1 corresponds to the included angle B1, the included angle A2 corresponds to the included angle B2, the included angle A3 corresponds to the included angle B3, the included angle A4 corresponds to the included angle B4, and the intersection point e corresponds to the virtual intersection point. The angle deviation is the difference between the included angle A1 and the included angle B1, or the difference between the included angle A2 and the included angle B2, or the difference between the included angle A3 and the included angle B3, or is the difference between the included angle A4 and the included angle B4, or the average value of the above four groups of differences.
S105、选择工程图中多个任意的孔的坐标,组成第二工程图坐标集合,并将第二工程图坐标集合中的多个孔的坐标,通过刚体变换矩阵集合中的每个刚体变换矩阵转换至工件坐标系,形成第二工件坐标集合。S105. Select the coordinates of a plurality of arbitrary holes in the engineering drawing to form a second engineering drawing coordinate set, and convert the coordinates of the plurality of holes in the second engineering drawing coordinate set through each rigid body transformation matrix in the rigid body transformation matrix set Convert to the workpiece coordinate system to form a second workpiece coordinate set.
S1061、根据每个刚体变换矩阵对应的第二工件坐标集合中每个孔的坐标,确定工件上与所述每个孔对应的最邻近的孔的坐标。S1061 , according to the coordinates of each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix, determine the coordinates of the nearest hole corresponding to each hole on the workpiece.
示例性的,选择的三个点f(151,50),g(164,80),h(76,65),三个点组成第二工程图坐标集合M={f,g,h};经过刚体矩阵变换后得到f’(251,50),g’(264,80),h’(176,65),并将f’、g’、h’组成第二工件坐标集合M’,根据第二工件坐标集合M’找到相对应的三点f’≈p2,g’≈p6,h’≈p7,获取三点坐标p2(251,50),p6(265,80),p7(175,65)。Exemplarily, the selected three points f(151, 50), g(164, 80), h(76, 65), the three points constitute the second engineering drawing coordinate set M={f, g, h}; After the rigid body matrix transformation, f'(251, 50), g'(264, 80), h'(176, 65) are obtained, and f', g', h' form the second workpiece coordinate set M', according to The second workpiece coordinate set M' finds the corresponding three points f'≈p2, g'≈p6, h'≈p7, and obtains the three-point coordinates p2(251,50), p6(265,80), p7(175, 65).
S1062、根据工件上与每个刚体变换矩阵对应的第二工件坐标集合中每个孔对应的最邻近的孔的坐标,确定第二工件坐标集合中所述每个孔的偏移量,组成所述每个刚体变换矩阵对应的偏移量集合。S1062, according to the coordinates of the nearest hole corresponding to each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix on the workpiece, determine the offset of each hole in the second workpiece coordinate set, and form the Describe the offset set corresponding to each rigid body transformation matrix.
根据点p2、p6和p7的坐标,可以得到p2相对于f’的偏移量为
Figure PCTCN2020132199-appb-000011
Figure PCTCN2020132199-appb-000012
同理可以得到p6相对于g’的偏移量Δg’=1,p7相对于h’的偏移量Δh’=1,同时得到偏移量集合Δf’、Δg’、Δh。
According to the coordinates of points p2, p6 and p7, the offset of p2 relative to f' can be obtained as
Figure PCTCN2020132199-appb-000011
Figure PCTCN2020132199-appb-000012
Similarly, the offset Δg'=1 of p6 relative to g', the offset Δh'=1 of p7 relative to h', and the offset sets Δf', Δg', Δh can be obtained at the same time.
S1063、根据每个刚体变换矩阵对应的偏移量集合确定每个刚体变换矩阵的配准评分,获取配准评分结果。S1063. Determine a registration score of each rigid body transformation matrix according to the offset set corresponding to each rigid body transformation matrix, and obtain a registration score result.
根据偏移量的大小,当偏移量越大时,则认定刚体变换矩阵的评分越低,通过上述方式,能够快速的计算出偏移量,准确的选择最优的刚体变换矩阵,降低计算的复杂程度,提高运算的效率。According to the size of the offset, when the offset is larger, it is determined that the score of the rigid body transformation matrix is lower. Through the above method, the offset can be quickly calculated, the optimal rigid body transformation matrix can be selected accurately, and the calculation is reduced. complexity and improve the efficiency of the operation.
S107、根据配准评分结果确定最优的刚体变换矩阵。S107. Determine an optimal rigid body transformation matrix according to the registration scoring result.
S108、获取工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为工件坐标系的坐标以实现待配准的孔与工件上的孔的配准。S108: Acquire the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the difference between the hole to be registered and the workpiece. Registration of holes.
实施例三 Embodiment 3
图3是本申请实施例三提供的一种孔集配准的方法流程示意图,如图3所示,该方法包括:3 is a schematic flowchart of a method for hole set registration provided in Embodiment 3 of the present application. As shown in FIG. 3 , the method includes:
S101、在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。S101. In the engineering drawing coordinate system, determine the coordinates of any four holes in the engineering drawing to form a first engineering drawing coordinate set; among the four holes, the straight line where two holes are located and the straight line where the other two holes are located intersect.
S1021、获取工件的扫描图像。S1021 , acquiring a scanned image of the workpiece.
S1022、通过图像处理识别扫描图像中的所有孔。S1022. Identify all holes in the scanned image through image processing.
S1023、确定所有孔在工件坐标系中的坐标,组成第一工件坐标集合。S1023: Determine the coordinates of all holes in the workpiece coordinate system to form a first workpiece coordinate set.
S1031、确定第一工程图坐标集合的四个孔a、b、c、d中,两个孔a、b所在直线与另外两个孔c、d所在直线的交点e。S1031 . Among the four holes a, b, c, and d of the first engineering drawing coordinate set, the intersection point e of the straight lines where the two holes a and b are located and the lines where the other two holes c and d are located is determined.
S1032、根据四个孔a、b、c、d和交点e的坐标,计算第一比例因子r1和第二比例因子r2,其中第一比例因子
Figure PCTCN2020132199-appb-000013
第二比例因子
Figure PCTCN2020132199-appb-000014
其中,Lae为孔a到交点e的距离,Lab为孔a到孔b的距离,Lce为孔c到交点e的距离,Lcd为孔c到孔的距离。
S1032. Calculate the first scale factor r1 and the second scale factor r2 according to the coordinates of the four holes a, b, c, d and the intersection e, wherein the first scale factor
Figure PCTCN2020132199-appb-000013
second scale factor
Figure PCTCN2020132199-appb-000014
Among them, Lae is the distance from hole a to intersection e, Lab is the distance from hole a to hole b, Lce is the distance from hole c to intersection e, and Lcd is the distance from hole c to hole.
S1033、根据第一比例因子r1和第二比例因子r2,计算工件上所有孔中每两个孔所在直线上的第一虚拟交点和第二虚拟交点的坐标,分别组成第一虚拟交点集合和第二虚拟交点集合。S1033, according to the first scale factor r1 and the second scale factor r2, calculate the coordinates of the first virtual intersection point and the second virtual intersection point on the straight line where every two holes of all the holes on the workpiece are located, and form the first virtual intersection point set and the second virtual intersection point set respectively. Two sets of virtual intersections.
S1034、将第一虚拟交点集合中的坐标与第二虚拟交点集合中的坐标进行比对,当一个第一虚拟交点的坐标和一个第二虚拟交点的坐标相同时,确定所述 一个第一虚拟交点坐标对应的两个孔和所述一个第二虚拟交点坐标对应的两个孔为一组的全等点。S1034. Compare the coordinates in the first virtual intersection set with the coordinates in the second virtual intersection set, and when the coordinates of a first virtual intersection are the same as the coordinates of a second virtual intersection, determine the first virtual intersection The two holes corresponding to the coordinates of the intersection and the two holes corresponding to the coordinates of the one second virtual intersection are a set of congruent points.
S1035、统计所有组的全等点,组成全等点集合。S1035: Count congruent points of all groups to form a congruent point set.
S1041、根据公式:
Figure PCTCN2020132199-appb-000015
计算每组的全等点对应的刚体变换矩阵,在工程图坐标系中,交点e与四个孔a、b、c、d的夹角分别为A1、A2、A3、A4,在工件坐标系中,所述每组的全等点对应的第一虚拟交点和第二虚拟交点中的一个虚拟交点与所述每组的全等点的夹角分别为B1、B2、B3、B4,
Figure PCTCN2020132199-appb-000016
为夹角A1与夹角B1之间的差值;Δx为交点e与所述一个虚拟交点x坐标的差值,Δy为交点e与所述一个虚拟交点y坐标的差值。
S1041. According to the formula:
Figure PCTCN2020132199-appb-000015
Calculate the rigid body transformation matrix corresponding to the congruent points of each group. In the coordinate system of the engineering drawing, the angles between the intersection point e and the four holes a, b, c, and d are A1, A2, A3, and A4, respectively. In the workpiece coordinate system , the angles between one of the first virtual intersection and the second virtual intersection corresponding to the congruent points of each group and the congruent points of each group are B1, B2, B3, B4, respectively,
Figure PCTCN2020132199-appb-000016
is the difference between the included angle A1 and the included angle B1; Δx is the difference between the intersection point e and the x coordinate of the one virtual intersection point, and Δy is the difference value between the intersection point e and the one virtual intersection point y coordinate.
S105、选择工程图中任意的多个孔的坐标,组成第二工程图坐标集合,并将第二工程图坐标集合中的多个孔的坐标,通过刚体变换矩阵集合中的每个刚体变换矩阵转换至工件坐标系,形成第二工件坐标集合。S105. Select the coordinates of any plurality of holes in the engineering drawing to form a second engineering drawing coordinate set, and convert the coordinates of the multiple holes in the second engineering drawing coordinate set through each rigid body transformation matrix in the rigid body transformation matrix set Convert to the workpiece coordinate system to form a second workpiece coordinate set.
S1061、根据每个刚体变换矩阵对应的第二工件坐标集合中每个孔的坐标,确定工件上与所述每个孔对应的最邻近的孔的坐标。S1061 , according to the coordinates of each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix, determine the coordinates of the nearest hole corresponding to each hole on the workpiece.
S1062、根据工件上与每个刚体变换矩阵对应的第二工件坐标集合中每个孔对应的最邻近的孔的坐标,确定第二工件坐标集合中所述每个孔的偏移量,组成所述每个刚体变换矩阵偏移量集合。S1062, according to the coordinates of the nearest hole corresponding to each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix on the workpiece, determine the offset of each hole in the second workpiece coordinate set, and form the Describe each rigid body transformation matrix offset set.
S10631、计算每个刚体变换矩阵对应的偏移量集合中偏移量的标准差。S10631. Calculate the standard deviation of the offsets in the offset set corresponding to each rigid body transformation matrix.
标准差的计算公式可以依照
Figure PCTCN2020132199-appb-000017
进行计算,其中,μ是数据的平均值。示例性的,Δf’=0、Δg’=1、Δh’=1时,
Figure PCTCN2020132199-appb-000018
可以得到
Figure PCTCN2020132199-appb-000019
The standard deviation can be calculated according to
Figure PCTCN2020132199-appb-000017
Calculations are made, where μ is the mean of the data. Exemplarily, when Δf'=0, Δg'=1, and Δh'=1,
Figure PCTCN2020132199-appb-000018
can get
Figure PCTCN2020132199-appb-000019
S10632、按照标准差由小到大的评分标准对每个刚体变换矩阵进行配准评分,获取配准评分结果。S10632: Perform a registration score for each rigid body transformation matrix according to a scoring standard with a standard deviation from small to large, and obtain a registration score result.
示例性的,根据相同的算法,计算出所有全等点的标准差,将所述标准差进行比较,假使另一个全等点的准差为0.312,由于0.312小于0.471,则该点的匹配度要更好,评分则更高。Exemplarily, according to the same algorithm, the standard deviation of all congruent points is calculated, and the standard deviations are compared. If the standard deviation of another congruent point is 0.312, since 0.312 is less than 0.471, the matching degree of this point is The better, the higher the rating.
S107、根据配准评分结果确定最优的刚体变换矩阵。S107. Determine an optimal rigid body transformation matrix according to the registration scoring result.
S108、获取工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为工件坐标系的坐标以实现待配准的孔与工件上的孔的配准。S108: Acquire the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the difference between the hole to be registered and the workpiece. Registration of holes.
实施例四 Embodiment 4
图4是本申请实施例四提供的一种孔集配准的方法流程示意图,如图4所示,该方法包括:FIG. 4 is a schematic flowchart of a method for hole set registration provided in Embodiment 4 of the present application. As shown in FIG. 4 , the method includes:
S101、在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。S101. In the engineering drawing coordinate system, determine the coordinates of any four holes in the engineering drawing to form a first engineering drawing coordinate set; among the four holes, the straight line where two holes are located and the straight line where the other two holes are located intersect.
S1021、获取工件的扫描图像。S1021 , acquiring a scanned image of the workpiece.
S1022、通过图像处理识别扫描图像中的所有孔。S1022. Identify all holes in the scanned image through image processing.
S1023、确定所有孔在工件坐标系中的坐标,组成第一工件坐标集合。S1023: Determine the coordinates of all holes in the workpiece coordinate system to form a first workpiece coordinate set.
S1031、确定第一工程图坐标集合的四个孔a、b、c、d中,两个孔a、b所在直线与另外两个孔c、d所在直线的交点e。S1031 . Among the four holes a, b, c, and d in the coordinate set of the first engineering drawing, the intersection point e of the lines where the two holes a and b are located and the lines where the other two holes c and d are located is determined.
S1032、根据四个孔a、b、c、d和交点e的坐标,计算第一比例因子r1和第二比例因子r2,其中第一比例因子
Figure PCTCN2020132199-appb-000020
第二比例因子
Figure PCTCN2020132199-appb-000021
其中,Lae为孔a到交点e的距离,Lab为孔a到孔b的距离,Lce为孔c到交点e的距离,Lcd为孔c到孔d的距离。
S1032. Calculate the first scale factor r1 and the second scale factor r2 according to the coordinates of the four holes a, b, c, d and the intersection e, wherein the first scale factor
Figure PCTCN2020132199-appb-000020
second scale factor
Figure PCTCN2020132199-appb-000021
Among them, Lae is the distance from hole a to intersection e, Lab is the distance from hole a to hole b, Lce is the distance from hole c to intersection e, and Lcd is the distance from hole c to hole d.
S1033、根据第一比例因子r1和第二比例因子r2,计算工件上所有孔中每两个孔所在直线上的第一虚拟交点和第二虚拟交点的坐标,分别组成第一虚拟交点集合和第二虚拟交点集合。S1033, according to the first scale factor r1 and the second scale factor r2, calculate the coordinates of the first virtual intersection point and the second virtual intersection point on the straight line where every two holes of all the holes on the workpiece are located, and form the first virtual intersection point set and the second virtual intersection point set respectively. Two sets of virtual intersections.
S1034、将第一虚拟交点集合中的坐标与第二虚拟交点集合中的坐标进行比 对,当一个第一虚拟交点的坐标和一个第二虚拟交点的坐标相同时,确定所述一个第一虚拟交点坐标对应的两个孔和所述一个第二虚拟交点坐标对应的两个孔为一组的全等点。S1034. Compare the coordinates in the first virtual intersection set with the coordinates in the second virtual intersection set, and when the coordinates of a first virtual intersection are the same as the coordinates of a second virtual intersection, determine the first virtual intersection The two holes corresponding to the coordinates of the intersection and the two holes corresponding to the coordinates of the one second virtual intersection are a set of congruent points.
S1035、统计所有组的全等点,组成全等点集合。S1035: Count congruent points of all groups to form a congruent point set.
S1041、根据公式:
Figure PCTCN2020132199-appb-000022
计算每组的全等点对应的刚体变换矩阵,在工程图坐标系中,交点e与四个孔a、b、c、d的夹角分别为A1、A2、A3、A4,在工件坐标系中,每组的全等点对应的第一虚拟交点和第二虚拟交点中的一个虚拟交点与所述每组的全等点的夹角分别为B1、B2、B3、B4,
Figure PCTCN2020132199-appb-000023
为夹角A1与夹角B1之间的差值;Δx为交点e与所述一个虚拟交点x坐标的差值,Δy为交点e与所述一个虚拟交点y坐标的差值。
S1041. According to the formula:
Figure PCTCN2020132199-appb-000022
Calculate the rigid body transformation matrix corresponding to the congruent points of each group. In the coordinate system of the engineering drawing, the angles between the intersection point e and the four holes a, b, c, and d are A1, A2, A3, and A4, respectively. In the workpiece coordinate system , the included angles between one of the first virtual intersection and the second virtual intersection corresponding to the congruent points of each group and the congruent points of each group are B1, B2, B3, B4, respectively,
Figure PCTCN2020132199-appb-000023
is the difference between the included angle A1 and the included angle B1; Δx is the difference between the intersection point e and the x coordinate of the one virtual intersection point, and Δy is the difference value between the intersection point e and the one virtual intersection point y coordinate.
S105、选择工程图中任意的多个孔的坐标,组成第二工程图坐标集合,并将第二工程图坐标集合中的多个孔的坐标,通过刚体变换矩阵集合中的每个刚体变换矩阵转换至工件坐标系,形成第二工件坐标集合。S105. Select the coordinates of any plurality of holes in the engineering drawing to form a second engineering drawing coordinate set, and convert the coordinates of the multiple holes in the second engineering drawing coordinate set through each rigid body transformation matrix in the rigid body transformation matrix set Convert to the workpiece coordinate system to form a second workpiece coordinate set.
S1061、根据每个刚体变换矩阵对应的第二工件坐标集合中每个孔的坐标,确定工件上与所述每个孔对应的最邻近的孔的坐标。S1061 , according to the coordinates of each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix, determine the coordinates of the nearest hole corresponding to each hole on the workpiece.
S1062、根据工件上与每个刚体变换矩阵对应的第二工件坐标集合中每个孔对应的最邻近的孔的坐标,确定第二工件坐标集合中所述每个孔的偏移量,组成所述每个刚体变换矩阵对应的偏移量集合。S1062, according to the coordinates of the nearest hole corresponding to each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix on the workpiece, determine the offset of each hole in the second workpiece coordinate set, and form the Describe the offset set corresponding to each rigid body transformation matrix.
S10633、统计每个刚体变换矩阵对应的偏移量集合中,偏移量位于预设偏移量范围内的孔的数量。S10633: Count the number of holes whose offsets are within a preset offset range in the offset set corresponding to each rigid body transformation matrix.
示例性的,Δf’、Δg’、Δh’分别为0、1、1,预设偏移量为1,则合格的点数为3,若设定的预设偏移量为0.5,则合格的孔的数量为1。通过预设偏移量,能够简单有效的判断出合格孔的数量,减少计算量,提高计算效率。Exemplarily, Δf', Δg', and Δh' are respectively 0, 1, and 1, and the preset offset is 1, and the number of qualified points is 3. If the preset preset offset is 0.5, the qualified points are The number of holes is 1. By presetting the offset, the number of qualified holes can be simply and effectively determined, the calculation amount is reduced, and the calculation efficiency is improved.
S10634、按照位于预设偏移量范围内的孔的数量由大到小的评分标准,对每个刚体变换矩阵进行配准评分,获取配准评分结果。S10634. Perform a registration score on each rigid body transformation matrix according to the scoring standard of the number of holes located within the preset offset range from large to small, and obtain a registration score result.
可以理解的是,在同一预设偏移量下,合格的点数越多,则匹配度越好,评分越高。通过上述方式,能够快速的获取评分结果,在孔集较多的情况下,能够迅速的得出评分,选择合适的矩阵,提高便利性。It can be understood that under the same preset offset, the more qualified points, the better the matching degree and the higher the score. Through the above method, the scoring result can be obtained quickly, and in the case of a large number of hole sets, the scoring can be obtained quickly, and an appropriate matrix can be selected to improve convenience.
S107、根据配准评分结果确定最优的刚体变换矩阵。S107. Determine an optimal rigid body transformation matrix according to the registration scoring result.
S108、获取工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为工件坐标系的坐标以实现待配准的孔与工件上的孔的配准。S108. Acquire the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the difference between the hole to be registered and the workpiece. Registration of holes.
实施例五Embodiment 5
图5是本申请实施例提供的一种孔集配准的装置结构示意图,如图5所示,一种孔集配准装置,包括:FIG. 5 is a schematic structural diagram of a device for hole set registration provided by an embodiment of the present application. As shown in FIG. 5 , a hole set registration device includes:
第一工程图坐标集合运算模块1,设置为在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。The first engineering drawing coordinate set operation module 1 is set to determine the coordinates of any four holes in the engineering drawing in the engineering drawing coordinate system to form the first engineering drawing coordinate set; wherein, among the four holes, two holes are located in intersects the line where the other two holes are located.
第一工件坐标集合运算模块2,设置为在工件坐标系中,确定工件上所有孔的坐标,组成第一工件坐标集合。The first workpiece coordinate set operation module 2 is configured to determine the coordinates of all holes on the workpiece in the workpiece coordinate system to form a first workpiece coordinate set.
全等点集合运算模块3,设置为根据第一工程图坐标集合以及第一工件坐标集合,在工件坐标系中,确定与第一工程图坐标集合中四个孔的坐标对应的所有组的全等点,组成全等点集合;每组的全等点组成的图形形状与第一工程图坐标集合中的四个孔组成的图形形状相同。The full-equipoint set operation module 3 is configured to, according to the first engineering drawing coordinate set and the first workpiece coordinate set, in the workpiece coordinate system, determine the complete set of all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set. Congruent points constitute a set of congruent points; the shape of a graph composed of congruent points of each group is the same as that of a graph composed of four holes in the coordinate set of the first engineering drawing.
全等点刚体变换矩阵集合运算模块4,设置为根据全等点集合中每组的全等点的坐标以及第一工程图坐标集合中四个孔的坐标,计算每组的全等点对应的刚体变换矩阵,组成刚体变换矩阵集合;工程图坐标系中的坐标经刚体变换矩阵可转换至工件坐标系。The congruent rigid body transformation matrix set operation module 4 is set to calculate the corresponding congruent points of each group according to the coordinates of the congruent points of each group in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set The rigid body transformation matrix constitutes a rigid body transformation matrix set; the coordinates in the engineering drawing coordinate system can be converted to the workpiece coordinate system through the rigid body transformation matrix.
第二工件坐标集合运算模块5,设置为选择工程图中任意的多个孔的坐标,组成第二工程图坐标集合,并将第二工程图坐标集合中的多个孔的坐标,通过刚体变换矩阵集合中的每个刚体变换矩阵转换至工件坐标系,形成第二工件坐标集合;The second workpiece coordinate set operation module 5 is set to select the coordinates of any number of holes in the engineering drawing to form a second engineering drawing coordinate set, and transform the coordinates of the multiple holes in the second engineering drawing coordinate set through rigid body transformation Each rigid body transformation matrix in the matrix set is converted to the workpiece coordinate system to form a second workpiece coordinate set;
评分模块6,设置为根据第二工件坐标集合中每个孔的坐标以及工件上与所述每个孔对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果。The scoring module 6 is configured to perform registration and scoring on each rigid body transformation matrix according to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to each hole on the workpiece to obtain registration Scoring results.
处理模块7,设置为根据配准评分结果确定最优的刚体变换矩阵;并且获取工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐 标,转换为工件坐标系的坐标以实现待配准的孔与工件上的孔的配准。The processing module 7 is set to determine the optimal rigid body transformation matrix according to the registration score result; and obtain the coordinates of the hole to be registered on the engineering drawing, and according to the optimal rigid body transformation matrix, the coordinates of the hole to be registered are obtained, Convert to the coordinates of the workpiece coordinate system to realize the registration of the hole to be registered with the hole on the workpiece.
本申请实施例提供的一种孔集配准的装置,首先通过第一工程图坐标集合运算模块确定四个孔的坐标来组成第一工程图坐标集合;其次,通过第一工件坐标集合运算模块在工件坐标系中确定工件上所有孔的坐标组成第一工件坐标集合,再通过全等点集合运算模块3根据第一工程图坐标集合和第一工件坐标集合寻找出与第一工程图坐标集合中四个孔的坐标的全等点,并组成全等点集合;然后通过全等点刚体变换矩阵集合运算模块4计算每组的全等点对应的刚体变换矩阵,并组成刚体变换矩阵集合;之后通过第二工件坐标集合运算模块5组成第二工程图坐标集合,并形成第二工件坐标集合;再通过评分模块6根据第二工件坐标集合中每个孔的坐标以及工件上与所述每个孔对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果;最后通过处理模块7根据配准评分结果确定最优的刚体变换矩阵;并且获取工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为工件坐标系的坐标以实现孔的配准。通过上述装置,能够快速计算出最优的刚体变换矩阵,通过最优的刚体变换矩阵对工程图中的孔与工件上的孔进行准确配准,减少了人工计算刚体变换矩阵的工序,降低人工计算错误率,提高计算效果,缩短工艺时长,提高工作效率,实现全自动检测。In the device for hole set registration provided by the embodiment of the present application, firstly, the coordinates of four holes are determined by the first engineering drawing coordinate set computing module to form a first engineering drawing coordinate set; In the workpiece coordinate system, the coordinates of all holes on the workpiece are determined to form the first workpiece coordinate set, and then through the congruent point set operation module 3, according to the first engineering drawing coordinate set and the first workpiece coordinate set, find out the coordinates of the first engineering drawing coordinate set. The coordinates of the four holes are congruent points, and form a congruent point set; then calculate the rigid body transformation matrix corresponding to the congruent points of each group through the congruent rigid body transformation matrix set operation module 4, and form a rigid body transformation matrix set; then A second engineering drawing coordinate set is formed by the second workpiece coordinate set operation module 5, and a second workpiece coordinate set is formed; and then the scoring module 6 is used according to the coordinates of each hole in the second workpiece coordinate set and the The coordinates of the nearest hole corresponding to the hole, perform registration scoring on each rigid body transformation matrix, and obtain the registration scoring result; finally, the processing module 7 determines the optimal rigid body transformation matrix according to the registration scoring result; and obtain the engineering drawing. The coordinates of the holes to be registered are converted into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the registration of the holes. Through the above device, the optimal rigid body transformation matrix can be quickly calculated, and the holes in the engineering drawing and the holes on the workpiece can be accurately registered through the optimal rigid body transformation matrix, which reduces the process of manually calculating the rigid body transformation matrix and reduces the labor cost. Calculate the error rate, improve the calculation effect, shorten the process time, improve the work efficiency, and realize the automatic detection.
可选的,第一工程图坐标集合运算模块1包括:坐标确定单元11,设置为在工程图坐标系中,确定工程图中所有孔的坐标;坐标选择单元12,设置为从所述工程图中所有孔的坐标中,随机选择任意的四个孔的坐标,组成第一工程图坐标集合;其中,所述四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。Optionally, the first engineering drawing coordinate set operation module 1 includes: a coordinate determining unit 11, which is set to determine the coordinates of all holes in the engineering drawing in the engineering drawing coordinate system; Among the coordinates of all the holes in , the coordinates of any four holes are randomly selected to form the first engineering drawing coordinate set; wherein, among the four holes, the lines where two holes are located intersect with the lines where the other two holes are located.
可选的,第一工程图坐标集合运算模块还包括:坐标获取单元13,设置为获取工程图中任意的四个孔在工程图坐标系中的坐标信息,组成第一工程图坐标集合;其中,所述四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。Optionally, the first engineering drawing coordinate set operation module further includes: a coordinate obtaining unit 13, configured to obtain coordinate information of any four holes in the engineering drawing in the engineering drawing coordinate system to form the first engineering drawing coordinate set; wherein , among the four holes, the line where two holes are located intersects the line where the other two holes are located.
可选的,第一工件坐标集合运算模块2包括:扫描信息获取单元21,设置为获取工件的扫描图像;图像处理单元22,设置为通过图像处理识别所述扫描图像中的所有孔;工件坐标确定单元23,设置为确定所有孔在工件坐标系中的坐标,组成第一工件坐标集合。Optionally, the first workpiece coordinate set operation module 2 includes: a scanning information acquisition unit 21, configured to obtain a scanned image of the workpiece; an image processing unit 22, configured to identify all holes in the scanned image through image processing; workpiece coordinates The determining unit 23 is configured to determine the coordinates of all the holes in the workpiece coordinate system to form a first workpiece coordinate set.
可选的,全等点集合运算模块3包括:交点确定单元31,设置为确定所述 第一工程图坐标集合的四个孔a、b、c、d中,两个孔a、b所在直线与另外两个孔c、d所在直线的交点e;比例因子计算单元32,设置为根据所述四个孔a、b、c、d和所述交点e的坐标,计算第一比例因子r1和第二比例因子r2,其中第一比例因子
Figure PCTCN2020132199-appb-000024
第二比例因子
Figure PCTCN2020132199-appb-000025
其中,Lae为孔a到交点e的距离,Lab为孔a到孔b的距离,Lce为孔c到交点e的距离,Lcd为孔c到孔d的距离;虚拟交点计算单元33,设置为根据所述第一比例因子r1和所述第二比例因子r2,计算工件上所有孔中每两个孔所在直线上的第一虚拟交点和第二虚拟交点的坐标,分别组成第一虚拟交点集合和第二虚拟交点集合;比较单元34,设置为将所述第一虚拟交点集合中的坐标与所述第二虚拟交点集合中的坐标进行比对,当一个第一虚拟交点的坐标和一个第二虚拟交点的坐标相同时,确定所述一个第一虚拟交点坐标对应的两个孔和所述一个第二虚拟交点坐标对应的两个孔为一组的全等点;统计单元35,设置为统计所有组的全等点,组成全等点集合。
Optionally, the congruent point set operation module 3 includes: an intersection determination unit 31, configured to determine, among the four holes a, b, c, and d of the first engineering drawing coordinate set, the straight lines where two holes a, b are located. The intersection point e of the straight line where the other two holes c and d are located; the scale factor calculation unit 32 is set to calculate the first scale factor r1 and The second scale factor r2, where the first scale factor
Figure PCTCN2020132199-appb-000024
second scale factor
Figure PCTCN2020132199-appb-000025
Wherein, Lae is the distance from hole a to intersection e, Lab is the distance from hole a to hole b, Lce is the distance from hole c to intersection e, and Lcd is the distance from hole c to hole d; the virtual intersection calculation unit 33 is set as According to the first scale factor r1 and the second scale factor r2, the coordinates of the first virtual intersection point and the second virtual intersection point on the straight line where every two holes of all the holes on the workpiece are calculated, respectively forming the first virtual intersection point set and the second virtual intersection set; the comparison unit 34 is configured to compare the coordinates in the first virtual intersection set with the coordinates in the second virtual intersection set, when the coordinates of a first virtual intersection and a first virtual intersection When the coordinates of the two virtual intersections are the same, it is determined that the two holes corresponding to the coordinates of the first virtual intersection and the two holes corresponding to the coordinates of the second virtual intersection are a group of congruent points; the statistical unit 35 is set to Count the congruent points of all groups to form a set of congruent points.
可选的,全等点刚体变换矩阵集合运算模块4设置为根据公式:
Figure PCTCN2020132199-appb-000026
计算每组的全等点对应的刚体变换矩阵,在工程图坐标系中,所述交点e与四个孔a、b、c、d的夹角分别为A1、A2、A3、A4,在工件坐标系中,所述每组的全等点对应的第一虚拟交点和第二虚拟交点中的一个虚拟交点与所述每组的全等点的夹角分别为B1、B2、B3、B4,
Figure PCTCN2020132199-appb-000027
为所述夹角A1与所述夹角B1之间的差值;Δx为所述交点e与所述一个虚拟交点x坐标的差值,Δy为所述交点e与所述一个虚拟交点y坐标的差值。
Optionally, the congruent rigid body transformation matrix set operation module 4 is set according to the formula:
Figure PCTCN2020132199-appb-000026
Calculate the rigid body transformation matrix corresponding to the congruent points of each group. In the coordinate system of the engineering drawing, the angles between the intersection point e and the four holes a, b, c, and d are A1, A2, A3, and A4, respectively. In the coordinate system, the included angles between one of the first virtual intersection and the second virtual intersection corresponding to the congruent points of each group and the congruent points of each group are B1, B2, B3, and B4, respectively,
Figure PCTCN2020132199-appb-000027
is the difference between the included angle A1 and the included angle B1; Δx is the difference between the intersection point e and the x-coordinate of the one virtual intersection point, and Δy is the y-coordinate of the intersection point e and the one virtual intersection point difference value.
可选的,评分模块6包括:临近孔坐标确定单元61,设置为根据每个刚体变换矩阵对应的所述第二工件坐标集合中每个孔的坐标,确定工件上与所述每个孔对应的最邻近的孔的坐标;偏移量确定单元62,设置为根据工件上与每个刚体变换矩阵对应的所述第二工件坐标集合中每个孔对应的最邻近的孔的坐 标,确定所述第二工件坐标集合中所述每个孔的偏移量,组成所述每个刚体变换矩阵对应的偏移量集合;评分计算单元63,设置为根据每个刚体变换矩阵对应的偏移量集合确定每个刚体变换矩阵的配准评分,获取配准评分结果。Optionally, the scoring module 6 includes: an adjacent hole coordinate determination unit 61, configured to determine the workpiece corresponding to each hole according to the coordinates of each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix. The coordinates of the nearest hole; the offset determination unit 62 is set to determine the coordinates of the nearest hole corresponding to each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix on the workpiece The offset of each hole in the second workpiece coordinate set constitutes the offset set corresponding to each rigid body transformation matrix; the scoring calculation unit 63 is set to the offset corresponding to each rigid body transformation matrix. The set determines the registration score of each rigid body transformation matrix, and obtains the registration score result.
可选的,评分计算单元63包括:第一评分计算子单元631或第二评分计算子单元632;第一评分计算子单元631设置为计算每个刚体变换矩阵对应的所述偏移量集合中偏移量的标准差,并按照所述标准差由小到大的评分标准对每个刚体变换矩阵进行配准评分,获取配准评分结果;第二评分计算子单元632设置为统计每个刚体变换矩阵对应的所述偏移量集合中,偏移量位于预设偏移量范围内的孔的数量,并按照位于预设偏移量范围内的孔的数量由大到小的评分标准,对每个刚体变换矩阵进行配准评分,获取配准评分结果。Optionally, the score calculation unit 63 includes: a first score calculation subunit 631 or a second score calculation subunit 632; the first score calculation subunit 631 is configured to calculate the offset set corresponding to each rigid body transformation matrix. The standard deviation of the offset, and according to the scoring standard of the standard deviation from small to large, each rigid body transformation matrix is registered and scored, and the registration score result is obtained; the second score calculation subunit 632 is set to count each rigid body. In the offset set corresponding to the transformation matrix, the number of holes whose offsets are located within the preset offset range, and the scoring criteria according to the number of holes located within the preset offset range from large to small, Perform registration scoring on each rigid body transformation matrix to obtain the registration scoring result.
上述孔集配准的装置可执行本申请任意实施例所提供的孔集配准的方法,具备执行方法相应的功能模块。The above hole set registration apparatus can execute the hole set registration method provided by any embodiment of the present application, and has corresponding functional modules for executing the method.
实施例六 Embodiment 6
图6是本申请实施例提供的一种孔集配准的设备结构示意图,如图6所示,一种终端设备,包括:一个或多个处理器41;存储装置42,该设备中的处理器41可以是一个或多个,图10中以一个处理器41为例;存储装置42用于存储一个或多个程序;该一个或多个程序被一个或多个处理器41执行,使得一个或多个处理器41实现如本申请实施例中任一项所述的孔集配准方法。FIG. 6 is a schematic structural diagram of a device for hole set registration provided by an embodiment of the present application. As shown in FIG. 6, a terminal device includes: one or more processors 41; a storage device 42, the processor in the device 41 can be one or more, and a processor 41 is taken as an example in FIG. 10; the storage device 42 is used to store one or more programs; the one or more programs are executed by one or more processors 41, so that one or more The plurality of processors 41 implement the hole set registration method described in any one of the embodiments of the present application.
所述设备还可以包括:输入装置43和输出装置44。The apparatus may further include: an input device 43 and an output device 44 .
设备中的处理器41、存储装置42、输入装置43和输出装置44可以通过总线或其他方式连接,图9中以通过总线连接为例。The processor 41 , the storage device 42 , the input device 43 and the output device 44 in the device may be connected by a bus or in other ways, and the connection by a bus is taken as an example in FIG. 9 .
该设备中的存储装置42作为一种计算机可读存储介质,可设置为存储一个或多个程序,所述程序可以是软件程序、计算机可执行程序以及模块,如本申请实施例一或二所提供的孔集配准方法对应的程序指令/模块(例如,附图8所示的孔集配准装置中的模块)。处理器41通过运行存储在存储装置42中的软件程序、指令以及模块,从而执行终端设备的多种功能应用以及数据处理,即实现上述方法实施例中孔集配准方法。As a computer-readable storage medium, the storage device 42 in the device may be configured to store one or more programs, and the programs may be software programs, computer-executable programs, and modules, as described in Embodiment 1 or Embodiment 2 of the present application. Program instructions/modules corresponding to the provided hole set registration method (for example, the modules in the hole set registration device shown in FIG. 8 ). The processor 41 executes various functional applications and data processing of the terminal device by running the software programs, instructions and modules stored in the storage device 42 , that is, to implement the hole set registration method in the above method embodiments.
存储装置42可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据设备的使用所 创建的数据等。此外,存储装置42可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储装置42可包括相对于处理器41远程设置的存储器,这些远程存储器可以通过网络连接至设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The storage device 42 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the device, and the like. Additionally, storage device 42 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, storage device 42 may include memory located remotely from processor 41, which may be connected to the device through a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
输入装置43可设置为接收输入的数字或字符信息,以及产生与设备的用户设置以及功能控制有关的键信号输入。输出装置44可包括显示屏等显示设备。The input device 43 may be configured to receive input numerical or character information, and to generate key signal input related to user settings and function control of the device. The output device 44 may include a display device such as a display screen.
并且,当上述设备所包括一个或者多个程序被所述一个或者多个处理器41执行时,程序进行如下操作:Moreover, when one or more programs included in the above-mentioned device are executed by the one or more processors 41, the program performs the following operations:
在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。In the engineering drawing coordinate system, the coordinates of any four holes in the engineering drawing are determined to form the first engineering drawing coordinate set; among the four holes, the lines where two holes are located intersect with the lines where the other two holes are located.
在工件坐标系中,确定工件上所有孔的坐标,组成第一工件坐标集合。In the workpiece coordinate system, the coordinates of all holes on the workpiece are determined to form the first workpiece coordinate set.
根据第一工程图坐标集合以及第一工件坐标集合,在工件坐标系中,确定与第一工程图坐标集合中四个孔的坐标对应的所有组的全等点,组成全等点集合;每组的全等点组成的图形形状与第一工程图坐标集合中的四个孔组成的图形形状相同。According to the first engineering drawing coordinate set and the first workpiece coordinate set, in the workpiece coordinate system, the congruent points of all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set are determined to form a congruent point set; The shape of the graph composed of congruent points of the group is the same as the graph shape composed of the four holes in the first drawing coordinate set.
根据全等点集合中每组的全等点的坐标以及第一工程图坐标集合中四个孔的坐标,计算每组的全等点对应的刚体变换矩阵,组成刚体变换矩阵集合;工程图坐标系中的坐标经刚体变换矩阵可转换至工件坐标系。According to the coordinates of each group of congruent points in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set, calculate the rigid body transformation matrix corresponding to each group of congruent points to form a rigid body transformation matrix set; engineering drawing coordinates The coordinates in the system can be transformed to the workpiece coordinate system through the rigid body transformation matrix.
选择工程图中任意的多个孔的坐标,组成第二工程图坐标集合,并将第二工程图坐标集合中的多个孔的坐标,通过刚体变换矩阵集合中的每个刚体变换矩阵转换至工件坐标系,形成第二工件坐标集合;根据第二工件坐标集合中每个孔的坐标以及工件上与所述每个孔对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果。Select the coordinates of any number of holes in the engineering drawing to form a second engineering drawing coordinate set, and convert the coordinates of the multiple holes in the second engineering drawing coordinate set to each rigid body transformation matrix in the rigid body transformation matrix set. The workpiece coordinate system forms a second workpiece coordinate set; according to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to each hole on the workpiece, each rigid body transformation matrix is registered Score, get the registration score results.
根据配准评分结果确定最优的刚体变换矩阵。The optimal rigid body transformation matrix is determined according to the registration score results.
获取工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为工件坐标系的坐标以实现待配准的孔与工件上的孔的配准。Obtain the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the relationship between the hole to be registered and the hole on the workpiece. registration.
实施例七 Embodiment 7
本发明实施例七提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时用于执行孔集配准方法,该方法包括: Embodiment 7 of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, is used to execute a method for hole set registration, and the method includes:
在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。In the engineering drawing coordinate system, the coordinates of any four holes in the engineering drawing are determined to form the first engineering drawing coordinate set; among the four holes, the lines where two holes are located intersect with the lines where the other two holes are located.
在工件坐标系中,确定工件上所有孔的坐标,组成第一工件坐标集合。In the workpiece coordinate system, the coordinates of all holes on the workpiece are determined to form the first workpiece coordinate set.
根据第一工程图坐标集合以及第一工件坐标集合,在工件坐标系中,确定与第一工程图坐标集合中四个孔的坐标对应的所有组的全等点,组成全等点集合;每组的全等点组成的图形形状与第一工程图坐标集合中的四个孔组成的图形形状相同。According to the first engineering drawing coordinate set and the first workpiece coordinate set, in the workpiece coordinate system, the congruent points of all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set are determined to form a congruent point set; The shape of the graph composed of congruent points of the group is the same as the graph shape composed of the four holes in the first drawing coordinate set.
根据全等点集合中每组的全等点的坐标以及第一工程图坐标集合中四个孔的坐标,计算每组的全等点对应的刚体变换矩阵,组成刚体变换矩阵集合;工程图坐标系中的坐标经刚体变换矩阵可转换至工件坐标系。According to the coordinates of each group of congruent points in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set, calculate the rigid body transformation matrix corresponding to each group of congruent points to form a rigid body transformation matrix set; engineering drawing coordinates The coordinates in the system can be transformed to the workpiece coordinate system through the rigid body transformation matrix.
选择工程图中任意的多个孔的坐标,组成第二工程图坐标集合,并将第二工程图坐标集合中的多个孔的坐标,通过刚体变换矩阵集合中的每个刚体变换矩阵转换至工件坐标系,形成第二工件坐标集合;根据第二工件坐标集合中每个孔的坐标以及工件上与所述每个孔对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果。Select the coordinates of any number of holes in the engineering drawing to form a second engineering drawing coordinate set, and convert the coordinates of the multiple holes in the second engineering drawing coordinate set to each rigid body transformation matrix in the rigid body transformation matrix set. The workpiece coordinate system forms a second workpiece coordinate set; according to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to each hole on the workpiece, each rigid body transformation matrix is registered Score, get the registration score results.
根据配准评分结果确定最优的刚体变换矩阵。The optimal rigid body transformation matrix is determined according to the registration score results.
获取工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为工件坐标系的坐标以实现待配准的孔与工件上的孔的配准。Obtain the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered into the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the relationship between the hole to be registered and the hole on the workpiece. registration.
可选的,该程序被处理器执行时还可以用于执行本申请任意实施例所提供的孔集配准的方法。Optionally, when the program is executed by the processor, it can also be used to execute the method for hole set registration provided in any embodiment of the present application.
本申请实施例的计算机存储介质,可以采用一个或多个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(Random Access Memory,RAM)、只读存储器(Read Only Memory,ROM)、可擦式可编程只读存储器(Erasable Programmable Read Only Memory,EPROM)、闪存、光纤、便携式光盘-只读存储器(Compact Disc-Read-Only Memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结 合使用。The computer storage medium of the embodiments of the present application may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above. More specific examples (non-exhaustive list) of computer readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read only memory (Read Only Memory, ROM), Erasable Programmable Read Only Memory (EPROM), Flash Memory, Optical Fiber, Portable Disc-Read-Only Memory (Compact Disc-Read-Only Memory, CD-ROM), Optical storage devices, magnetic storage devices, or any suitable combination of the above. A computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,计算机可读的信号介质中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于:电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with computer-readable program code embodied in the computer-readable signal medium. Such propagated data signals may take a variety of forms including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、无线电频率(RadioFrequency,RF)等等,或者上述的任意合适的组合。Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言或其组合来编写用于执行本发明操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(Local Area Network,LAN)或广域网(Wide Area Network,WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for carrying out operations of the present invention may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, but also conventional Procedural programming language - such as the "C" language or similar programming language. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or it can be connected to an external computer (eg using an internet service provider to connect via the internet).

Claims (12)

  1. 一种孔集配准的方法,包括:A method for hole set registration, comprising:
    在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,所述四个孔中,两个孔所在的直线与另外两个孔所在的直线相交;In the engineering drawing coordinate system, the coordinates of any four holes in the engineering drawing are determined to form a first engineering drawing coordinate set; wherein, among the four holes, the straight line where two holes are located and the straight line where the other two holes are located intersect;
    在工件坐标系中,确定工件上所有孔的坐标,组成第一工件坐标集合;In the workpiece coordinate system, determine the coordinates of all holes on the workpiece to form the first workpiece coordinate set;
    根据所述第一工程图坐标集合以及所述第一工件坐标集合,在所述工件坐标系中,确定与所述第一工程图坐标集合中所述四个孔的坐标对应的所有组的全等点,组成全等点集合;每组的全等点组成的图形形状与所述第一工程图坐标集合中的所述四个孔组成的图形形状相同;According to the first engineering drawing coordinate set and the first workpiece coordinate set, in the workpiece coordinate system, determine all groups corresponding to the coordinates of the four holes in the first engineering drawing coordinate set. Congruent points constitute a set of congruent points; the shape of the graph composed of congruent points of each group is the same as the graph shape composed of the four holes in the coordinate set of the first engineering drawing;
    根据所述全等点集合中每组的全等点的坐标以及所述第一工程图坐标集合中所述四个孔的坐标,计算每组的全等点对应的刚体变换矩阵,组成刚体变换矩阵集合;所述工程图坐标系中的坐标经所述刚体变换矩阵可转换至所述工件坐标系;According to the coordinates of the congruent points of each group in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set, the rigid body transformation matrix corresponding to the congruent points of each group is calculated to form a rigid body transformation A set of matrices; the coordinates in the engineering drawing coordinate system can be converted to the workpiece coordinate system through the rigid body transformation matrix;
    选择所述工程图中任意的多个孔的坐标,组成第二工程图坐标集合,并将所述第二工程图坐标集合中的多个孔的坐标,通过所述刚体变换矩阵集合中的每个刚体变换矩阵转换至所述工件坐标系,形成第二工件坐标集合;Select the coordinates of any number of holes in the engineering drawing to form a second engineering drawing coordinate set, and convert the coordinates of the multiple holes in the second engineering drawing coordinate set through each of the rigid body transformation matrix sets. A rigid body transformation matrix is converted into the workpiece coordinate system to form a second workpiece coordinate set;
    根据所述第二工件坐标集合中每个孔的坐标以及工件上与所述每个孔对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果;According to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to each hole on the workpiece, perform a registration score on each rigid body transformation matrix to obtain a registration score result;
    根据所述配准评分结果确定最优的刚体变换矩阵;Determine the optimal rigid body transformation matrix according to the registration scoring result;
    获取所述工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为所述工件坐标系的坐标以实现所述待配准的孔与所述工件上的孔的配准。Obtain the coordinates of the hole to be registered on the engineering drawing, and convert the coordinates of the hole to be registered to the coordinates of the workpiece coordinate system according to the optimal rigid body transformation matrix to realize the hole to be registered. Registration with holes on the workpiece.
  2. 根据权利要求1所述的孔集配准的方法,其中,在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;包括:The method for hole set registration according to claim 1, wherein, in the engineering drawing coordinate system, the coordinates of any four holes in the engineering drawing are determined to form a first engineering drawing coordinate set; comprising:
    在工程图坐标系中,确定工程图中所有孔的坐标;In the drawing coordinate system, determine the coordinates of all holes in the drawing;
    从所述工程图中所有孔的坐标中,随机选择任意的四个孔的坐标,组成第一工程图坐标集合;其中,所述四个孔中,两个孔所在的直线与另外两个孔所在的直线相交。From the coordinates of all holes in the engineering drawing, randomly select the coordinates of any four holes to form a first engineering drawing coordinate set; wherein, among the four holes, the straight line where the two holes are located and the other two holes where the lines intersect.
  3. 根据权利要求1所述的孔集配准的方法,其中,在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合,包括:The method for hole set registration according to claim 1, wherein, in the engineering drawing coordinate system, the coordinates of any four holes in the engineering drawing are determined to form the first engineering drawing coordinate set, comprising:
    获取工程图中任意的四个孔在工程图坐标系中的坐标信息,组成第一工程图坐标集合;其中,所述四个孔中,两个孔所在的直线与另外两个孔所在的直 线相交。Obtain the coordinate information of any four holes in the engineering drawing coordinate system in the engineering drawing coordinate system to form a first engineering drawing coordinate set; wherein, among the four holes, the lines where two holes are located and the lines where the other two holes are located are intersect.
  4. 根据权利要求1所述的孔集配准的方法,其中,在工件坐标系中,确定工件上所有孔的坐标,组成第一工件坐标集合,包括:The method for hole set registration according to claim 1, wherein, in the workpiece coordinate system, the coordinates of all holes on the workpiece are determined to form a first workpiece coordinate set, comprising:
    获取工件的扫描图像;Obtain a scanned image of the workpiece;
    通过图像处理识别所述扫描图像中的所有孔;Identify all holes in the scanned image by image processing;
    确定所有孔在工件坐标系中的坐标,组成第一工件坐标集合。Determine the coordinates of all holes in the workpiece coordinate system to form the first workpiece coordinate set.
  5. 根据权利要求1所述的孔集配准的方法,其中,根据所述第一工程图坐标集合以及所述第一工件坐标集合,确定在所述工件坐标系中与所述第一工程图坐标集合中所述四个孔的坐标对应的所有组的全等点,组成全等点集合,包括:The method for hole set registration according to claim 1, wherein, according to the first engineering drawing coordinate set and the first workpiece coordinate set, determining the workpiece coordinate system and the first engineering drawing coordinate set The congruent points of all groups corresponding to the coordinates of the four holes described in , form a congruent point set, including:
    确定所述第一工程图坐标集合的四个孔a、b、c、d中的两个孔a、b所在直线与另外两个孔c、d所在直线的交点e;Determine the intersection e of the straight line where the two holes a, b in the four holes a, b, c, d of the first engineering drawing coordinate set are located and the straight line where the other two holes c, d are located;
    根据所述四个孔a、b、c、d和所述交点e的坐标,计算第一比例因子r1和第二比例因子r2,其中第一比例因子
    Figure PCTCN2020132199-appb-100001
    第二比例因子
    Figure PCTCN2020132199-appb-100002
    其中,Lae为孔a到交点e的距离,Lab为孔a到孔b的距离,Lce为孔c到交点e的距离,Lcd为孔c到孔d的距离;
    According to the coordinates of the four holes a, b, c, d and the intersection point e, a first scale factor r1 and a second scale factor r2 are calculated, wherein the first scale factor
    Figure PCTCN2020132199-appb-100001
    second scale factor
    Figure PCTCN2020132199-appb-100002
    Among them, Lae is the distance from hole a to intersection e, Lab is the distance from hole a to hole b, Lce is the distance from hole c to intersection e, and Lcd is the distance from hole c to hole d;
    根据所述第一比例因子r1和所述第二比例因子r2,计算工件上所有孔中每两个孔所在直线上的第一虚拟交点的坐标和第二虚拟交点的坐标,分别组成第一虚拟交点集合和第二虚拟交点集合;According to the first scale factor r1 and the second scale factor r2, the coordinates of the first virtual intersection and the coordinates of the second virtual intersection on the straight line where every two holes of all the holes in the workpiece are calculated to form the first virtual intersection respectively. an intersection set and a second virtual intersection set;
    将所述第一虚拟交点集合中的坐标与所述第二虚拟交点集合中的坐标进行比对,在一个第一虚拟交点的坐标和一个第二虚拟交点的坐标相同的情况下,确定所述一个第一虚拟交点坐标对应的两个孔和所述一个第二虚拟交点坐标对应的两个孔为一组的全等点;Comparing the coordinates in the first virtual intersection set with the coordinates in the second virtual intersection set, and in the case that the coordinates of a first virtual intersection and the coordinates of a second virtual intersection are the same, determine the Two holes corresponding to a first virtual intersection coordinate and two holes corresponding to the one second virtual intersection coordinate are a set of congruent points;
    统计所有组的全等点,组成全等点集合。Count the congruent points of all groups to form a set of congruent points.
  6. 根据权利要求5所述的孔集配准的方法,其中,根据所述全等点集合中每组的全等点的坐标以及所述第一工程图坐标集合中所述四个孔的坐标,计算每组的全等点对应的刚体变换矩阵,包括:The method for hole set registration according to claim 5, wherein the calculation is performed according to the coordinates of the congruent points of each group in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set. The rigid body transformation matrix corresponding to the congruent points of each group, including:
    根据公式:
    Figure PCTCN2020132199-appb-100003
    计算每组的全等点对应的刚体变换矩阵,在工程图坐标系中,所述交点e与所述四个孔a、b、c、d的夹角分别为A1、A2、A3、A4,在工件坐标系中,所述每组的全等点对应的第一虚拟交点和第二虚拟交点中的一个虚拟交点与所述所述每组的全等点的夹角分别为B1、B2、B3、 B4,
    Figure PCTCN2020132199-appb-100004
    为所述夹角A1与所述夹角B1之间的差值;Δx为所述交点e与所述一个虚拟交点x坐标的差值,Δy为所述交点e与所述一个虚拟交点y坐标的差值。
    According to the formula:
    Figure PCTCN2020132199-appb-100003
    Calculate the rigid body transformation matrix corresponding to the congruent points of each group. In the coordinate system of the engineering drawing, the angles between the intersection point e and the four holes a, b, c, and d are A1, A2, A3, and A4, respectively. In the workpiece coordinate system, the included angles between one of the first virtual intersection and the second virtual intersection corresponding to the congruent points of each group and the congruent points of each group are B1, B2, B3, B4,
    Figure PCTCN2020132199-appb-100004
    is the difference between the included angle A1 and the included angle B1; Δx is the difference between the intersection point e and the x-coordinate of the one virtual intersection point, and Δy is the y-coordinate of the intersection point e and the one virtual intersection point difference value.
  7. 根据权利要求1所述的孔集配准的方法,其中,根据所述第二工件坐标集合中每个孔的坐标以及工件上与所述每个孔对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果,包括:The method for hole set registration according to claim 1 , wherein, according to the coordinates of each hole in the second workpiece coordinate set and the coordinates of the nearest hole corresponding to the each hole on the workpiece, for each hole The rigid body transformation matrix is used for registration scoring, and the registration scoring results are obtained, including:
    根据每个刚体变换矩阵对应的所述第二工件坐标集合中每个孔的坐标,确定工件上与所述每个孔对应的最邻近的孔的坐标;According to the coordinates of each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix, determine the coordinates of the nearest hole corresponding to each hole on the workpiece;
    根据工件上与每个刚体变换矩阵对应的所述第二工件坐标集合中每个孔对应的最邻近的孔的坐标,确定所述第二工件坐标集合中所述每个孔的偏移量,组成所述每个刚体变换矩阵对应的偏移量集合;Determine the offset of each hole in the second workpiece coordinate set according to the coordinates of the nearest hole corresponding to each hole in the second workpiece coordinate set corresponding to each rigid body transformation matrix on the workpiece, forming an offset set corresponding to each rigid body transformation matrix;
    根据每个刚体变换矩阵对应的偏移量集合确定每个刚体变换矩阵的配准评分,获取配准评分结果。The registration score of each rigid body transformation matrix is determined according to the offset set corresponding to each rigid body transformation matrix, and the registration score result is obtained.
  8. 根据权利要求7所述的孔集配准的方法,其中,根据每个刚体变换矩阵对应的偏移量集合确定每个刚体变换矩阵的配准评分,获取配准评分结果,包括:The method for hole set registration according to claim 7, wherein determining the registration score of each rigid body transformation matrix according to the offset set corresponding to each rigid body transformation matrix, and obtaining the registration score result, comprising:
    计算每个刚体变换矩阵对应的所述偏移量集合中偏移量的标准差;Calculate the standard deviation of the offsets in the offset set corresponding to each rigid body transformation matrix;
    按照所述标准差由小到大的评分标准对每个刚体变换矩阵进行配准评分,获取配准评分结果。A registration score is performed on each rigid body transformation matrix according to the scoring standard with the standard deviation from small to large, and a registration score result is obtained.
  9. 根据权利要求7所述的孔集配准的方法,其中,根据每个刚体变换矩阵对应的偏移量集合确定每个刚体变换矩阵的配准评分,获取配准评分结果,包括:The method for hole set registration according to claim 7, wherein determining the registration score of each rigid body transformation matrix according to the offset set corresponding to each rigid body transformation matrix, and obtaining the registration score result, comprising:
    统计每个刚体变换矩阵对应的所述偏移量集合中,偏移量位于预设偏移量范围内的孔的数量;Counting the number of holes whose offsets are within the preset offset range in the offset set corresponding to each rigid body transformation matrix;
    按照位于预设偏移量范围内的孔的数量由大到小的评分标准,对每个刚体变换矩阵进行配准评分,获取配准评分结果。According to the scoring standard of the number of holes located in the preset offset range from large to small, the registration score is performed on each rigid body transformation matrix, and the registration score result is obtained.
  10. 一种孔集配准装置,包括:A hole set registration device, comprising:
    第一工程图坐标集合运算模块,设置为在工程图坐标系中,确定工程图中任意的四个孔的坐标,组成第一工程图坐标集合;其中,所述四个孔中,两个孔所在的直线与另外两个孔所在的直线相交;The first engineering drawing coordinate set operation module is set to determine the coordinates of any four holes in the engineering drawing in the engineering drawing coordinate system to form the first engineering drawing coordinate set; wherein, among the four holes, two holes The line where it is located intersects the line where the other two holes are located;
    第一工件坐标集合运算模块,设置为在工件坐标系中,确定工件上所有孔的坐标,组成第一工件坐标集合;The first workpiece coordinate set operation module is set to determine the coordinates of all holes on the workpiece in the workpiece coordinate system to form the first workpiece coordinate set;
    全等点集合运算模块,设置为根据所述第一工程图坐标集合以及所述第一 工件坐标集合,在所述工件坐标系中,确定与所述第一工程图坐标集合中所述四个孔的坐标对应的所有组的全等点,组成全等点集合;每组的全等点组成的图形形状与所述第一工程图坐标集合中的所述四个孔组成的图形形状相同;The congruent point set operation module is configured to, according to the first engineering drawing coordinate set and the first workpiece coordinate set, in the workpiece coordinate system, determine the coordinates of the four coordinates in the first engineering drawing coordinate set. The congruent points of all groups corresponding to the coordinates of the holes form a congruent point set; the shape of the graph composed of the congruent points of each group is the same as the graph shape composed of the four holes in the first engineering drawing coordinate set;
    全等点刚体变换矩阵集合运算模块,设置为根据所述全等点集合中每组的全等点的坐标以及所述第一工程图坐标集合中所述四个孔的坐标,计算每组的全等点对应的刚体变换矩阵,组成刚体变换矩阵集合;所述工程图坐标系中的坐标经所述刚体变换矩阵可转换至所述工件坐标系;The congruent rigid body transformation matrix set operation module is configured to calculate the congruent point coordinates of each group in the congruent point set and the coordinates of the four holes in the first engineering drawing coordinate set to calculate the The rigid body transformation matrix corresponding to the congruent point forms a rigid body transformation matrix set; the coordinates in the engineering drawing coordinate system can be converted to the workpiece coordinate system through the rigid body transformation matrix;
    评分模块,设置为选择所述工程图中任意的多个孔的坐标,组成第二工程图坐标集合,并将所述第二工程图坐标集合中的多个孔的坐标,通过所述刚体变换矩阵集合中的每个刚体变换矩阵转换至所述工件坐标系,形成第二工件坐标集合;根据所述第二工件坐标集合中每个孔的坐标以及工件上与所述每个孔对应的最邻近的孔的坐标,对每个刚体变换矩阵进行配准评分,获取配准评分结果;The scoring module is configured to select the coordinates of any plurality of holes in the engineering drawing to form a second engineering drawing coordinate set, and transform the coordinates of the plurality of holes in the second engineering drawing coordinate set through the rigid body transformation Each rigid body transformation matrix in the matrix set is converted to the workpiece coordinate system to form a second workpiece coordinate set; according to the coordinates of each hole in the second workpiece coordinate set and the maximum corresponding to each hole on the workpiece The coordinates of the adjacent holes, perform registration scoring for each rigid body transformation matrix, and obtain the registration scoring results;
    处理模块,设置为根据所述配准评分结果确定最优的刚体变换矩阵;并且获取所述工程图上的待配准的孔的坐标,并根据最优的刚体变换矩阵将待配准的孔的坐标,转换为所述工件坐标系的坐标以实现所述待配准的孔与所述工件上的孔的配准。The processing module is configured to determine the optimal rigid body transformation matrix according to the registration scoring result; and obtain the coordinates of the hole to be registered on the engineering drawing, and convert the hole to be registered according to the optimal rigid body transformation matrix The coordinates are converted into the coordinates of the workpiece coordinate system to realize the registration of the hole to be registered and the hole on the workpiece.
  11. 一种终端设备,包括:A terminal device including:
    至少一个处理器;at least one processor;
    存储装置,设置为存储至少一个程序;a storage device configured to store at least one program;
    当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1-9中任一所述的孔集配准的方法。When the at least one program is executed by the at least one processor, the at least one processor implements the method for hole set registration according to any one of claims 1-9.
  12. 一种计算机可读存储介质,存储有计算机程序,该程序被处理器执行时实现如权利要求1-9中任一所述的孔集配准的方法。A computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method for hole set registration according to any one of claims 1-9.
PCT/CN2020/132199 2020-07-01 2020-11-27 Hole set registration method, apparatus and device, and storage medium WO2022000973A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010628894.4 2020-07-01
CN202010628894.4A CN113962920A (en) 2020-07-01 2020-07-01 Method, device and equipment for automatically registering pore sets and storage medium

Publications (1)

Publication Number Publication Date
WO2022000973A1 true WO2022000973A1 (en) 2022-01-06

Family

ID=79317359

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/132199 WO2022000973A1 (en) 2020-07-01 2020-11-27 Hole set registration method, apparatus and device, and storage medium

Country Status (2)

Country Link
CN (1) CN113962920A (en)
WO (1) WO2022000973A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8615127B2 (en) * 2010-01-15 2013-12-24 Vanderbilt University System and method for point-based rigid registration with anisotropic weighting
CN106271052A (en) * 2016-09-22 2017-01-04 维嘉数控科技(苏州)有限公司 Laser processing and device
CN107610176A (en) * 2017-09-15 2018-01-19 斯坦德机器人(深圳)有限公司 A kind of pallet Dynamic Recognition based on Kinect and localization method, system and medium
CN108256170A (en) * 2017-12-26 2018-07-06 深圳市万相源科技有限公司 It is a kind of that the modeling optimization method and system for inserting technique are pasted based on pcb board
CN208780144U (en) * 2018-09-17 2019-04-23 苏州金迈驰航空智能科技有限公司 A kind of online vision detection system of connecting hole

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8615127B2 (en) * 2010-01-15 2013-12-24 Vanderbilt University System and method for point-based rigid registration with anisotropic weighting
CN106271052A (en) * 2016-09-22 2017-01-04 维嘉数控科技(苏州)有限公司 Laser processing and device
CN107610176A (en) * 2017-09-15 2018-01-19 斯坦德机器人(深圳)有限公司 A kind of pallet Dynamic Recognition based on Kinect and localization method, system and medium
CN108256170A (en) * 2017-12-26 2018-07-06 深圳市万相源科技有限公司 It is a kind of that the modeling optimization method and system for inserting technique are pasted based on pcb board
CN208780144U (en) * 2018-09-17 2019-04-23 苏州金迈驰航空智能科技有限公司 A kind of online vision detection system of connecting hole

Also Published As

Publication number Publication date
CN113962920A (en) 2022-01-21

Similar Documents

Publication Publication Date Title
CN109978925B (en) Robot pose recognition method and robot thereof
TWI394087B (en) Method and apparatus for tracking target object
CN110561423B (en) Pose transformation method, robot and storage medium
CN109741374B (en) Point cloud registration rotation transformation method, point cloud registration equipment and readable storage medium
CN112150551B (en) Object pose acquisition method and device and electronic equipment
CN111178250A (en) Object identification positioning method and device and terminal equipment
WO2020114320A1 (en) Point cloud clustering method, image processing device and apparatus having storage function
US20220254059A1 (en) Data Processing Method and Related Device
WO2021052283A1 (en) Method for processing three-dimensional point cloud data and computing device
WO2021103945A1 (en) Map fusion method, apparatus, device, and storage medium
US11875535B2 (en) Method, apparatus, electronic device and computer readable medium for calibrating external parameter of camera
WO2022247137A1 (en) Robot and charging pile recognition method and apparatus therefor
CN110465815B (en) Tooth form code identification method and device and terminal equipment
WO2022105569A1 (en) Page direction recognition method and apparatus, and device and computer-readable storage medium
CN113687629A (en) Circular arc straight line fitting method, system, equipment and storage medium for laser CAM processing
US11574414B2 (en) Edge-based three-dimensional tracking and registration method and apparatus for augmented reality, and storage medium
CN112767456A (en) Three-dimensional laser point cloud rapid relocation method
WO2022193640A1 (en) Robot calibration method and apparatus, and robot and storage medium
WO2022000973A1 (en) Hole set registration method, apparatus and device, and storage medium
WO2022205845A1 (en) Pose calibration method and apparatus, and robot and computer-readable storage medium
WO2020186894A1 (en) Box modeling method, apparatus, robot picking system, electronic device and medium
CN111080640A (en) Hole detection method, device, equipment and medium
CN113172636B (en) Automatic hand-eye calibration method and device and storage medium
US20230351787A1 (en) Hand-Drawn Graphic Recognition Method, Apparatus and System, and Computer-Readable Storage Medium
WO2023124233A1 (en) Circle searching method and apparatus, electronic device and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20943443

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20943443

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20943443

Country of ref document: EP

Kind code of ref document: A1