Automatic sorting method of calibration plate pixel coordinates and world coordinates and industrial camera

By proposing an automatic sorting method for calibration plate pixel coordinates and world coordinates in industrial cameras, the problem of difficulty in matching feature points during calibration process is solved, and an efficient and accurate calibration process is realized, which is suitable for a variety of calibration plates and complex field environments.

CN119762547APending Publication Date: 2025-04-04SHENZHEN ZMOTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411653607.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

During the calibration process of industrial cameras, the calibration boards are placed in a variety of places and the on-site environment is complex, which makes it difficult to match the pixel coordinates of feature points with the world coordinates, and the lack of feature points affects the accuracy of sorting.

Method used

A method for automatic sorting of pixel coordinates and world coordinates of calibration plates is proposed. By obtaining multiple feature points in the calibration tool, a pixel coordinate system and world coordinate system are constructed, predicted points and matched feature points, and automatic sorting of feature points is realized.

Benefits of technology

It significantly improves the accuracy and robustness of feature point matching, effectively deals with the problems of missing feature point and unfixed placement of calibration plates, and improves the efficiency and accuracy of calibration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762547A_ABST
    Figure CN119762547A_ABST
Patent Text Reader

Abstract

The present invention discloses a calibration plate pixel coordinate and world coordinate automatic sorting method and industrial camera, which relates to the technical field of industrial cameras, including obtaining multiple feature points in a calibration tool, and formulating a pixel coordinate system, determining multiple first prediction points on a first axis in the pixel coordinate system according to the multiple feature points and the pixel coordinate system, and recording the first feature points that meet the preset matching conditions with each first prediction point; determining a feature straight line passing through each first feature point and parallel to the second axis according to the first feature point; determining multiple second prediction points on each feature straight line according to the multiple feature points and each feature straight line, and recording the second feature points matching each second prediction point and the world coordinate points corresponding to the second feature points; and completing the sorting of the second feature points and the world coordinate points according to the world coordinate points corresponding to the second feature points. In this way, the success rate of matching pixel coordinates with world coordinates can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial cameras, and in particular to an automatic sorting method of calibration plate pixel coordinates and world coordinates and an industrial camera. Background Art

[0002] Machine vision technology has significantly improved the convenience and accuracy of product size measurement, among which the calibration of industrial cameras is a key link. Among them, checkerboard or circular calibration plates are often used in industry to calibrate camera parameters. The feature points on the calibration plate are arranged in a regular pattern and have clear row and column coordinate information. However, in the actual calibration process, the placement of the calibration plate may vary, including upright or tilted, which causes the extracted feature point row and column coordinate information to become disordered. In addition, complex on-site environments may cause some feature points to be missing, further affecting the accuracy of feature point sorting.

[0003] At present, some measurement systems manually match the pixel coordinates of feature points with the world coordinates, which increases the complexity of the operation when matching the pixel coordinates with the world coordinates, or reduces the success rate of automatic matching of the pixel coordinates with the world coordinates when feature points are missing. Summary of the invention

[0004] The main purpose of the present invention is to propose a method for automatically sorting the pixel coordinates of a calibration plate and the world coordinates and an industrial camera, aiming to improve the success rate of matching the pixel coordinates with the world coordinates by realizing automatic sorting of the pixel coordinates and the world coordinates.

[0005] To achieve the above purpose, the present invention proposes a method for automatically sorting the calibration plate pixel coordinates and world coordinates, comprising:

[0006] Acquire a plurality of feature points in the calibration tool, and formulate a pixel coordinate system according to the plurality of feature points, wherein the pixel coordinate system includes a first axis and a second axis, and the plurality of feature points include a first feature point and a second feature point;

[0007] Determine, according to the plurality of feature points and the pixel coordinate system, a plurality of first prediction points on a first axis in the pixel coordinate system, and record a first feature point that satisfies a preset matching condition with each of the first prediction points;

[0008] Determine, based on the first characteristic points, a characteristic straight line passing through each of the first characteristic points and parallel to the second axis;

[0009] Determine, according to the plurality of feature points and each of the feature lines, each of the plurality of fifth feature points that meets a preset condition, fit into a straight line according to each of the plurality of fifth feature points and refine each of the feature lines, determine, according to each of the plurality of fifth feature points and each of the feature lines, a plurality of second prediction points on each of the feature lines, record a second feature point that matches each of the second prediction points, and record a world coordinate point corresponding to the second feature point;

[0010] According to the world coordinate point corresponding to the second feature point, the second feature point and the world coordinate point are sorted.

[0011] In one embodiment, the method of acquiring a plurality of feature points in the calibration tool and determining a pixel coordinate system according to the plurality of feature points specifically includes:

[0012] Determine a first coordinate system according to any three of the plurality of feature points;

[0013] Determine, based on the plurality of feature points and the first axis of the first coordinate system, a plurality of third feature points whose distance errors from the first axis of the first coordinate system are less than a first preset error, and fit the plurality of third feature points into the first axis of the pixel coordinate system, wherein the first preset error is equal to the distance between the coordinate point in the first axis of the first coordinate system and the origin of the first coordinate system multiplied by a preset distance error coefficient;

[0014] Based on the multiple feature points and the second axis of the first coordinate system, multiple fourth feature points whose distance errors with the second axis of the first coordinate system are less than a second preset error are determined, and the multiple fourth feature points are fitted into the second axis of the pixel coordinate system, and the second preset error is equal to the distance between the coordinate point in the second axis of the first coordinate system and the origin of the first coordinate system multiplied by a preset distance error coefficient.

[0015] In one embodiment, the method of determining a plurality of first prediction points on a first axis in the pixel coordinate system according to the plurality of feature points and the pixel coordinate system specifically includes:

[0016] Initialize a first distance parameter, a first iteration number, and a first direction parameter, wherein the first distance parameter is the distance between the first prediction point and the origin of the pixel coordinate system, the first iteration number is the number of iterations for generating the first prediction point on the first axis of the pixel coordinate system, and the first direction parameter is the direction parameter of the first prediction point;

[0017] Taking the origin of the pixel coordinate system as a starting point, generating a corresponding first prediction point on the first axis according to the product of the first distance parameter and the first direction vector;

[0018] Taking the origin of the first axis of the pixel coordinate system as the starting point, and heading in the direction represented by the first direction parameter, determining a first feature point among the plurality of third feature points that satisfies a preset matching condition with the first prediction point, wherein the preset matching condition is that a distance error between the feature point and the prediction point is less than a third preset error;

[0019] When it is determined that there is a first feature point that satisfies a preset matching condition with the first prediction point, updating a first distance parameter of a next first prediction point, and removing the matched first feature point from the plurality of third feature points;

[0020] When it is determined that there is no first feature point that meets the preset matching condition with the first prediction point, determine whether the first prediction point is within the first preset limit range, and if so, update the first distance parameter and the first iteration number of the next first prediction point; if not, change the first direction parameter, reinitialize the first distance parameter and the first iteration number, and return to repeatedly execute the steps of taking the origin of the pixel coordinate system as the starting point, generating the corresponding first prediction point on the first axis according to the product of the first distance parameter and the first direction vector; taking the origin of the first axis of the pixel coordinate system as the starting point, and heading in the direction represented by the first direction parameter, determining the first feature point that meets the preset matching condition with the first prediction point.

[0021] In one embodiment, when it is determined that there is a first feature point that satisfies a preset matching condition with the first prediction point, the first distance parameter of the next first prediction point after update is equal to the distance between the previous first feature point and the origin of the pixel coordinate system plus the first direction parameter multiplied by the first direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current first iteration number;

