Control point transformation method for image processing
By acquiring and cropping the source target control points, calculating the rotation translation transformation and affine transformation, the complex deformation positioning problem of flexible workpieces is solved, and the matching positioning accuracy and reliability of flexible workpieces are improved.
Patent Information
- Application Number
- CN202510858843.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-06-25
AI Technical Summary
Traditional Mark point-based rigid or global affine/perspective transformation technology cannot effectively describe and correct complex and non-uniform deformation when facing flexible workpieces, resulting in large local displacement deviations and the inability to simulate non-linear deformation, affecting processing accuracy and detection accuracy, and reducing production efficiency.
By obtaining the set of source control points and target control points, calculate the coordinate limit position of the target control points, determine the rotation matrix and translation matrix after cropping, perform normalization and affine transformation, build a transformation relationship, and improve the matching positioning accuracy of flexible workpieces.
It significantly improves the matching positioning accuracy and reliability of flexible workpieces, avoids global unreasonable deformation caused by local control point identification errors, and achieves efficient positioning of flexible workpieces.
Smart Images

Figure CN120374350A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image processing, and more specifically, to a control point transformation method for image processing. Background Art
[0002] The control point transformation technology (ControlPointTransformation, CPT) is a key technology developed in the fields of image processing, computer vision, and industrial automation in recent years. Its core idea is to manually or automatically select a set of feature points (called control points) with corresponding spatial positions on the source image and the target image, and establish a mathematical mapping relationship model between the source point set and the target point set. This mapping relationship is used for geometric correction, registration, alignment, or deformation simulation of images or point sets.
[0003] In automated industrial production (such as SMT chip mounting, CNC machining, laser marking, visual inspection, robot grasping / assembly, etc.), physical marking points (Mark points) with high contrast, regular shapes, and easy recognition are usually used as key positioning references. Multiple Mark points with pre-designed positions on the workpiece are accurately identified by a machine vision system, used as control points, and the geometric transformation of the current workpiece relative to the preset "ideal" position is calculated (usually a rigid transformation, such as translation, rotation, scaling, or a combination thereof, and may also include a certain perspective transformation). Then, the calculated transformation relationship is applied to the entire workpiece coordinate system or the coordinate points of the processing path, thereby positioning the workpiece and guiding subsequent processing, inspection, or operation steps.
[0004] Traditional Mark point-based positioning technology has significant advantages of mature algorithms, high computational efficiency, and high positioning accuracy when dealing with rigid workpieces (whose shapes and sizes remain constant during positioning and processing). Its success depends on a key assumption: the workpiece itself is rigid, that is, its internal structure does not undergo any deformation, and all points follow the same geometric transformation law (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 plastic parts, etc.). Such workpieces are prone to being affected by physical stresses (such as gravity, clamping force, thermal expansion and contraction, uneven material tension, etc.) during manufacturing, transportation, clamping, or processing, and will inevitably undergo complex and non-uniform deformations (such as stretching, compression, twisting, bending, etc.).
[0006] Traditional rigid or global affine / perspective transformation technologies based on Mark points have fundamental defects when facing flexible workpieces: ① Large local displacement deviation: The deformation of the workpiece causes the displacement patterns (translation, rotation, scaling) of different areas on its surface to differ significantly or even completely. When trying to fit all control points (Mark points) with a simple global transformation model (affine, similarity, rigid body), huge registration errors will inevitably occur in non-control point areas or areas far from the transformation center; ② Unable to simulate complex deformations: Traditional rigid / affine transformation models have limited expressive power and cannot describe and correct nonlinear and localized deformations. The actual deformation form of the workpiece is often highly nonlinear (especially when there is bending and twisting), and a more flexible non-rigid deformation model is required to accurately describe it.
[0007] When a flexible workpiece uses traditional rigid positioning methods, although the mark points themselves may be barely aligned, the overall shape of the workpiece (especially the area between the mark points and the area far from the control point) deviates greatly from the desired ideal position. This may lead to: ① Processing offset: the position of drilling, welding, cutting, mounting and other operations does not meet the actual requirements, resulting in poor processing or even product scrapping; ② Detection misjudgment: AOI inspection, dimension measurement and other results produce false positives or omissions due to the distortion of the coordinate system; ③ Assembly failure: The assembly process that requires precise alignment cannot be achieved; ④ Efficiency reduction: 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, which can efficiently complete the transformation of other points by constructing transformation relationships through control points, and provide an effective solution for control point transformation in industrial image processing. The ideal mark point and the actually identified mark point are used as the source control point and the target control point respectively, and the control point transformation is performed on the ideal workpiece to improve the matching and positioning effect of the flexible workpiece, and significantly improve 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: 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 xmax , the minimum value x of the x coordinate min , the maximum value y of the y coordinate max and the minimum value y of the y coordinate min ; Calculate the reference coordinates (x b , y b ) of the target control point based on the coordinate limit positions of the target control points, and crop all source control points and target control points; According to the cropped source control point A i (x i , y i ), analyze to determine the rotation matrix R and the translation matrix T, and calculate the reference control point coordinates E i (x i , y i ) corresponding to the source control point A i (x 1i , y 1i , z 1i ); Perform normalization operations and affine transformations on the reference control point coordinates E i (x 1i , y 1i , z 1i ) in sequence, and determine the affine-transformed reference control point coordinates G i (x 3i , y 3i ) as the final coordinates.
[0011] In this solution, it also includes: Correspond the source control points in the source control point set A and the target control points in the target control point set B to each other in sequence.
[0012] In this solution, the calculation of the reference coordinates (x b , y b ) of the target control point based on the coordinate limit positions of the target control points includes: Input the coordinate limit positions of the target control points into a preset reference coordinate calculation formula to determine the reference coordinates (x b , y b ) of the target control point; ; ; where p is a padding constant, x max , x min , y max and y minThey are respectively the maximum value of the x - coordinate, the minimum value of the x - coordinate, the maximum value of the y - coordinate, and the minimum value of the y - coordinate of the target control points within the target control point set B.
[0013] In this solution, the clipping of all source control points and target control points includes: Based on the coordinate limit positions of the target control points, clip all source control points and target control points to determine the coordinates (x c , y c ) of the clipped control points; the clipped control points include the clipped source control points and the clipped target control points; ; ; where p is a padding constant, x and y are the horizontal and vertical coordinates of the source control point or target control point before clipping, and x min and y min are respectively the minimum value of the x - coordinate and the minimum value of the y - coordinate of the target control points within the target control point set B.
[0014] In this solution, the analysis of the clipped source control point A i (x i , y i ) to determine the rotation matrix R and the translation matrix T includes: Expand the clipped source control point A i (x i , y i ) to determine 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 to determine the new coordinates D i (x i , y i , 0) corresponding to the initial point C i (x Di , y Di , z Di ); Calculate the first coordinate distance between the new coordinates D i (x Di , y Di , z Di ) and the target control point corresponding to the source control point A i (x i , y i ); When the first coordinate distance is the minimum value, determine the rotation matrix R and the translation matrix T.
[0015] 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: 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 ).
[0016] In this solution, 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 coordinates of the reference control point F i (x 2i ,y 2i ); ; ; Where f is the normalization coefficient.
[0017] This plan 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.
[0018] In this solution, 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 Gi (x 3i ,y 3i ); ; ; Among them, h1 and h2 are affine coefficients, and x b and y b are the reference horizontal and vertical coordinates of the target control points.
[0019] This solution also includes: Performing iterative optimization on relevant parameters, reference coordinates x b and y b through Ceres; the relevant parameters include the rotation matrix R, the translation matrix T, the affine coefficients h1 and h2, and the deformation coefficients k1, k2, p1, and p2.
[0020] The present invention discloses a control point transformation method for image processing. The method includes: 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; calculating the reference coordinates (x b , y b ) of the target control points based on the coordinate limit positions of the target control points, and cropping all the source control points and target control points; analyzing the cropped source control points A i (x i , y i ) to determine the rotation matrix R and the translation matrix T, and calculating the reference control point coordinates E i (x i , y i ) corresponding to the source control points A i (x 1i , y 1i , z 1i ); performing normalization operations and affine transformations on the reference control point coordinates E i (x 1i , y 1i , z 1i ) in sequence, and determining the affine-transformed reference control point coordinates G i (x 3i , y 3i ) as the final coordinates. By constructing a transformation relationship through control points, the transformation of other points can be efficiently completed, the matching and positioning effect of flexible workpieces can be improved, and the matching and positioning accuracy and reliability of flexible workpieces can be significantly improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 Shows a flowchart of a control point transformation method for image processing provided by the present invention; Figure 2 The flowchart of the method for determining the rotation matrix R and the translation matrix T provided by the present invention is shown. Detailed implementation manners
[0022] In order to more clearly understand the above objects, features and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific implementation manners. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.
[0023] Many specific details are set forth in the following description in order to provide a thorough understanding of the present invention. However, the present invention may be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited by the specific embodiments disclosed below.
[0024] Figure 1 The flowchart of a control point transformation method for image processing provided by the present invention is shown.
[0025] As Figure 1 shown, the present invention discloses a control point transformation method for image processing, including: S102, obtaining a source control point set A and a target control point set B; S104, traversing the target control points in the target control point set B to determine the coordinate limit positions of the target control points; the coordinate limit positions include the maximum x coordinate x max , the minimum x coordinate x min , the maximum y coordinate y max and the minimum y coordinate y min ; S106, calculating the reference coordinates (x b , y b ) of the target control points based on the coordinate limit positions of the target control points, and cropping all the source control points and the target control points; S108, analyzing according to the cropped source control points A i (x i , y i ) to determine the rotation matrix R and the translation matrix T, and calculating the reference control point coordinates E i (x i , y i ) corresponding to the source control points A i (x 1i , y 1i , z 1i ); S110, for the reference control point coordinates E i (x 1i , y 1i , z1i ) Perform the normalization operation and the affine transformation in sequence, and use the coordinates G of the reference control points after the affine transformation i (x 3i , y 3i ) as the final coordinates.
[0026] According to the embodiments 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 usually ideal points (such as the coordinates of ideal mark points), points before deformation, and the target control points are actual points (the coordinates of actually recognized mark points) or points after deformation. The number of control points in the source control point set A and the target control point set B is the same, both are n control points, and each source control point in the source control point set A and each target control point in the target control point set B are corresponding one by one in order.
[0027] Traverse all the target control points in the target control point set B, and record the maximum value x of the x coordinates, the minimum value x of the x coordinates, the maximum value y of the y coordinates, and the minimum value y of the y coordinates among all the target control points in the set, so as to determine the coordinate limit positions of the target control points. Calculate the reference coordinates (x, y) of the target control points through the coordinate limit positions of the target control points combined with the filling constants preset in the system. Through the minimum value x of the x coordinates and the minimum value y of the y coordinates in the coordinate limit positions of the target control points, combined with the clipping of 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 (x, y) of the clipped control points, including the clipped source control point A(x, y) and the clipped target control point B(x, y). Among them, i < n. All subsequent operation steps are for the clipped control points. Convert the clipped source control point A(x, y) into three-dimensional coordinates to obtain the initial point C(x, y, 0). Perform a rotation and translation transformation on the source control point set A whose source control point coordinates are converted into three-dimensional coordinates through the Levenberg-Marquardt algorithm to determine the initial point C(x, y, max max, min min, max max min and b min b ) of the target control points, so as to determine the coordinate limit positions of the target control points. Calculate the reference coordinates (x, y) of the target control points through the coordinate limit positions of the target control points combined with the filling constants preset in the system. Through the minimum value x of the x coordinates and the minimum value y of the y coordinates in the coordinate limit positions of the target control points, combined with the clipping of 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 (x, y) of the clipped control points, including the clipped source control point A min (x min min, c , y c ) and the clipped target control point B i (x i , y i ) of the target control points. Among them, i < n. All subsequent operation steps are for the clipped control points. Convert the clipped source control point A i (x Bi , y Bi ) into three-dimensional coordinates to obtain the initial point C i (x i , y i ) into three-dimensional coordinates to obtain the initial point C i (x i , y i , 0). Perform a rotation and translation transformation on the source control point set A whose source control point coordinates are converted into three-dimensional coordinates through the Levenberg-Marquardt algorithm to determine the initial point C i (x i , yi , 0) corresponding new coordinate D i (x Di , y Di , z Di ). Calculate the new coordinate D based on the xy coordinate difference i (x Di , y Di , z Di ) and the source control point A i (x i , y i ), calculate the first coordinate distance to the corresponding target control point. When the first coordinate distance is the minimum value, determine the rotation matrix R and the translation matrix T through the corresponding rotation and translation transformation matrix at this time. Perform rotation and translation transformation on each source control point A i (x i , y i ) to determine the corresponding reference control point coordinate E i (x 1i , y 1i , z 1i ). Perform normalization operation on the reference control point coordinate E i (x 1i , y 1i , z 1i ) to convert it into two-dimensional coordinates and determine the normalized reference control point coordinate F i (x 2i , y 2i ). Calculate the deformation offset parameter d i (x 2i , y 2i ) based on the normalized reference control point coordinate F x and d y , and based on the deformation offset parameter d x and d y perform affine transformation on the normalized reference control point coordinate F i (x 2i , y 2i ) to determine the affine transformation reference control point coordinate G i (x 3i , y 3i ), and use it as the final coordinate to complete the control point transformation.
[0028] In addition, for any point P(x P , y P ) input by the user, first calculate the rotated and translated point according to the rotation matrix R and the translation matrix T, then calculate the normalized point, then calculate the deformation offset, and finally calculate the affine transformation point, that is, complete the final transformation calculation.
[0029] According to an embodiment of the present invention, it further includes: One-to-one correspondence is performed between each source control point in the source control point set A and each target control point in the target control point set B in sequence.
[0030] It should be noted that the points in the source control point set A and the target control point set B have a one-to-one correspondence in sequence, that is, the i-th source control point in the set A is transformed into the i-th target control point in the set B.
[0031] According to an embodiment of the present invention, based on the coordinate limit positions of the target control points, the reference coordinates (x b , y b ) of the target control points are calculated, including: Input the coordinate limit positions of the target control points into a preset reference coordinate calculation formula to determine the reference coordinates (x b , y b ) of the target control points; ; ; where p is a padding constant, and x max , x min , y max and y min are respectively the maximum x coordinate, the minimum x coordinate, the maximum y coordinate, and the minimum y coordinate of the target control points in the target control point set B.
[0032] It should be noted that the preset reference coordinate calculation formula is set by those skilled in the art, and the value of the padding constant p is set by those skilled in the art according to actual needs.
[0033] According to an embodiment of the present invention, all source control points and target control points are cropped, including: Based on the coordinate limit positions of the target control points, all source control points and target control points are cropped to determine the cropped control point coordinates (x c , y c ); the cropped control points include the cropped source control points and the cropped target control points; ; ; where p is a padding constant, x and y are the horizontal and vertical coordinates of the source control point or target control point before cropping, and x min and y min are respectively the minimum x coordinate and the minimum y coordinate of the target control points in the target control point set B.
[0034] It should be noted that according to the actual requirements of those skilled in the art, the filling constant p, the minimum x - coordinate and the minimum y - coordinate of the target control points in the target control point set B are used to crop each source control point in the source control point set A and each target control point in the target control point set B in turn. All subsequent operation steps are performed on the cropped control points.
[0035] Figure 2 The flowchart of the method for determining the rotation matrix R and the translation matrix T provided by the present invention is shown.
[0036] As Figure 2 shown, according to an embodiment of the present invention, based on the cropped source control points A i (x i , y i ), the rotation matrix R and the translation matrix T are determined, including: S202, expand the cropped source control points A i (x i , y i ) to determine the initial point C i (x i , y i , 0); S204, perform a rotation - translation transformation on the source control point set A through the Levenberg - Marquardt algorithm to determine the new coordinates D i (x i , y i , 0) corresponding to the initial point C i (x Di , y Di , z Di ); S206, calculate the first coordinate distance between the new coordinates D i (x Di , y Di , z Di ) and the target control points corresponding to the source control points A i (x i , y i ); S208, when the first coordinate distance is the minimum value, determine the rotation matrix R and the translation matrix T.
[0037] It should be noted that when expanding the cropped source control points A i (x i , y i ), the two - dimensional coordinates are converted into three - dimensional coordinates, and the z - axis coordinate is defaulted to 0, that is, the initial point C i (x i , y i,0). The Levenberg - Marquardt algorithm is an estimation method for the least - squares estimation of regression parameters in nonlinear regression. Through iterative calculation using the Levenberg - Marquardt algorithm, the minimum value of the first - coordinate distance is determined, and the rotation matrix R and translation matrix T are determined through the corresponding rotation - translation transformation matrix at this time.
[0038] New coordinate D i (x Di ,y Di ,z Di ) and the source control point A i (x i ,y i ) The calculation method of the first - coordinate distance corresponding to the target control point is specifically as follows: ; where d is the first - coordinate distance, x Bi and y Bi are the horizontal and vertical coordinates of the source control point A i (x i ,y i ) corresponding to the target control point B i .
[0039] According to the embodiment of the present invention, calculating the coordinates of the reference control point E i (x i ,y i ) corresponding to the source control point A includes: i (x 1i ,y 1i ,z 1i ) Performing rotation - translation transformation on the initial point C i (x i ,y i ,0) through the rotation matrix R and translation matrix T to determine the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ).
[0040] It should be noted that the initial points expanded for each source control point are calculated through the rotation matrix R and translation matrix T to determine the coordinates of their reference control points after rotation - translation transformation.
[0041] According to the embodiment of the present invention, the normalization operation steps are specifically as follows: Performing a normalization operation on the coordinates of the reference control point E i (x 1i ,y 1i ,z 1i ) to determine the normalized coordinates of the reference control point Fi (x 2i ,y 2i ); ; ; where f is a normalization coefficient.
[0042] It should be noted that through the normalization operation, the three-dimensional coordinates are converted into two-dimensional coordinates, which can eliminate the problem of numerical calculation instability caused by coordinate scale differences, simplify the calculation complexity, and improve the accuracy of subsequent calculations. Among them, the value of the normalization coefficient f is set by those skilled in the art according to actual needs.
[0043] According to an embodiment of the present invention, it further includes: Calculating the normalized reference control point coordinates F i (x 2i ,y 2i )'s deformation offset parameters d x and d y ; ; ; where k1, k2, p1, and p2 are all deformation coefficients.
[0044] It should be noted that the normalized reference control point coordinates F i (x 2i ,y 2i ) are input into the deformation offset parameter calculation formula preset in the system, and the deformation offset parameters d i (x 2i ,y 2i ) corresponding to the normalized reference control point coordinates F x and d y are output. Among them, the initial values of the deformation coefficients k1, k2, p1, and p2 are all set by those skilled in the art.
[0045] According to an embodiment of the present invention, it further includes that the specific affine transformation step is: Based on the deformation offset parameters d x and d y perform an affine transformation on the normalized reference control point coordinates F i (x 2i ,y 2i ) to determine the affine-transformed reference control point coordinates G i (x 3i ,y 3i ); ; ; where h1 and h2 are affine coefficients, and x b and y b are the reference horizontal and vertical coordinates of the target control points.
[0046] It should be noted that the normalized reference control point coordinates F i (x 2i , y 2i ) are input into the affine transformation formula preset in the system, and the reference control point coordinates G i (x 3i , y 3i ) after affine transformation are output, and accurate coordinate mapping is achieved by geometric transformation to make the reference control points adapt to the target space. Among them, the initial values of the affine coefficients h1 and h2 are set by those skilled in the art.
[0047] According to the embodiments of the present invention, it further includes: Iteratively optimizing relevant parameters, reference coordinates x b and y b through ceres; the relevant parameters include the rotation matrix R, the translation matrix T, the affine coefficients h1 and h2, and the deformation coefficients k1, k2, p1, and p2.
[0048] It should be noted that ceres is a library for nonlinear optimization. Given the initial values, by continuously calculating the offsets, the parameters to be optimized are moved in the direction of the minimum gradient of the objective function. In ceres, all source control points are used as inputs, and rotation and translation transformations, normalization operations, and affine transformations are repeated. The residuals between the reference control point coordinates after affine transformation and the corresponding actual target control point coordinates are calculated. Iterative calculations are performed using ceres to continuously update the rotation matrix R, the translation matrix T, the affine coefficients h1 and h2, the deformation coefficients k1, k2, p1, and p2, and the reference coordinates x b and y b , until the system preset iteration times are met or the residual is less than the system preset residual threshold. Thus, all relevant parameter calculations are completed.
[0049] The information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data 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 need to comply with the relevant laws, regulations, and standards of relevant countries and regions. For example, the "source control point set A", "target control point set B", etc. involved in this disclosure are all obtained under full authorization.
[0050] The present invention discloses a control point transformation method for image processing. The method includes: 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; calculating the reference coordinates (x b , y b ) of the target control points based on the coordinate limit positions of the target control points, and cropping all the source control points and target control points; analyzing the cropped source control points A i (x i , y i ) to determine the rotation matrix R and the translation matrix T, and calculating the reference control point coordinates E i (x i , y i ) corresponding to the source control points A i (x 1i , y 1i , z 1i ); sequentially performing a normalization operation and an affine transformation on the reference control point coordinates E i (x 1i , y 1i , z 1i ), and determining the affine-transformed reference control point coordinates G i (x 3i , y 3i ) as the final coordinates. By constructing a transformation relationship through control points, the transformation of other points can be efficiently completed, the matching and positioning effect of flexible workpieces can be improved, and the matching and positioning accuracy and reliability of flexible workpieces can be significantly improved.
[0051] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, 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 couplings, direct couplings, or communication connections between the components shown or discussed with each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be electrical, mechanical, or other forms.
[0052] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units; they can be located in one place or distributed to multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0053] In addition, in each embodiment of the present invention, each functional unit can be entirely integrated into one processing unit, or each unit can be separately regarded as one unit, or two or more units can be integrated into one unit; the above integrated unit can be implemented in the form of hardware, or in the form of a combination of hardware and software functional units.
[0054] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps including the above method embodiments; and the foregoing storage medium includes: removable storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks and other various media that can store program codes.
[0055] Alternatively, if the above integrated unit of the present invention is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiments of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in various embodiments of the present invention. And the foregoing storage medium includes: removable storage devices, ROM, RAM, magnetic disks, or optical disks and other various media that can store program codes.
Claims
1. A control point transformation method for image processing, characterized in that, Including: Obtain 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 positions of the target control points; the coordinate limit positions include the maximum value x of the x coordinate max , the minimum value x of the x coordinate min , the maximum value y of the y coordinate max and the minimum value y of the y coordinate min ; Calculate the reference coordinates (x b , y b ) of the target control point based on the coordinate limit positions of the target control point, and clip all source control points and target control points; According to the cropped source control point A i (x i ,y i ), analyze to determine the rotation matrix R and the translation matrix T, and calculate the coordinates E i (x i ,y i ) of the corresponding reference control point of the source control point A i (x 1i ,y 1i ,z 1i ); For the coordinates E of the reference control points i (x 1i , y 1i , z 1i ) perform normalization operations and affine transformations in sequence, and determine the coordinates G of the reference control points after affine transformation i (x 3i , y 3i ) as the final coordinates.
2. The control point transformation method for image processing according to claim 1, wherein Also including: Correspond the source control points in the source control point set A and the target control points in the target control point set B in sequence one by one.
3. The control point transformation method for image processing according to claim 1, wherein Calculating the reference coordinates (x b , y b ) of the target control point based on the coordinate limit positions of the target control point, including: Input the coordinate limit positions of the target control point into a preset reference coordinate calculation formula to determine the reference coordinates (x b , y b ) of the target control point; ; ; where p is a padding constant, x max , x min , y max and y min are respectively the maximum x - coordinate, the minimum x - coordinate, the maximum y - coordinate, and the minimum y - coordinate of the target control points in the target control point set B.
4. The control point transformation method for image processing according to claim 1, wherein, The clipping of all the source control points and target control points includes: Clip all source control points and target control points based on the coordinate limit positions of the target control points, and determine the coordinates (x c , y c ) of the control points after clipping; the control points after clipping include the source control points after clipping and the target control points after clipping; ; ; where p is a padding constant, x and y are the horizontal and vertical coordinates of the source control point or the target control point before cropping, x min and y min are the minimum x coordinate and the minimum y coordinate of the target control points in the target control point set B, respectively.
5. The control point transformation method for image processing according to claim 1, characterized in that, Said according to the cropped source control point A i (x i ,y i ) is analyzed to determine the rotation matrix R and the translation matrix T, including: For the cropped source control point A i (x i ,y i ), expand it to determine the initial point C i (x i ,y i ,0); Perform a rotation and translation transformation on the source control point set A through the Levenberg - Marquardt algorithm to determine the initial point C i (x i ,y i ,0) corresponding new coordinate D i (x Di ,y Di ,z Di ); Calculate the new coordinate D based on the xy coordinate difference i (x Di ,y Di ,z Di ) and the first coordinate distance between the source control point A i (x i ,y i ) and the corresponding target control point; When the first coordinate distance is the minimum value, determine the rotation matrix R and the translation matrix T.
6. The control point transformation method for image processing according to claim 5, wherein, Calculating the source control point A i (x i , y i ) corresponding to the reference control point coordinates E i (x 1i , y 1i , z 1i ), including: Perform a rotation and translation transformation on the initial point C through the rotation matrix R and the translation matrix T i (x i ,y i ,0) to determine the coordinates E of the reference control point i (x 1i ,y 1i ,z 1i ).
7. The control point transformation method for image processing according to claim 1, characterized in that Also including, the normalization operation specifically is: For the coordinates E of the reference control point i (x 1i , y 1i , z 1i ), perform a normalization operation to determine the normalized coordinates F of the reference control point i (x 2i , y 2i ); ; ; Wherein, f is the normalization coefficient.
8. The control point transformation method for image processing according to claim 7, wherein Also including: Calculate the normalized reference control point coordinates F i (x 2i ,y 2i ) deformation offset parameter d x and d y ; ; ; Wherein, k1, k2, p1 and p2 are all deformation coefficients.
9. The control point transformation method for image processing according to claim 8, characterized in that, Also including, the affine transformation specifically is: Based on the deformation offset parameter d x and d y perform an affine transformation on the normalized reference control point coordinates F i (x 2i , y 2i ) to determine the reference control point coordinates G i (x 3i , y 3i ) after the affine transformation; ; ; where h1 and h2 are affine coefficients, and x b and y b are the reference horizontal and vertical coordinates of the target control points.
10. The control point transformation method for image processing according to claim 1, wherein Also including: Iteratively optimize relevant parameters and the reference coordinate x through Ceres b and y b ; 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
A high-precision binocular camera calibration method
CN109598762A
Face image adjusting method and device, equipment and medium
CN119672773A
Mass morphing system and method
US7623996B1