A control point transformation method for image processing
By constructing a control point transformation method for flexible workpieces and utilizing rotation matrix, translation matrix and affine transformation, the problem that traditional rigid transformation cannot describe complex deformation is solved, and the positioning accuracy and reliability of flexible workpieces are improved.
Patent Information
- Application Number
- CN202510858843.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2045-06-25
AI Technical Summary
Traditional rigid or global affine/perspective transformation technologies based on mark points cannot effectively describe and correct complex and non-uniform deformations when facing flexible workpieces, resulting in large local displacement deviations and inability to simulate complex deformations, affecting processing accuracy and efficiency.
By obtaining the coordinate extreme positions of the source control point and the target control point, calculating the reference coordinates and clipping the control points, and using the rotation matrix, translation matrix, normalization and affine transformation to build the transformation relationship, the matching positioning accuracy of the flexible workpiece is improved.
It significantly improves the matching positioning accuracy and reliability of flexible workpieces, reduces processing offset and detection misjudgment, and improves processing efficiency.
Smart Images

Figure CN120374350B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and more specifically, to a control point transformation method for image processing. Background Art
[0002] Control Point Transformation (CPT) is a key technology that has recently developed in the fields of image processing, computer vision, and industrial automation. Its core concept is to manually or automatically select a set of spatially corresponding feature points (called control points) on the source and target images, and then establish a mathematical mapping model between the source and target point sets. This mapping is used to perform geometric correction, registration, alignment, or deformation simulation on images or point sets.
[0003] In automated industrial production (such as SMT placement, CNC machining, laser marking, visual inspection, and robotic gripping / assembly), high-contrast, regularly shaped, and easily recognizable physical markers (markers) are often used as key positioning references. A machine vision system accurately identifies multiple pre-defined markers on the workpiece and uses them as control points to calculate the workpiece's geometric transformation relative to the preset "ideal" position (typically a rigid transformation such as translation, rotation, scaling, or a combination thereof, which may also include perspective transformations). This calculated transformation is then applied to the entire workpiece coordinate system or machining path coordinate points to locate the workpiece and guide subsequent machining, inspection, or operation steps.
[0004] Traditional marker-based positioning technology offers significant advantages for rigid workpieces (whose shape and size remain constant during positioning and machining), thanks to its mature algorithms, efficient computation, and high positioning accuracy. Its success relies on a key assumption: the workpiece itself is rigid, meaning its internal structure does not deform, and all points follow the same geometric transformation rules (rigid body transformation or global affine / perspective transformation).
[0005] However, in actual industrial production, there are a large number of flexible workpieces (such as FPC flexible circuit boards, thin metal sheets, soft packaging materials, rubber products, textiles, thermoplastic components, etc.). During manufacturing, transportation, clamping, or processing, these workpieces are easily affected by physical stresses (such as gravity, clamping force, thermal expansion and contraction, and uneven material tension), inevitably causing complex and non-uniform deformations (stretching, compression, twisting, bending, etc.).
[0006] Traditional marker-based rigid or global affine / perspective transformation techniques suffer from fundamental flaws when applied to flexible workpieces: 1. Large local displacement deviations: Workpiece deformation causes the displacement patterns (translation, rotation, and scaling) of different regions on the surface to vary significantly, or even dramatically. Attempting to fit all control points (markers) with a simple global transformation model (affine, similarity, or rigid body) inevitably results in significant registration errors in areas outside of control points or far from the center of the transformation. 2. Inability to simulate complex deformations: Traditional rigid / affine transformation models have limited expressive power and are unable to describe and correct nonlinear, localized deformations. The actual deformation of workpieces is often highly nonlinear (especially when bending or twisting occurs), requiring a more flexible, non-rigid deformation model to accurately describe them.
[0007] When using traditional rigid positioning methods for flexible workpieces, while the marks themselves may be barely aligned, the overall shape of the workpiece (particularly the areas between the marks and those away from the control points) can deviate significantly from the desired ideal position. This can lead to: ① Processing offset: The positions of operations such as drilling, welding, cutting, and placement do not match actual requirements, resulting in poor processing or even product rejection; ② Inspection misjudgment: AOI inspection and dimensional measurement results can produce false positives or omissions due to coordinate system distortion; ③ Assembly failure: Assembly steps requiring precise alignment cannot be performed; ④ Reduced efficiency: Additional adjustment steps or rework are required.
[0008] Therefore, how to effectively and robustly solve the problem of precise positioning of flexible workpieces, overcome the inadequacy of traditional rigid or simple global transformations in describing and correcting complex non-uniform deformations, especially avoid unreasonable global deformations caused by local control point recognition errors, and achieve high-precision positioning effects consistent with physical deformations, has become a key technical difficulty that needs to be overcome in industrial applications. Summary of the Invention
[0009] In view of the above problems, the purpose of the present invention is to provide a control point transformation method for image processing. By constructing a transformation relationship through control points, it can efficiently complete the transformation of other points, providing an effective solution for control point transformation in industrial image processing. By using the ideal mark point and the actual identified mark point as the source control point and the target control point, respectively, the control point transformation is performed on the ideal workpiece, improving the matching and positioning effect of the flexible workpiece, and significantly improving the matching and positioning accuracy and reliability of the flexible workpiece.
[0010] The present invention provides a control point transformation method for image processing, comprising:
[0011] Get the source control point set A and the target control point set B;
[0012] Traverse the target control points in the target control point set B to determine the coordinate limit position of the target control point; the coordinate limit position includes the maximum x coordinate x max , minimum x-coordinate value x min , y coordinate maximum value y max and the minimum y coordinate y min ;
[0013] The reference coordinates (x) of the target control point are calculated based on the coordinate limit position of the target control point. b ,y b ), and crop all source control points and target control points;
[0014] According to the clipped source control point A i (x i ,y i ) to analyze, determine the rotation matrix R and translation matrix T, and calculate the source control point A i (x i ,y i ) corresponds to the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i );
[0015] The coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ) perform normalization and affine transformation in sequence, and transform the coordinates of the reference control point G after affine transformation i (x 3i ,y 3i ) is determined as the final coordinate.
[0016] This plan also includes:
[0017] The source control points in the source control point set A are matched one-to-one with the target control points in the target control point set B in sequence.
[0018] In this solution, the reference coordinates (x b ,y b ),include:
[0019] The coordinate limit position of the target control point is input into the preset reference coordinate calculation formula to determine the reference coordinate of the target control point (x b ,y b );
[0020] ;
[0021] ;
[0022] Where p is the filling constant, x max 、x min 、y max and y min are the maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate of the target control points in the target control point set B, respectively.
[0023] In this solution, the clipping of all source control points and target control points includes:
[0024] All source control points and target control points are clipped based on the coordinate limit position of the target control point, and the coordinates of the control points after clipping (x c ,y c ); the clipped control points include clipped source control points and clipped target control points;
[0025] ;
[0026] ;
[0027] Among them, p is the filling constant, x and y are the horizontal and vertical coordinates of the source control point or the target control point before clipping, x min and y min They are the minimum x-coordinate and the minimum y-coordinate of the target control point in the target control point set B, respectively.
[0028] In this solution, the source control point A after clipping i (x i ,y i ) to analyze and determine the rotation matrix R and translation matrix T, including:
[0029] For the clipped source control point A i (x i ,y i ) to expand and determine the initial point C i (x i ,y i ,0);
[0030] The source control point set A is rotated and translated by the Levenberg-Marquardt algorithm to determine the initial point C. i (x i ,y i ,0) corresponding to the new coordinate D i (x Di ,y Di ,z Di );
[0031] The new coordinate D is calculated based on the xy coordinate difference i (x Di ,y Di ,z Di ) and the source control point A i (x i ,y i ) corresponds to the first coordinate distance of the target control point;
[0032] When the first coordinate distance is the minimum value, the rotation matrix R and the translation matrix T are determined.
[0033] In this solution, the calculation of the source control point A i (x i ,y i ) corresponds to the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ),include:
[0034] The initial point C is transformed by the rotation matrix R and the translation matrix T. i (x i ,y i ,0) Perform rotation and translation transformation to determine the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ).
[0035] In this solution, the normalization operation is specifically as follows:
[0036] The coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ) to perform normalization operation and determine the normalized reference control point coordinates F i (x 2i ,y 2i );
[0037] ;
[0038] ;
[0039] Where f is the normalization coefficient.
[0040] This plan also includes:
[0041] Calculate the normalized reference control point coordinates F i (x 2i ,y 2i )’s deformation offset parameter dx and d y ;
[0042] ;
[0043] ;
[0044] Among them, k1, k2, p1 and p2 are deformation coefficients.
[0045] In this solution, the affine transformation is specifically:
[0046] Based on the deformation offset parameter d x and d y The normalized reference control point coordinates F i (x 2i ,y 2i ) performs affine transformation and determines the coordinates of the reference control point after affine transformation G i (x 3i ,y 3i );
[0047] ;
[0048] ;
[0049] Among them, h1 and h2 are affine coefficients, x b and y b The reference horizontal and vertical coordinates of the target control point.
[0050] This plan also includes:
[0051] Through ceres, the relevant parameters and reference coordinates x b and y b Perform iterative optimization; the relevant parameters include the rotation matrix R and the translation matrix T, the affine coefficients h1 and h2, and the deformation coefficients k1, k2, p1 and p2.
[0052] The present invention discloses a control point transformation method for image processing, which comprises the following steps: obtaining a source control point set A and a target control point set B; traversing the target control points in the target control point set B to determine the coordinate limit positions of the target control points; and calculating the reference coordinates (x b ,y b ), and clip all source control points and target control points; according to the clipped source control point A i (x i ,y i ) to analyze, determine the rotation matrix R and translation matrix T, and calculate the source control point A i (xi ,y i ) corresponds to the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i );For the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ) perform normalization and affine transformation in sequence, and transform the coordinates of the reference control point G after affine transformation i (x 3i ,y 3i ) is determined as the final coordinate. By building a transformation relationship through control points, the transformation of other points can be completed efficiently, improving the matching and positioning effect of flexible workpieces, and significantly improving the matching and positioning accuracy and reliability of flexible workpieces. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A flow chart of a control point transformation method for image processing provided by the present invention is shown;
[0054] Figure 2 A flow chart of the method for determining the rotation matrix R and the translation matrix T provided by the present invention is shown. DETAILED DESCRIPTION
[0055] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.
[0056] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited to the specific embodiments disclosed below.
[0057] Figure 1 The flowchart of the control point transformation method for image processing provided by the present invention is shown.
[0058] like Figure 1 As shown, the present invention discloses a control point transformation method for image processing, comprising:
[0059] S102, obtaining a source control point set A and a target control point set B;
[0060] S104, traverse the target control points in the target control point set B to determine the coordinate limit position of the target control point; the coordinate limit position includes the maximum x coordinate x max , minimum x-coordinate value xmin , y coordinate maximum value y max and the minimum y coordinate y min ;
[0061] S106, calculate the reference coordinates (x b ,y b ), and crop all source control points and target control points;
[0062] S108, based on the clipped source control point A i (x i ,y i ) to analyze, determine the rotation matrix R and translation matrix T, and calculate the source control point A i (x i ,y i ) corresponds to the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i );
[0063] S110, coordinates of reference control point E i (x 1i ,y 1i ,z 1i ) perform normalization and affine transformation in sequence, and transform the coordinates of the reference control point G after affine transformation i (x 3i ,y 3i ) is determined as the final coordinate.
[0064] According to an embodiment of the present invention, both the source control point set A and the target control point set B are input by the user. The source control points are typically ideal points (e.g., ideal marker coordinates) or points before deformation, while the target control points are actual points (actually identified marker coordinates) or points after deformation. The source control point set A and the target control point set B have the same number of control points, n control points. Each source control point in the source control point set A is sequentially associated with each target control point in the target control point set B.
[0065] Traverse all the target control points in the target control point set B and record the maximum x coordinate of all the target control points in the set. max , minimum x-coordinate value x min , y coordinate maximum value y max and the minimum y coordinate y min , determine the coordinate limit position of the target control point. The base coordinate (x b ,y b), through the minimum value x of the x - coordinate in the coordinate limit positions of the target control points min and the minimum value y of the y - coordinate min Combined with clipping each source control point in the source control point set A and each target control point in the target control point set B, determine the coordinates of the clipped control points (x c , y c ), including the clipped source control point A i (x i , y i ) and the clipped target control point B i (x Bi , y Bi ). Among them, i < n. All subsequent operation steps are for the clipped control points. Convert the clipped source control point A i (x i , y i ) into three - dimensional coordinates to obtain the initial point C i (x i , y i , 0). Through the Levenberg - Marquardt algorithm, perform rotation and translation transformation on the source control point set A whose source control point coordinates are converted into three - dimensional coordinates, and determine the new coordinates D i (x i , y i , 0) corresponding to C i (x Di , y Di , z Di ). Based on the xy - coordinate difference, calculate the first - coordinate distance between the new coordinate D i (x Di , y Di , z Di ) and the source control point A[[ID=5!]] i (x i , y i ) corresponding to the target control point. When the first - coordinate distance is the minimum value, determine the rotation matrix R and the translation matrix T through the rotation and translation transformation matrix corresponding at this time. Perform rotation and translation transformation on each source control point A i (x i , y i ) through the rotation matrix R and the translation matrix T to determine the corresponding reference control point coordinates E i (x 1i , y 1i , z 1i ). Perform normalization operation on the reference control point coordinates E i (x 1i , y 1i , z 1i ) and convert it into two - dimensional coordinates to determine the normalized reference control point coordinates Fi (x 2i ,y 2i ). Through the normalized coordinates of the reference control point F i (x 2i ,y 2i ) Calculate the deformation offset parameter d x and d y , based on the deformation offset parameter d x and d y The normalized coordinates of the reference control point F i (x 2i ,y 2i ) performs affine transformation and determines the coordinates of the reference control point after affine transformation G i (x 3i ,y 3i ), use it as the final coordinate to complete the control point transformation.
[0066] In addition, for any point P(x P ,y P ), first calculate the points after rotation and translation according to the rotation matrix R and translation matrix T, then calculate the normalized points, then calculate the deformation offset, and finally calculate the points after affine transformation, that is, complete the final transformation calculation.
[0067] According to an embodiment of the present invention, the further embodiment includes:
[0068] The source control points in the source control point set A are matched one-to-one with the target control points in the target control point set B in sequence.
[0069] It should be noted that the points in the source control point set A and the target control point set B are in a one-to-one correspondence in sequence, that is, the i-th source control point in set A becomes the i-th target control point in set B after transformation.
[0070] According to an embodiment of the present invention, the reference coordinates (x b ,y b ),include:
[0071] Input the coordinate limit position of the target control point into the preset reference coordinate calculation formula to determine the reference coordinate of the target control point (x b ,y b );
[0072] ;
[0073] ;
[0074] Where p is the filling constant, x max 、x min、y max and y min are the maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate of the target control points in the target control point set B, respectively.
[0075] It should be noted that the preset reference coordinate calculation formula is set by those skilled in the art, and the value of the filling constant p is set by those skilled in the art according to actual needs.
[0076] According to an embodiment of the present invention, clipping all source control points and target control points includes:
[0077] Based on the coordinate limit position of the target control point, all source control points and target control points are clipped and the coordinates of the control points after clipping (x c ,y c ); the clipped control points include the clipped source control points and the clipped target control points;
[0078] ;
[0079] ;
[0080] Among them, p is the filling constant, x and y are the horizontal and vertical coordinates of the source control point or the target control point before clipping, x min and y min They are the minimum x-coordinate and the minimum y-coordinate of the target control point in the target control point set B, respectively.
[0081] It should be noted that, by setting the filling constant p, the minimum x-coordinate value, and the minimum y-coordinate value of the target control points in the target control point set B according to actual needs, those skilled in the art can sequentially clip each source control point in the source control point set A and each target control point in the target control point set B. Subsequent operation steps are all performed on the clipped control points.
[0082] Figure 2 A flow chart of the method for determining the rotation matrix R and the translation matrix T provided by the present invention is shown.
[0083] like Figure 2 As shown, according to an embodiment of the present invention, according to the source control point A after clipping i (x i ,y i ) to analyze and determine the rotation matrix R and translation matrix T, including:
[0084] S202, the source control point A after clipping i (x i ,y i ) to expand and determine the initial point C i (xi ,y i ,0);
[0085] S204, performing rotation and translation transformation on the source control point set A by using the Levenberg-Marquardt algorithm to determine the initial point C i (x i ,y i ,0) corresponding to the new coordinate D i (x Di ,y Di ,z Di );
[0086] S206, calculate the new coordinate D based on the xy coordinate difference i (x Di ,y Di ,z Di ) and source control point A i (x i ,y i ) corresponds to the first coordinate distance of the target control point;
[0087] S208 : When the first coordinate distance is the minimum value, determine the rotation matrix R and the translation matrix T.
[0088] It should be noted that the source control point A after clipping i (x i ,y i ) expansion, convert the two-dimensional coordinates into three-dimensional coordinates, the z-axis coordinate defaults to 0, that is, the initial point C is obtained i (x i ,y i ,0). The Levenberg-Marquardt algorithm is a least-squares estimation method for regression parameters in nonlinear regression. The Levenberg-Marquardt algorithm is used to iteratively determine the minimum first-coordinate distance. The corresponding rotation and translation transformation matrices are then used to determine the rotation matrix R and translation matrix T.
[0089] New coordinates D i (x Di ,y Di ,z Di ) and source control point A i (x i ,y i ) The specific calculation method of the first coordinate distance corresponding to the target control point is:
[0090] ;
[0091] Among them, d is the first coordinate distance, x Bi and y BiSource control point A i (x i ,y i ) corresponds to the target control point B i The horizontal and vertical coordinates of .
[0092] According to an embodiment of the present invention, the source control point A is calculated i (x i ,y i ) corresponds to the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ),include:
[0093] The initial point C is transformed by the rotation matrix R and the translation matrix T i (x i ,y i ,0) Perform rotation and translation transformation to determine the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ).
[0094] It should be noted that the initial point after expansion of each source control point is calculated through the rotation matrix R and the translation matrix T to determine the coordinates of the reference control point of its rotation and translation transformation.
[0095] According to an embodiment of the present invention, the normalization operation steps are specifically as follows:
[0096] Coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ) to perform normalization operation and determine the normalized reference control point coordinates F i (x 2i ,y 2i );
[0097] ;
[0098] ;
[0099] Where f is the normalization coefficient.
[0100] It should be noted that by normalizing the three-dimensional coordinates into two-dimensional coordinates, the instability of numerical calculations caused by coordinate scale differences can be eliminated, computational complexity can be simplified, and the accuracy of subsequent calculations can be improved. The value of the normalization coefficient f is determined by those skilled in the art based on actual needs.
[0101] According to an embodiment of the present invention, the further embodiment includes:
[0102] Calculate the normalized coordinates of the reference control point F i (x 2i ,y 2i )’s deformation offset parameter d x and d y ;
[0103] ;
[0104] ;
[0105] Among them, k1, k2, p1 and p2 are deformation coefficients.
[0106] It should be noted that the normalized reference control point coordinates F i (x 2i ,y 2i ) is input into the system's preset deformation offset parameter calculation formula, and the normalized reference control point coordinates F are output. i (x 2i ,y 2i ) corresponding deformation offset parameter d x and d y The initial values of the deformation coefficients k1, k2, p1 and p2 are all set by those skilled in the art.
[0107] According to an embodiment of the present invention, the affine transformation step is further comprised of:
[0108] Based on the deformation offset parameter d x and d y The normalized coordinates of the reference control point F i (x 2i ,y 2i ) performs affine transformation and determines the coordinates of the reference control point after affine transformation G i (x 3i ,y 3i );
[0109] ;
[0110] ;
[0111] Among them, h1 and h2 are affine coefficients, x b and y b The reference horizontal and vertical coordinates of the target control point.
[0112] It should be noted that the normalized reference control point coordinates F i (x 2i ,y 2i) is input into the affine transformation formula preset by the system, and the coordinates of the reference control point after affine transformation G are output. i (x 3i ,y 3i ), and through geometric transformation, the reference control points are adapted to the target space to achieve accurate coordinate mapping. The initial values of the affine coefficients h1 and h2 are set by those skilled in the art.
[0113] According to an embodiment of the present invention, the further embodiment includes:
[0114] Through ceres, the relevant parameters and reference coordinates x b and y b Perform iterative optimization; the relevant parameters include the rotation matrix R and translation matrix T, affine coefficients h1 and h2, and deformation coefficients k1, k2, p1 and p2.
[0115] It should be noted that ceres is a library for nonlinear optimization. Given an initial value, it continuously calculates the offset to move the parameter to be optimized in the direction of minimizing the gradient of the objective function. In ceres, all source control points are used as input, and rotation and translation transformations, normalization operations, and affine transformations are repeated to calculate the residual between the coordinates of the reference control points after affine transformation and the corresponding actual target control point coordinates. Ceres is used for iterative calculations to continuously update the rotation matrix R and translation matrix T, affine coefficients h1 and h2, deformation coefficients k1, k2, p1, and p2, and reference coordinates x b and y b , until the number of iterations preset by the system is met or the residual is less than the residual threshold preset by the system. At this point, the calculation of all relevant parameters is completed.
[0116] The information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals (including but not limited to signals transmitted between user terminals and other devices, etc.) involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the "source control point set A" and "target control point set B" involved in this disclosure are all obtained with full authorization.
[0117] The present invention discloses a control point transformation method for image processing, which comprises the following steps: obtaining a source control point set A and a target control point set B; traversing the target control points in the target control point set B to determine the coordinate limit positions of the target control points; and calculating the reference coordinates (x b ,y b), and clip all source control points and target control points; according to the clipped source control point A i (x i ,y i ) to analyze, determine the rotation matrix R and translation matrix T, and calculate the source control point A i (x i ,y i ) corresponds to the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i );For the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ) perform normalization and affine transformation in sequence, and transform the coordinates of the reference control point G after affine transformation i (x 3i ,y 3i ) is determined as the final coordinate. By building a transformation relationship through control points, the transformation of other points can be completed efficiently, improving the matching and positioning effect of flexible workpieces, and significantly improving the matching and positioning accuracy and reliability of flexible workpieces.
[0118] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0119] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0120] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0121] Those skilled in the art will appreciate that all or part of the steps of the above-mentioned method embodiments may be implemented by hardware associated with program instructions, and the aforementioned program may be stored in a computer-readable storage medium. When the program is executed, the program executes the steps of the above-mentioned method embodiments. The aforementioned storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0122] Alternatively, if the integrated units described above are implemented as software modules and sold or used as standalone products, they can also be stored on a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product, stored on a storage medium, includes instructions for enabling a computer device (such as a personal computer, server, or network device) to execute all or part of the methods described in various embodiments of the present invention. The aforementioned storage media include various media capable of storing program code, such as removable storage devices, ROM, RAM, magnetic disks, or optical disks.
Claims
1. A control point transformation method for image processing, characterized in that: include: Get the source control point set A and the target control point set B; Traverse the target control points in the target control point set B to determine the coordinate limit position of the target control point; the coordinate limit position includes the maximum x coordinate x max , minimum x-coordinate value x min , maximum y coordinate y max and the minimum y coordinate y min ; The reference coordinates (x) of the target control point are calculated based on the coordinate limit position of the target control point. b ,y b ), and crop all source control points and target control points; According to the clipped source control point A i (x i ,y i ) to analyze, determine the rotation matrix R and translation matrix T, and calculate the source control point A i (x i ,y i ) corresponds to the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ); The coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ) Perform normalization operations in sequence and calculate the normalized reference control point coordinates F i (x 2i ,y 2i )’s deformation offset parameter d x and d y ;based on The deformation offset parameter d x and d y The normalized reference control point coordinates F i (x 2i ,y 2i ) performs affine transformation, and the coordinates of the reference control point after affine transformation G i (x 3i ,y 3i ) is determined as the final coordinate; The reference coordinates (x) of the target control point are calculated based on the coordinate limit position of the target control point. b ,y b ),include: The coordinate limit position of the target control point is input into the preset reference coordinate calculation formula to determine the reference coordinate of the target control point (x b ,y b ); ; ; Where p is the filling constant, x max 、x min 、y max and y min are the maximum x-coordinate, minimum x-coordinate, maximum y-coordinate, and minimum y-coordinate of the target control point in the target control point set B, respectively; The clipping of all source control points and target control points includes: All source control points and target control points are clipped based on the coordinate limit position of the target control point, and the coordinates of the control points after clipping (x c ,y c ); the clipped control points include clipped source control points and clipped target control points; ; ; Among them, p is the filling constant, x and y are the horizontal and vertical coordinates of the source control point or the target control point before clipping, x min and y min are the minimum x-coordinate and y-coordinate values of the target control point in the target control point set B respectively; The affine transformation is specifically: Based on the deformation offset parameter d x and d y The normalized reference control point coordinates F i (x 2i ,y 2i ) performs affine transformation and determines the coordinates of the reference control point after affine transformation G i (x 3i ,y 3i ); ; ; Among them, h1 and h2 are affine coefficients, x b and y b The reference horizontal and vertical coordinates of the target control point.
2. The control point transformation method for image processing according to claim 1, characterized in that: Also includes: The source control points in the source control point set A are matched one-to-one with the target control points in the target control point set B in sequence.
3. The control point transformation method for image processing according to claim 1, wherein: The source control point A after clipping i (x i ,y i ) to analyze and determine the rotation matrix R and translation matrix T, including: For the clipped source control point A i (x i ,y i ) to expand and determine the initial point C i (x i ,y i ,0); The source control point set A is rotated and translated by the Levenberg-Marquardt algorithm to determine the initial point C. i (x i ,y i ,0) corresponding to the new coordinate D i (x Di ,y Di ,z Di ); The new coordinate D is calculated based on the xy coordinate difference i (x Di ,y Di ,z Di ) and the source control point A i (x i ,y i ) corresponds to the first coordinate distance of the target control point; When the first coordinate distance is the minimum value, the rotation matrix R and the translation matrix T are determined.
4. The control point transformation method for image processing according to claim 3, characterized in that: The calculation of the source control point A i (x i ,y i ) corresponds to the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ),include: The initial point C is transformed by the rotation matrix R and the translation matrix T. i (x i ,y i ,0) Perform rotation and translation transformation to determine the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ).
5. The control point transformation method for image processing according to claim 1, wherein: The normalization operation is specifically as follows: The coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ) to perform normalization operation and determine the normalized reference control point coordinates F i (x 2i ,y 2i ); ; ; Where f is the normalization coefficient.
6. The control point transformation method for image processing according to claim 5, characterized in that: Also includes: Calculate the normalized reference control point coordinates F i (x 2i ,y 2i )’s deformation offset parameter d x and d y ; ; ; Among them, k1, k2, p1 and p2 are deformation coefficients.
7. The control point transformation method for image processing according to claim 1, characterized in that: Also includes: Through ceres, the relevant parameters and reference coordinates x b and y b Perform iterative optimization; the relevant parameters include the rotation matrix R and the translation matrix T, the affine coefficients h1 and h2, and the deformation coefficients k1, k2, p1 and p2.
Citation Information
Patent Citations
Method and system for image deformation based on MRLS-TPS
CN105243636A
Calibration method and apparatus for camera external reference
CN109523597A