[0022] When it is determined that there is no first feature point that satisfies the preset matching condition with the first prediction point, the first distance parameter of the next first prediction point after update is equal to the first distance parameter of the previous first prediction point plus the first direction parameter multiplied by the first direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current first iteration number; and

[0023] The updated first iteration number is equal to the current first iteration number plus 1.

[0024] In one embodiment, taking the origin of the first axis of the pixel coordinate system as the starting point and heading in the direction represented by the first direction parameter, determining the first feature point that satisfies the preset matching condition with the first prediction point specifically includes:

[0025] Finding a candidate feature point whose distance error with the first prediction point is less than a third preset error from the plurality of third feature points;

[0026] Among the candidate feature points, a candidate feature point having the smallest distance to the first prediction point is selected as the first feature point, and matched with the first prediction point.

[0027] In one embodiment, the method for calculating the scaling factor includes:

[0028] Acquire a projection point set of a plurality of the third characteristic points on the first axis;

[0029] Performing an inner product operation on a vector formed by the projection point set and the origin of the pixel coordinate system and a unit vector corresponding to a first direction of the first axis, and sorting the projection point set from small to large according to the inner product;

[0030] Sort the third feature points from small to large according to the inner product;

[0031] Calculate the pixel distance between two adjacent projection points in the projection point set in sequence;

[0032] Calculating the ratio of the distances between two adjacent pixels as the scaling factor;

[0033] The calculation method of the scaling factor includes:

[0034] The ratios of all the distances between two adjacent pixels are counted, the ratios that meet the preset conditions are selected for statistics, and the average value of the ratios that meet the preset conditions is calculated as the final scaling factor.

[0035] In one embodiment, the method of determining each of the plurality of fifth feature points that meet a preset condition according to the plurality of feature points and each of the feature lines, fitting a straight line according to each of the plurality of fifth feature points and refining each of the feature lines, determining a plurality of second prediction points on each of the feature lines according to each of the plurality of fifth feature points and each of the feature lines, and recording a second feature point that matches each of the second prediction points, and recording a world coordinate point corresponding to the second feature point includes:

[0036] Initialize a second distance parameter, a second number of iterations, and a second direction parameter, wherein the second distance parameter is the distance between the second prediction point and the first feature point, the second number of iterations is the number of iterations for generating the second prediction point on the feature line, and the second direction parameter is the direction parameter of the second prediction point;

[0037] Taking the intersection of the characteristic straight line and the first axis as the starting point, generating a corresponding second prediction point on the characteristic straight line according to the product of the second distance parameter and the second direction vector;

[0038] Taking the intersection of the characteristic straight line and the first axis as the starting point, and heading in the direction represented by the second direction parameter, determining a second characteristic point among the plurality of fifth characteristic points that satisfies a preset matching condition with the second predicted point, wherein the preset matching condition is that a distance error between the characteristic point and the predicted point is less than a fourth preset error;

[0039] When it is determined that there is a second feature point that satisfies a preset matching condition with the second prediction point, the second feature point is recorded, and the world coordinate point corresponding to the second feature point is recorded, and a second distance parameter of a next second prediction point is updated, and the matched second feature point is removed from the plurality of fifth feature points;

[0040] When it is determined that there is no second feature point that satisfies the preset matching condition with the second prediction point, determining whether the second prediction point is within a second preset limit range, and if so, updating the second distance parameter and the second iteration number of the next second prediction point; if not, changing the second direction parameter, and reinitializing the second distance parameter and the second iteration number, and returning to repeatedly execute the intersection of the feature straight line and the first axis as the starting point, and generating a corresponding second prediction point on the feature straight line according to the product of the second distance parameter and the second direction vector;

[0041] The step of taking the intersection of the characteristic straight line and the first axis as the starting point and heading in the direction represented by the second direction parameter to determine a second characteristic point among the plurality of fifth characteristic points that satisfies a preset matching condition with the second predicted point.

[0042] In one embodiment, when it is determined that there is a second feature point and the second predicted point that meet the preset matching condition, the second distance parameter of the next second predicted point after update is equal to the distance between the previous second feature point and the intersection of the feature straight line and the first axis plus the second direction parameter multiplied by the second direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current second iteration number;

[0043] When it is determined that there is no first feature point that satisfies the preset matching condition with the second prediction point, the second distance parameter of the next second prediction point after update is equal to the second distance parameter of the previous second prediction point plus the second direction parameter multiplied by the second direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current second iteration number; and

[0044] The updated second iteration number is equal to the current second iteration number plus 1.

[0045] In one embodiment, the method for completing the sorting of the second feature point and the world coordinate point according to the world coordinate point corresponding to the second feature point includes:

[0046] Initialize the origin and unit length of the world coordinate system, where the origin is the world coordinate corresponding to the origin of the pixel coordinate system, and the unit length is a preset world spacing;

[0047] Determine a first axis of a world coordinate system according to the first axis of the pixel coordinate system;

[0048] Determining a second axis of a world coordinate system according to the second axis of the pixel coordinate system;

[0049] According to the world coordinate point corresponding to the second feature point, the second feature point and the world coordinate point are automatically sorted by a first sorting logic, wherein the first sorting logic includes from the first axis to the second axis.

[0050] The present invention further provides an industrial camera, comprising a controller, wherein the controller is used to implement the method for automatically sorting pixel coordinates of a calibration plate and world coordinates as described in any one of the above items.

[0051] The method for automatically sorting the pixel coordinates and world coordinates of the calibration plate provided by the present invention significantly improves the accuracy and robustness of feature point matching. First, multiple feature points in the calibration tool are obtained by image processing technology and a pixel coordinate system and a world coordinate system are constructed, which provides a basic reference for subsequent steps. Then, the system generates multiple first prediction points on the first axis, and selects the first feature points matching the prediction points by preset matching conditions. This step reduces the influence of disordered feature points and improves the accuracy of feature point matching. Subsequently, the system generates a feature straight line passing through the first feature point and parallel to the second axis, ensuring that the generation of the feature straight line has high accuracy and consistency, further enhancing the robustness of subsequent steps. Subsequently, the system generates multiple second prediction points on each feature straight line, and selects the second feature points matching the prediction points by preset matching conditions, further reducing the influence of disordered feature points and improving the accuracy of feature point matching. Finally, the system completes the sorting of the second feature points in a manner that the world coordinates are sorted by the first axis first and then the second axis according to the determination of the second feature point and the corresponding world coordinates generated simultaneously with the second feature point. In this way, the present invention not only realizes automatic sorting and matching, but also effectively addresses the problems of missing feature points and unstable placement of calibration plates, significantly improving the efficiency and accuracy of calibration. It is suitable for a variety of calibration plates and complex field environments, and has wide applicability and high accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0053] Figure 1 A flow chart of a first embodiment of a method for automatically sorting calibration plate pixel coordinates and world coordinates provided by the present invention;

[0054] Figure 2 A flow chart of a second embodiment of the method for automatically sorting the calibration plate pixel coordinates and world coordinates provided by the present invention;

[0055] Figure 3 A flowchart of a third embodiment of the method for automatically sorting the calibration plate pixel coordinates and world coordinates provided by the present invention;

[0056] Figure 4 A flowchart of a fourth embodiment of the method for automatically sorting the calibration plate pixel coordinates and world coordinates provided by the present invention;

[0057] Figure 5 A flowchart of a fifth embodiment of the method for automatically sorting the calibration plate pixel coordinates and the world coordinates provided by the present invention;

[0058] Figure 6 A flowchart of a sixth embodiment of the method for automatically sorting the calibration plate pixel coordinates and world coordinates provided by the present invention;

[0059] Figure 7 A flowchart of a seventh embodiment of the method for automatically sorting the calibration plate pixel coordinates and the world coordinates provided by the present invention;

[0060] Figure 8 A first schematic diagram of an embodiment of a method for converting pixel coordinates to world coordinates provided by the present invention;

[0061] Fig. 9 A second schematic diagram of an embodiment of a method for converting pixel coordinates to world coordinates provided by the present invention;

[0062] Fig.10 A third schematic diagram of an embodiment of a method for converting pixel coordinates to world coordinates provided by the present invention;

[0063] Fig.11 A fourth schematic diagram of an embodiment of a method for converting pixel coordinates to world coordinates provided by the present invention;

[0064] Fig.12This is a fifth schematic diagram of an embodiment of a method for converting pixel coordinates to world coordinates provided by the present invention.

[0065] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0066] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0067] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture. If the specific posture changes, the directional indication will also change accordingly.

[0068] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features limited to "first" and "second" may explicitly or implicitly include at least one of the features. In addition, if "and / or" or "and / or" appears in the full text, its meaning includes three parallel solutions. Taking "A and / or B" as an example, it includes solution A, solution B, or solutions that satisfy both A and B. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the ability of ordinary technicians in this field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0069] It should be noted that, in this article, step codes such as S100, S200, etc. are used for the purpose of expressing the corresponding content more clearly and concisely, and do not constitute a substantial limitation on the sequence. When implementing the step, those skilled in the art may execute S200 first and then S100, etc., but these should all be within the scope of protection of this application.

[0070] Machine vision technology has significantly improved the convenience and accuracy of product size measurement, among which the calibration of industrial cameras is a key link. Among them, checkerboard or circular calibration plates are often used in industry to calibrate camera parameters. The feature points on the calibration plate are arranged in a regular pattern and have clear row and column coordinate information. However, in the actual calibration process, the placement of the calibration plate may vary, including upright or tilted, which causes the extracted feature point row and column coordinate information to become disordered. In addition, complex on-site environments may cause some feature points to be missing, further affecting the accuracy of feature point sorting.

[0071] At present, some measurement systems manually match the pixel coordinates of feature points with the world coordinates, which increases the complexity of the operation when matching the pixel coordinates with the world coordinates, or reduces the success rate of automatic matching of the pixel coordinates with the world coordinates when feature points are missing.

[0072] In order to improve the success rate of matching pixel coordinates with world coordinates by realizing automatic sorting of pixel coordinates and world coordinates. Figure 1 As shown, the method for automatically sorting the calibration plate pixel coordinates and the world coordinates proposed by the present invention may include steps S100 to S500.

[0073] In this embodiment, step S100, a plurality of feature points in the calibration tool are obtained, and a pixel coordinate system is proposed according to the plurality of feature points, the pixel coordinate system includes a first axis and a second axis, and the plurality of feature points include a first feature point and a second feature point.

[0074] It can be understood that in this step, the system detects and obtains multiple feature points in the calibration tool (such as a chessboard or a circular calibration plate) through image processing technology, and the multiple feature points have clear pixel coordinates in the image. Then, any three feature points are selected from the multiple feature points to construct a preliminary pixel coordinate system. This coordinate system includes two axes: a first axis (which can correspond to the y-axis of the image) and a second axis (which can correspond to the x-axis of the image). By selecting appropriate feature points, it can be ensured that the establishment of the coordinate system has a certain degree of accuracy and robustness. In this way, a basic reference is provided for subsequent steps to ensure the accuracy of subsequent processing.

[0075] In this embodiment, step S200 determines a plurality of first prediction points on a first axis in the pixel coordinate system according to the plurality of feature points and the pixel coordinate system, and records a first feature point that satisfies a preset matching condition with each of the first prediction points.

[0076] It can be understood that in this step, the system generates multiple first prediction points on the first axis according to the pixel coordinate system and multiple feature points. The first prediction points are used to match the actual feature points. By setting preset matching conditions (such as the distance error is less than the preset threshold and the distance is the smallest), the first feature points that match the prediction points in the multiple feature points can be effectively screened out. In this way, it helps to reduce the impact of disordered feature points and improve the accuracy of feature point matching.

[0077] In this embodiment, step S300 , based on the first feature points, a feature straight line passing through each of the first feature points and parallel to the second axis is determined.

[0078] It is understandable that in this step, the system generates a plurality of characteristic straight lines parallel to the second axis according to the first characteristic point. These characteristic straight lines are used for subsequent second prediction point generation and matching. In this way, it is possible to ensure that the generation of characteristic straight lines has high accuracy and consistency, thereby improving the robustness of subsequent steps.

[0079] In this embodiment, step S400, based on the multiple feature points and each feature straight line, determines each of the multiple fifth feature points that meet the preset conditions, fits into a straight line based on each of the multiple fifth feature points and refines each of the feature straight lines, determines multiple second prediction points on each of the feature straight lines based on each of the multiple fifth feature points and each of the feature straight lines, records the second feature points that match each of the second prediction points, and records the world coordinate points corresponding to the second feature points.

[0080] It can be understood that in this step, the system generates multiple second predicted points on each feature line based on the feature line and multiple fifth feature points. These predicted points are used to match the actual second feature points. By setting the preset matching conditions, the second feature points that match the second predicted points in the multiple fifth feature points can be effectively screened out. In this way, it helps to further reduce the impact of disordered feature points and improve the accuracy of feature point matching. While recording the second feature point, the world coordinate point corresponding to the second feature point can be recorded, so that the subsequent automatic sorting work can be realized.

[0081] In addition, the preset condition may be less than a preset distance. Specifically, it is necessary to find a feature point among multiple feature points that has a corresponding feature line less than the preset distance, that is, to determine it as the fifth feature point. In this embodiment, the refinement operation is performed on all feature lines. In this way, the subsequent alignment steps can be more accurate.

[0082] In this embodiment, step S500, the second feature points and the world coordinate points are sorted according to the world coordinate points corresponding to the second feature points.

[0083] It can be understood that there is no substantial difference between the first feature point and the second feature point, and they are only used to distinguish a plurality of feature points.

[0084] In summary, through the automatic sorting method of the calibration plate pixel coordinates and world coordinates in steps S100 to S500, the present invention significantly improves the accuracy and robustness of feature point matching. First, in step S100, multiple feature points in the calibration tool are obtained by image processing technology and a pixel coordinate system and a world coordinate system are constructed, which provides a basic reference for subsequent steps. Then, in step S200, the system generates multiple first prediction points on the first axis, and selects the first feature points matching the prediction points through preset matching conditions. This step reduces the influence of disordered feature points and improves the accuracy of feature point matching. Subsequently, in step S300, the system generates a feature straight line passing through the first feature point and parallel to the second axis, ensuring that the generation of the feature straight line has high accuracy and consistency, and further enhancing the robustness of subsequent steps. In step S400, the system generates multiple second prediction points on each refined feature straight line, and selects the second feature points matching the prediction points through preset matching conditions. This step further reduces the influence of disordered feature points and improves the accuracy of feature point matching. Finally, the system completes the sorting of the second feature points according to the second feature points and the corresponding world coordinates generated at the same time as the second feature points, with the world coordinates sorting the second axis first and the first axis second. In this way, the present invention not only realizes automatic sorting and matching, but also effectively addresses the problems of missing feature points and unstable placement of calibration plates, significantly improves the efficiency and accuracy of calibration, is applicable to a variety of calibration plates and complex field environments, and has wide applicability and high accuracy.

[0085] In one embodiment, if Figure 2 As shown, step S100 may include steps S110 to S130.

[0086] In this embodiment, step S110 , a first coordinate system is determined according to any three of the plurality of feature points.

[0087] It is understandable that in this step, any three feature points are selected from a plurality of feature points, and a preliminary first coordinate system is determined using these three feature points. These three feature points can be used to define the origin of the coordinate system and the directions of the two axes. Specifically, one of the feature points can be selected as the origin, and the other two feature points define the directions of the first axis (e.g., the y-axis) and the second axis (e.g., the x-axis), respectively. It should be explained that by selecting three feature points to preliminarily determine the coordinate system, a basic reference frame can be quickly established, providing a basis for subsequent precise positioning and calibration.

[0088] In this embodiment, step S120, based on the multiple feature points and the first axis of the first coordinate system, determine a plurality of third feature points whose distance errors with the first axis of the first coordinate system are less than a first preset error, and fit the plurality of third feature points into the first axis of the pixel coordinate system, wherein the first preset error is equal to the distance between the coordinate point in the first axis of the first coordinate system and the origin of the first coordinate system multiplied by a preset distance error coefficient.

[0089] It can be understood that in this step, feature points whose distance errors from the first axis of the first coordinate system are less than the first preset error are selected from the plurality of feature points, and these feature points are referred to as third feature points. Then, these third feature points are fitted into the first axis of the final pixel coordinate system. In this way, by selecting and fitting the third feature points, it is possible to ensure that the generation of the first axis is more accurate and robust, reduce the error caused by the inaccurate initial coordinate system, and improve the reliability of subsequent steps.

[0090] It should be explained that the first preset error is equal to the distance between the coordinate point of the first axis in the first coordinate system and the origin of the first coordinate system multiplied by a preset distance error coefficient, wherein the specific value of the distance error coefficient depends on the actual situation. In one example, the distance error coefficient is 0.4.

[0091] In this embodiment, step S130, based on the multiple feature points and the second axis of the first coordinate system, determine a plurality of fourth feature points whose distance errors with the second axis of the first coordinate system are less than a second preset error, and fit the plurality of fourth feature points into the second axis of the pixel coordinate system, wherein the second preset error is equal to the distance between the coordinate point in the second axis of the first coordinate system and the origin of the first coordinate system multiplied by a preset distance error coefficient.

[0092] It can be understood that in this step, feature points whose distance errors with the second axis of the first coordinate system are less than the first preset error are screened out from multiple feature points. These feature points are called fourth feature points. Then, these fourth feature points are fitted into the second axis of the final pixel coordinate system.

[0093] It should be explained that the third feature point and the fourth feature point are also feature points selected from multiple feature points. The third feature point is used to express the feature points of the first axis of the pixel coordinate system, and the fourth feature point is used to express the feature points of the second axis of the pixel coordinate system.

[0094] It should be explained that the second preset error is equal to the distance between the coordinate point of the second axis in the first coordinate system and the origin of the first coordinate system multiplied by a preset distance error coefficient, wherein the specific value of the distance error coefficient depends on the actual situation. In one example, the distance error coefficient is 0.4.

[0095] Further, such as Figure 8 As shown in FIG. 1 , a partial display of a calibration tool is given, and the partial display has multiple feature points. Figure 8 Many feature points in the image are missing (white dots in the figure) and tilted, which will affect the success rate of feature point sorting. Figure 8 Select three points from the part shown by the dotted line, and finally Fig. 9 As shown, the first coordinate system is formed by fitting these three points.

[0096] Thus, through steps S110 to S130, the present invention can establish a more accurate pixel coordinate system, ensure that the axis of the coordinate system is more accurate, reduce the error of the initial coordinate system, and thus improve the accuracy of the entire calibration process. On the other hand, even in the case of uneven distribution of feature points or partial missing feature points, a reliable coordinate system can still be generated by screening and fitting feature points, thereby improving the robustness of the system.

[0097] In one embodiment, if Figure 3 As shown, step S200 may specifically include steps S210 to S250.

[0098] It should be explained that, in this embodiment, the first axis is the y-axis, and the second axis is the x-axis; in other embodiments, the first axis may be the x-axis, and the second axis may be the y-axis.

[0099] In this embodiment, step S210 initializes a first distance parameter, a first iteration number and a first direction parameter, wherein the first distance parameter is the distance between the first prediction point and the origin of the pixel coordinate system, the first iteration number is the number of generation iterations of the first prediction point on the first axis of the pixel coordinate system, and the first direction parameter is the direction parameter of the first prediction point.

[0100] It can be understood that in this step, the first distance parameter, the first number of iterations, and the first direction parameter required for generating the first prediction point are initialized. The initial value of the first distance parameter is 0, the initial value of the first number of iterations is 0, and the initial value of the first direction parameter is 1, where 1 represents a square and -1 represents a negative direction. In this way, by initializing these parameters, a clear starting point and direction are provided for subsequent prediction point generation and feature point matching, ensuring the orderliness and repeatability of the algorithm.

[0101] In this embodiment, step S220 takes the origin of the pixel coordinate system as the starting point and generates a corresponding first prediction point on the first axis according to the product of the first distance parameter and the first direction vector.

[0102] It can be understood that in this step, starting from the origin of the pixel coordinate system, the first predicted point on the first axis is generated according to the product of the first distance parameter and the first direction vector. Specifically, the coordinates of the predicted point can be obtained by the formula:

[0103] ypt.x=originc.x+predictLeny*uintVecy.x;

[0104] ypt.y=originc.y+predictLeny*uintVecy.y;

[0105] Calculation, where ypt represents the coordinates of the first predicted point generated, ypt.x and ypt.y represent the coordinates of the first predicted point on the x-axis and y-axis respectively; originc represents the coordinates of the origin of the pixel coordinate system, originc.x and originc.y represent the coordinates of the origin on the x-axis and y-axis respectively; predictLeny represents the distance between the first predicted point and the origin of the pixel coordinate system; uintVecy represents the unit vector of the first axis (for example, the y-axis), and uintVecy.x and uintVecy.y represent the components of the unit vector on the x-axis and y-axis respectively.

[0106] In this embodiment, step S230, taking the origin of the first axis of the pixel coordinate system as the starting point, and heading in the direction represented by the first direction parameter, determines the first feature point among the multiple third feature points that meets the preset matching condition with the first prediction point, and the preset matching condition is that the distance error between the feature point and the prediction point is less than the third preset error.

[0107] It is understandable that in this step, feature points whose distance error with the first prediction point is less than the second preset error are selected from the plurality of third feature points. In this way, by setting the preset matching condition, it is ensured that the distance error between the selected feature points and the prediction point is within an acceptable range, thereby improving the accuracy of feature point matching.

[0108] It should be explained that the third preset error T dy =S y *d by *disCoef, where S y represents the scaling factor of the first axis, d by Indicates the reference distance of the corresponding feature point (for details, please refer to Fig. 9 As shown), disCoef represents the distance error coefficient.

[0109] In this embodiment, in step S240, when it is determined that there is a first feature point that satisfies a preset matching condition with the first prediction point, the first distance parameter of the next first prediction point is updated, and the matched first feature point is removed from the plurality of third feature points.

[0110] It can be understood that in this step, if the first feature point that meets the preset matching conditions is found, the distance parameter of the first prediction point is updated. By updating the distance parameter and removing the matched first feature point, the generation of the next prediction point is ensured to be more accurate, repeated matching is avoided, and the efficiency and accuracy of the algorithm are improved.

[0111] In this embodiment, in step S250, when it is determined that there is no first feature point that satisfies the preset matching condition with the first prediction point, it is determined whether the first prediction point is within the first preset limit range, and if so, the first distance parameter and the first iteration number of the next first prediction point are updated; if not, the first direction parameter is changed, and the first distance parameter and the first iteration number are reinitialized, and the step of returning to repeatedly execute the steps of taking the origin of the pixel coordinate system as the starting point, and generating the corresponding first prediction point on the first axis according to the product of the first distance parameter and the first direction vector; and taking the origin of the first axis of the pixel coordinate system as the starting point, and heading in the direction represented by the first direction parameter, determining the first feature point that satisfies the preset matching condition with the first prediction point.

[0112] It can be understood that in this step, if the first feature point that meets the preset matching condition is not found, it is determined whether the first prediction point is within the preset limit range. If it is within the range, the distance parameter and the number of iterations of the first prediction point are updated; if it is not within the range, the direction parameter is changed, and the distance parameter and the number of iterations are reinitialized, and the steps of generating the first prediction point and matching feature points are returned to be repeated, that is, the steps S220 and S230 are returned to be repeated. In this way, the situation where the prediction point is not within the preset limit range is handled in this way, which ensures that the algorithm can continue to generate new prediction points until all matching feature points are found, thereby improving the robustness and reliability of the algorithm.

[0113] It should be noted that the preset limit range is determined according to the actual situation. In practice, if there are many feature points, it can be set smaller. If there are fewer feature points, it needs to be set larger.

[0114] Through steps S210 to S250, the present invention can generate a more accurate pixel coordinate system, and by gradually generating prediction points and matching feature points, it ensures that the feature points on the first axis are matched more accurately, reduces the accumulation of initial errors, and improves the accuracy of the entire coordinate system.

[0115] In one embodiment, when it is determined that there is a first feature point that satisfies a preset matching condition with the first prediction point, the first distance parameter of the next first prediction point after update is equal to the distance between the previous first feature point and the origin of the pixel coordinate system plus the first direction parameter multiplied by the first direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current first iteration number; when it is determined that there is no first feature point that satisfies the preset matching condition with the first prediction point, the first distance parameter of the next first prediction point after update is equal to the first distance parameter of the previous first prediction point plus the first direction parameter multiplied by the first direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current first iteration number; and the updated first iteration number is equal to the current first iteration number plus 1. In this way, by dynamically updating the distance parameter and the iteration number, it is ensured that the generation of the prediction point is more accurate, the accumulation of initial errors is reduced, and the accuracy of the entire coordinate system is improved.

[0116] In one embodiment, if Figure 4 As shown, step S220 may specifically include steps S221 to S223.

[0117] In this embodiment, step S221, the distance between the first prediction point and the origin of the pixel coordinate system is calculated. It can be understood that by calculating the distance, the position of the prediction point in the coordinate system can be determined, providing a clear reference point for subsequent feature point matching.

[0118] In this embodiment, step S222, a candidate feature point whose distance error with the first prediction point is less than a third preset error is found from the plurality of third feature points. It can be understood that by setting the preset matching condition, it is ensured that the distance error between the selected candidate feature point and the prediction point is within an acceptable range, thereby improving the accuracy of feature point matching.

[0119] In this embodiment, step S223 , among the candidate feature points, a candidate feature point with the shortest distance from the first prediction point is selected as the first feature point, and matched with the first prediction point.

[0120] It can be understood that, in this way, by selecting the candidate feature point with the smallest distance, it is ensured that the error between the matched feature point and the predicted point is minimized, and the accuracy and reliability of feature point matching are further improved.

[0121] Through steps S221 to S223, the candidate feature point with the smallest distance is selected, which ensures that the error between the matched feature point and the predicted point is minimized, further improving the matching accuracy.

[0122] In one embodiment, the method for calculating the scaling factor of the first axis includes: obtaining a projection point set of multiple third feature points on the first axis; performing an inner product operation on a vector formed by the projection point set and the origin of the pixel coordinate system and a unit vector corresponding to the first direction of the first axis, and sorting the inner product results of the multiple inner product operations from small to large (such as Fig.10 As shown, the framed part is the first axis, and the numbers therein are sorted from small to large); multiple third feature points are sorted from small to large according to the above inner product; the pixel spacing between two adjacent projection points in the projection point set is calculated in turn; the ratio of the two adjacent pixel spacings is calculated as the scaling factor.

[0123] In this embodiment, the first direction of the first axis is the positive direction of the y-axis.

[0124] It can be understood that the purpose of sorting the third feature point and its projection point is to arrange the third feature point and its projection point in order from the negative direction to the positive direction of the y-axis, and the purpose of sorting is to calculate the scaling factor of the distance between adjacent feature points. The distance between two adjacent points in the projection point set, i.e., the pixel spacing, is calculated in sequence, and then the ratio of the latter pixel spacing to the previous pixel spacing is calculated as the pixel spacing scaling factor.

[0125] In this embodiment, the scaling factor calculation method includes: counting the ratios of all the distances between two adjacent pixels, selecting the ratios that meet the preset conditions for statistics, and calculating the average value of the ratios that meet the preset conditions as the final scaling factor.

[0126] It is understandable that, usually when the image has no perspective distortion or no radial distortion, the scaling factor = 1, but when there is distortion, the scaling factor is greater than 1 or less than 1, and if there is a missing pixel, the scaling factor will usually be greater than or equal to 2 or less than or equal to 0.5. If there is severe perspective distortion, the scaling factor may be less than 2 or greater than 0.5. Therefore, in order to count the scaling factors of the adjacent pixel spacing of normal feature points more accurately, the present invention selects scaling factors that meet the conditions of 0.7 less than or equal to the scaling factor less than or equal to 1.3 for statistics and calculates their mean. In this way, by counting the ratios that meet the preset conditions and calculating their average values, it is ensured that the scaling factor is more reasonable and stable, and the robustness of the system is improved. This method is not only applicable to a variety of calibration plates and complex field environments, but can also effectively deal with the situation of uneven distribution of feature points and missing of some feature points, ensuring the reliability and consistency of the calibration results.

[0127] In addition, due to the perspective or radial distortion of the calibration plate, the scaling factor is usually greater than 1 or less than 1, that is, the pixel spacing is gradually increasing or decreasing. The predicted points calculated using the scaling factor will be more accurate, making it more accurate to find the same feature points as the predicted points from multiple feature points.

[0128] In one embodiment, if Figure 5 As shown, step S400 may include steps S410 to S450. It can be understood that steps S410 to S450 correspond to steps S210 to S250, and steps S210 to S250 are to generate a first predicted point on a first axis and match the first predicted point with a first feature point; while steps S410 to S450 are to generate a second predicted point on a plurality of feature lines and match the second predicted point with a second feature point.

[0129] In this embodiment, step S410 initializes a second distance parameter, a second number of iterations, and a second direction parameter, where the second distance parameter is the distance between the second prediction point and the first feature point, the second number of iterations is the number of iterations for generating the second prediction point on the feature line, and the second direction parameter is the direction parameter of the second prediction point.

[0130] It can be understood that in this step, the second distance parameter, the second number of iterations, and the second direction parameter required for generating the second prediction point are initialized. The initial value of the second distance parameter is 0, the initial value of the second number of iterations is 0, and the initial value of the second direction parameter is 1, where 1 represents the positive direction and -1 represents the negative direction. In this way, by initializing these parameters, a clear starting point and direction are provided for the subsequent prediction point generation and feature point matching, ensuring the orderliness and repeatability of the algorithm.

[0131] In this embodiment, in step S420, the intersection of the characteristic straight line and the first axis is taken as the starting point, and a corresponding second prediction point is generated on the characteristic straight line according to the product of the second distance parameter and the second direction vector.

[0132] It can be understood that in this step, starting from the intersection of the characteristic straight line and the first axis, the second predicted point on the characteristic straight line is generated according to the product of the second distance parameter and the second direction vector. Specifically, the coordinates of the predicted point can be obtained by the formula:

[0133] xpt.x=pty.x+predictLenx*uintVecx.x;

[0134] xpt.y=pty.y+predictLenx*uintVecx.y;

[0135] Calculation is performed, where xpt represents the coordinates of the generated second prediction point, xpt.x and xpt.y represent the coordinates of the second prediction point on the x-axis and y-axis respectively; pty represents the intersection of the feature line and the first axis, predictLenx represents the distance between the second prediction point and the intersection of the feature line and the first axis; uintVecx represents the unit vector of the feature line, uintVecx.x and uintVecx.y represent the components of the unit vector on the x-axis and y-axis respectively.

[0136] In this embodiment, step S430, taking the intersection of the feature straight line and the first axis as the starting point, and heading in the direction represented by the second direction parameter, determines the second feature point among the multiple fifth feature points that meets the preset matching condition with the second predicted point, and the preset matching condition is that the distance error between the feature point and the predicted point is less than the fourth preset error.

[0137] It is understandable that in this step, a feature point whose distance error with the second prediction point is less than the fourth preset error is selected from the plurality of fifth feature points. In this way, by setting the preset matching condition, it is ensured that the distance error between the selected feature point and the prediction point is within an acceptable range, thereby improving the accuracy of feature point matching.

[0138] It should be explained that the fourth preset error T dx =S x *d bx *disCoef, where S x represents the scaling factor of the characteristic line, d bx Indicates the reference distance of the corresponding feature point (for details, please refer to Fig. 9 As shown), disCoef represents the distance error coefficient.

[0139] In this embodiment, in step S440, when it is determined that there is a second feature point that satisfies the preset matching condition with the second prediction point, the second feature point is recorded, and the world coordinate point corresponding to the second feature point is recorded, and the second distance parameter of the next second prediction point is updated, and the matched second feature point is removed from the multiple fifth feature points.

[0140] It is understandable that in this step, if a second feature point that meets the preset matching conditions is found, the distance parameter of the second prediction point is updated. By updating the distance parameter and removing the matched feature points, the generation of the next prediction point is ensured to be more accurate, repeated matching is avoided, and the efficiency and accuracy of the algorithm are improved. It should be noted that after finding the second feature point that meets the preset matching conditions, the world coordinate point pw (m*iterxCnt*dirx, m*iteryCnt*diry) corresponding to the second feature point can be recorded, where iteryCnt is the first iteration parameter, iterxCnt is the second iteration parameter, diry is the first direction parameter, dirx is the second direction parameter, and m is the world spacing. After the entire process, the world coordinate points corresponding to all second feature points can be found.

[0141] In this embodiment, step S450, when it is determined that there is no second feature point that satisfies the preset matching condition with the second predicted point, determines whether the second predicted point is within the second preset limit range, and if so, updates the second distance parameter and the second iteration number of the next second predicted point; if not, changes the second direction parameter, and reinitializes the second distance parameter and the second iteration number, and returns to repeatedly execute the step of taking the intersection of the feature straight line and the first axis as the starting point, and generating a corresponding second predicted point on the feature straight line according to the product of the second distance parameter and the second direction vector; taking the intersection of the feature straight line and the first axis as the starting point, and heading in the direction represented by the second direction parameter, determining the second feature point among the multiple fifth feature points that satisfies the preset matching condition with the second predicted point.

[0142] It can be understood that in this step, if the second feature point that meets the preset matching condition is not found, it is determined whether the second prediction point is within the preset limit range. If it is within the range, the distance parameter and the number of iterations of the second prediction point are updated; if it is not within the range, the direction parameter is changed, and the distance parameter and the number of iterations are reinitialized, and the steps of generating the second prediction point and matching feature points are returned to be repeated, that is, step S420 and step S430 are repeated. In this way, the situation where the prediction point is not within the preset limit range is handled in this way, ensuring that the algorithm can continue to generate new prediction points until all matching feature points are found, thereby improving the robustness and reliability of the algorithm.

[0143] It should be noted that the preset limit range is determined according to the actual situation. In practice, if there are many feature points, it can be set smaller. If there are fewer feature points, it needs to be set larger.

[0144] It can be understood that, since there are multiple characteristic straight lines, it is necessary to generate a second prediction point and perform matching of the second characteristic points for each characteristic straight line.

[0145] In this way, through steps S410 to S450, the present invention can generate a more accurate pixel coordinate system, and by gradually generating prediction points and matching feature points, it ensures that the feature points on the feature line match more accurately, reduces the accumulation of initial errors, and improves the accuracy of the entire coordinate system.

[0146] In one embodiment, when it is determined that there is a second feature point that satisfies the preset matching condition with the second predicted point, the second distance parameter of the next second predicted point after update is equal to the distance between the previous second feature point and the intersection of the feature straight line and the first axis plus the second direction parameter multiplied by the second direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current second iteration number; when it is determined that there is no second feature point that satisfies the preset matching condition with the second predicted point, the second distance parameter of the next second predicted point after update is equal to the second distance parameter of the previous second predicted point plus the second direction parameter multiplied by the second direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current second iteration number; and the updated second iteration number is equal to the current second iteration number plus 1. In this way, by dynamically updating the distance parameter and the iteration number, it is ensured that the generation of the prediction point is more accurate, the accumulation of initial errors is reduced, and the accuracy of the entire coordinate system is improved.

[0147] In one embodiment, if Figure 6 As shown, step S420 may include steps S421 to S423.

[0148] In this embodiment, step S421, the distance between the second prediction point and the origin of the pixel coordinate system is calculated. It can be understood that by calculating the distance, the position of the prediction point in the coordinate system can be determined, providing a clear reference point for subsequent feature point matching.

[0149] In this embodiment, step S422, a candidate feature point whose distance error with the second prediction point is less than a fourth preset error is found from the plurality of fifth feature points. It can be understood that by setting the preset matching condition, it is ensured that the distance error between the selected candidate feature point and the prediction point is within an acceptable range, thereby improving the accuracy of feature point matching.

[0150] In this embodiment, step S423 , among the candidate feature points, a candidate feature point with the shortest distance to the second prediction point is selected as the second feature point, and matched with the second prediction point.

[0151] It can be understood that, in this way, by selecting the candidate feature point with the smallest distance, it is ensured that the error between the matched feature point and the predicted point is minimized, and the accuracy and reliability of feature point matching are further improved.

[0152] Through steps S421 to S423, the candidate feature point with the smallest distance is selected, which ensures that the error between the matched feature point and the predicted point is minimized, further improving the matching accuracy.

[0153] In one embodiment, the method for calculating the characteristic line scaling coefficient includes: obtaining a projection point set of multiple fifth characteristic points on the characteristic line; performing an inner product operation on a vector formed by the projection point set and the intersection of the characteristic line and the first axis and a unit vector corresponding to the first direction of the characteristic line, and sorting the inner product results of the multiple inner product operations from small to large (such as Fig.11 As shown, the framed part is the second axis, and the numbers therein are sorted from small to large); multiple fifth feature points are sorted from small to large according to the above inner product; the pixel spacing between two adjacent projection points in the projection point set is calculated in turn; the ratio of the two adjacent pixel spacings is calculated as the scaling factor.

[0154] In this embodiment, the first direction of the characteristic straight line is the positive direction.

[0155] In this embodiment, the scaling factor calculation method is as follows: counting the ratios of the pixel spacings between all two adjacent second feature points, and selecting the ratios that meet the preset conditions for statistics; and calculating the average value of the ratios that meet the preset conditions as the final scaling factor.

[0156] In order to count the scaling factors of the adjacent pixel spacing of normal feature points more accurately, the present invention selects scaling factors that meet the conditions of 0.7 less than or equal to the scaling factor less than or equal to 1.3 for statistics and calculates their mean. In this way, by counting the ratios that meet the preset conditions and calculating their averages, it is ensured that the scaling factors are more reasonable and stable, and the robustness of the system is improved.

[0157] In one embodiment, if Figure 7 As shown, step S500 may include steps S510 to S540.

[0158] In this embodiment, step S510 initializes the origin and unit length of the world coordinate system, where the origin is the world coordinate corresponding to the origin of the pixel coordinate system, and the unit length is the preset world spacing. Thus, by initializing the origin and unit length of the world coordinate system, a clear reference point and scale are provided for subsequent coordinate conversion, ensuring the consistency and accuracy of the coordinate conversion.

[0159] In this embodiment, step S520, a first axis of a world coordinate system is determined according to the first axis of the pixel coordinate system.

[0160] In this embodiment, step S530, the second axis of the world coordinate system is determined according to the second axis of the pixel coordinate system.

[0161] In this embodiment, step S540, according to the world coordinate point corresponding to the second feature point, the second feature point and the world coordinate point are automatically sorted by a first sorting logic, and the first sorting logic includes from the first axis to the second axis.

[0162] Thus, through these steps, the present invention can generate an accurate and robust world coordinate system, and its beneficial effects include: improving the accuracy of coordinate transformation, enhancing the robustness of the system, reducing error propagation, and improving the efficiency of calibration. Specifically, by initializing the origin and unit length, the consistency and accuracy of coordinate transformation are ensured; by calculating the world coordinates of the feature points, the accurate position of the feature points in the world coordinate system is ensured; by determining the axis, the axis of the world coordinate system is ensured to be consistent with the actual distribution of the feature points, thereby improving the reliability and accuracy of the entire calibration process.

[0163] It can be understood that in this embodiment, since the second axis is the X-axis and the first axis is the Y-axis, the first sorting logic is specifically row first then column, and the sorting of the second feature points and their corresponding world coordinate points is completed by row first then column.

[0164] In general, the method proposed by the present invention can have the following embodiments: Fig.12 As shown, first construct a xoy first coordinate system, and perform a refined operation on the coordinate system, and search for feature points corresponding to the world coordinates in the feature point set in the order of the first axis (in this embodiment, the Y axis) and the second axis (in this embodiment, the X axis) of the world coordinate system. Specifically, according to step S200, first for the first axis, find the first feature point on the first axis according to the predicted point on the first axis, that is, starting from the origin o of the first axis, and first find the positive direction of the first axis, and then find the negative direction of the first axis, so the first feature points found are sequentially numbered 0, 1, 2, 3, 4, 5, 6, as shown in FIG. Fig.12 When a characteristic point pt on the first axis is found, a characteristic straight line parallel to the second axis is constructed from this characteristic point. Fig.12 The characteristic straight lines constructed as shown are L0, L1, L2, L3, L4, L5, and L6 in sequence (i.e., step S300, L0 to L6 are all characteristic straight lines in step S300).

[0165] Fig.12 In the example, taking the characteristic line L3 as an example, from pt y Start from, and first find the positive direction of the characteristic line L3, then the negative direction of the characteristic line L3, and find the second characteristic point on the line L3 in sequence according to the second predicted point (i.e. step S400). It should be noted that since there are missing characteristic points on the characteristic line L3 ( Fig.12 Therefore, according to the sub-steps in step S400, when the second feature point cannot be found in the missing feature point, the next prediction point is generated, and then the second feature point is found. At this time, the second feature point labeled 2 is found. Therefore, according to S400, the order of the second feature points on the feature L3 is 0, 1, 2, 3, 4, and 5. Taking this as an example, all feature points on all straight lines are found, and the world coordinate points corresponding to all feature points are obtained, which means that automatic sorting is achieved.

[0166] The present invention also proposes an industrial camera, which includes a controller for implementing a method for automatically sorting pixel coordinates of a calibration plate and world coordinates. Since the industrial camera provided by the embodiment of the present invention can improve the success rate of matching pixel coordinates with world coordinates by implementing automatic sorting of pixel coordinates and world coordinates. Compared with the prior art, the beneficial effects of the industrial camera provided by the embodiment of the present application are the same as the beneficial effects of the method or controller for automatically sorting pixel coordinates of a calibration plate and world coordinates provided by the above-mentioned embodiment, which will not be repeated here.

[0167] The above description is only an exemplary embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the technical concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.

Claims

1. A method for automatically sorting pixel coordinates and world coordinates of a calibration plate, characterized in that: include: Acquire a plurality of feature points in the calibration tool, and formulate a pixel coordinate system according to the plurality of feature points, wherein the pixel coordinate system includes a first axis and a second axis, and the plurality of feature points include a first feature point and a second feature point; Determine, according to the plurality of feature points and the pixel coordinate system, a plurality of first prediction points on a first axis in the pixel coordinate system, and record a first feature point that satisfies a preset matching condition with each of the first prediction points; Determine, based on the first characteristic points, a characteristic straight line passing through each of the first characteristic points and parallel to the second axis; Determine, according to the plurality of feature points and each of the feature lines, each of the plurality of fifth feature points that meets a preset condition, fit into a straight line according to each of the plurality of fifth feature points and refine each of the feature lines, determine, according to each of the plurality of fifth feature points and each of the feature lines, a plurality of second prediction points on each of the feature lines, record a second feature point that matches each of the second prediction points, and record a world coordinate point corresponding to the second feature point; According to the world coordinate point corresponding to the second feature point, the second feature point and the world coordinate point are sorted.

2. The method for automatically sorting the calibration plate pixel coordinates and world coordinates according to claim 1, characterized in that: The method of obtaining a plurality of feature points in the calibration tool and determining a pixel coordinate system according to the plurality of feature points specifically includes: Determine a first coordinate system according to any three of the plurality of feature points; Determine, based on the plurality of feature points and the first axis of the first coordinate system, a plurality of third feature points whose distance errors from the first axis of the first coordinate system are less than a first preset error, and fit the plurality of third feature points into the first axis of the pixel coordinate system, wherein the first preset error is equal to the distance between the coordinate point in the first axis of the first coordinate system and the origin of the first coordinate system multiplied by a preset distance error coefficient; Based on the multiple feature points and the second axis of the first coordinate system, multiple fourth feature points whose distance errors with the second axis of the first coordinate system are less than a second preset error are determined, and the multiple fourth feature points are fitted into the second axis of the pixel coordinate system, and the second preset error is equal to the distance between the coordinate point in the second axis of the first coordinate system and the origin of the first coordinate system multiplied by a preset distance error coefficient.

3. The method for automatically sorting the calibration plate pixel coordinates and world coordinates as claimed in claim 2, characterized in that: The method of determining a plurality of first prediction points on a first axis in the pixel coordinate system according to the plurality of feature points and the pixel coordinate system specifically comprises: Initialize a first distance parameter, a first iteration number, and a first direction parameter, wherein the first distance parameter is the distance between the first prediction point and the origin of the pixel coordinate system, the first iteration number is the number of iterations for generating the first prediction point on the first axis of the pixel coordinate system, and the first direction parameter is the direction parameter of the first prediction point; Taking the origin of the pixel coordinate system as a starting point, generating a corresponding first prediction point on the first axis according to the product of the first distance parameter and the first direction vector; Taking the origin of the first axis of the pixel coordinate system as the starting point, and heading in the direction represented by the first direction parameter, determining a first feature point among the plurality of third feature points that satisfies a preset matching condition with the first prediction point, wherein the preset matching condition is that a distance error between the feature point and the prediction point is less than a third preset error; When it is determined that there is a first feature point that satisfies a preset matching condition with the first prediction point, updating a first distance parameter of a next first prediction point, and removing the matched first feature point from the plurality of third feature points; When it is determined that there is no first feature point that meets the preset matching condition with the first prediction point, determine whether the first prediction point is within the first preset limit range, and if so, update the first distance parameter and the first iteration number of the next first prediction point; if not, change the first direction parameter, reinitialize the first distance parameter and the first iteration number, and return to repeatedly execute the steps of taking the origin of the pixel coordinate system as the starting point, generating the corresponding first prediction point on the first axis according to the product of the first distance parameter and the first direction vector; taking the origin of the first axis of the pixel coordinate system as the starting point, and heading in the direction represented by the first direction parameter, determining the first feature point that meets the preset matching condition with the first prediction point.

4. The method for automatically sorting the calibration plate pixel coordinates and world coordinates as claimed in claim 3, characterized in that: When it is determined that there is a first feature point that satisfies a preset matching condition with the first prediction point, the first distance parameter of the next first prediction point after update is equal to the distance between the previous first feature point and the origin of the pixel coordinate system plus the first direction parameter multiplied by the first direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current first iteration number; When it is determined that there is no first feature point that satisfies the preset matching condition with the first prediction point, the first distance parameter of the next first prediction point after update is equal to the first distance parameter of the previous first prediction point plus the first direction parameter multiplied by the first direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current first iteration number; as well as, The updated first iteration number is equal to the current first iteration number plus 1.

5. The method for automatically sorting the calibration plate pixel coordinates and world coordinates as claimed in claim 3, characterized in that: The step of taking the origin of the first axis of the pixel coordinate system as the starting point and heading in the direction represented by the first direction parameter to determine the first feature point that meets the preset matching condition with the first prediction point specifically includes: Finding a candidate feature point whose distance error with the first prediction point is less than a third preset error from the plurality of third feature points; Among the candidate feature points, a candidate feature point having the smallest distance to the first prediction point is selected as the first feature point, and matched with the first prediction point.

6. The method for automatically sorting the calibration plate pixel coordinates and world coordinates as claimed in claim 4, characterized in that: The calculation method of the scaling factor includes: Acquire a projection point set of a plurality of the third characteristic points on the first axis; Performing an inner product operation on a vector formed by the projection point set and the origin of the pixel coordinate system and a unit vector corresponding to a first direction of the first axis, and sorting the projection point set from small to large according to the inner product; sorting the third feature points from small to large according to the inner product; Calculate the pixel distance between two adjacent projection points in the projection point set in sequence; Calculating the ratio of the distances between two adjacent pixels as the scaling factor; The calculation method of the scaling factor includes: The ratios of all the distances between two adjacent pixels are counted, the ratios that meet the preset conditions are selected for statistics, and the average value of the ratios that meet the preset conditions is calculated as the final scaling factor.

7. The method for automatically sorting the calibration plate pixel coordinates and world coordinates as claimed in claim 2, characterized in that: The method of determining each of the plurality of fifth feature points that meet a preset condition according to the plurality of feature points and each of the feature lines, fitting a straight line according to each of the plurality of fifth feature points and refining each of the feature lines, determining a plurality of second prediction points on each of the feature lines according to each of the plurality of fifth feature points and each of the feature lines, and recording a second feature point that matches each of the second prediction points, and recording a world coordinate point corresponding to the second feature point includes: Initialize a second distance parameter, a second number of iterations, and a second direction parameter, wherein the second distance parameter is the distance between the second prediction point and the first feature point, the second number of iterations is the number of iterations for generating the second prediction point on the feature line, and the second direction parameter is the direction parameter of the second prediction point; Taking the intersection of the characteristic straight line and the first axis as the starting point, generating a corresponding second prediction point on the characteristic straight line according to the product of the second distance parameter and the second direction vector; Taking the intersection of the characteristic straight line and the first axis as the starting point, and heading in the direction represented by the second direction parameter, determining a second characteristic point among the plurality of fifth characteristic points that satisfies a preset matching condition with the second predicted point, wherein the preset matching condition is that a distance error between the characteristic point and the predicted point is less than a fourth preset error; When it is determined that there is a second feature point that satisfies a preset matching condition with the second prediction point, the second feature point is recorded, and the world coordinate point corresponding to the second feature point is recorded, and a second distance parameter of a next second prediction point is updated, and the matched second feature point is removed from the plurality of fifth feature points; When it is determined that there is no second feature point that satisfies the preset matching condition with the second predicted point, determine whether the second predicted point is within the second preset limit range, and if so, update the second distance parameter and the second iteration number of the next second predicted point; if not, change the second direction parameter, reinitialize the second distance parameter and the second iteration number, and return to repeatedly execute the steps of taking the intersection of the feature straight line and the first axis as the starting point, generating a corresponding second predicted point on the feature straight line according to the product of the second distance parameter and the second direction vector; taking the intersection of the feature straight line and the first axis as the starting point, and heading in the direction represented by the second direction parameter, determine the second feature point among the plurality of fifth feature points that satisfies the preset matching condition with the second predicted point.

8. The method for automatically sorting the calibration plate pixel coordinates and world coordinates as claimed in claim 7, characterized in that: When it is determined that there is a second feature point and the second predicted point that meet the preset matching condition, the second distance parameter of the next second predicted point after update is equal to the distance between the previous second feature point and the intersection of the feature straight line and the first axis plus the second direction parameter multiplied by the second direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current second iteration number; When it is determined that there is no first feature point that satisfies the preset matching condition with the second prediction point, the second distance parameter of the next second prediction point after update is equal to the second distance parameter of the previous second prediction point plus the second direction parameter multiplied by the second direction vector multiplied by the reference distance multiplied by the scaling factor to the Nth power, where N is the current second iteration number; as well as, The updated second iteration number is equal to the current second iteration number plus 1.

9. The method for automatically sorting the calibration plate pixel coordinates and world coordinates according to any one of claims 1 to 8, characterized in that: The method for completing the sorting of the second feature point and the world coordinate point according to the world coordinate point corresponding to the second feature point includes: Initialize the origin and unit length of the world coordinate system, where the origin is the world coordinate corresponding to the origin of the pixel coordinate system, and the unit length is a preset world spacing; Determine a first axis of a world coordinate system according to the first axis of the pixel coordinate system; Determining a second axis of a world coordinate system according to the second axis of the pixel coordinate system; According to the world coordinate point corresponding to the second feature point, the second feature point and the world coordinate point are automatically sorted by a first sorting logic, wherein the first sorting logic includes from the first axis to the second axis.

10. An industrial camera, characterized in that: A controller is included, and the controller is used to implement the method for automatically sorting the pixel coordinates and world coordinates of the calibration plate as described in any one of claims 1 to 9.