An approximately symmetric profile registration method and system

By combining a contour registration method based on morphological analysis with the ICP algorithm, the problems of slow registration speed and poor stability of approximately symmetrical products are solved, and fast and accurate contour registration is achieved.

CN118864543BActive Publication Date: 2026-11-27HANGZHOU HUICUI INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410801696.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2026-11-27
Estimated Expiration
2044-06-20

AI Technical Summary

Technical Problem

Existing technologies are slow and unstable in the profile registration of approximately symmetrical products. Conventional methods are difficult to meet the requirements of industrial production, especially when the initial positions are too far apart and convergence is difficult.

Method used

A contour registration method based on morphological analysis is adopted. Coarse registration is performed by acquiring template information and orientation information of the target to be registered. Iterative optimization is combined with ICP algorithm to quickly determine the rotation matrix and translation matrix to achieve accurate registration.

Benefits of technology

It ensures the accuracy and stability of the contour registration direction, significantly improves the registration speed and accuracy, reduces the number of iterations, and meets the needs of industrial production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118864543B_ABST
    Figure CN118864543B_ABST
Patent Text Reader

Abstract

The application discloses a kind of approximate symmetrical contour registration methods, which comprises: S1, the template information of image to be registered is obtained, including template contour point set, template center point coordinate, template length, template width, template length-width ratio, template angle;S2, the image to be registered is segmented and calculated, the target information obtained in S1 is combined to filter workpiece connected domain, the contour point set of workpiece connected domain is extracted to obtain contour point set, the image is rotated and the angle before rotation is recorded relative to the angle after rotation;S3, correct the target to be registered, so that the target to be registered is in one direction with template, and the orientation information of the target to be registered is obtained;S4, the template information obtained in S1 and the orientation information of target are used for coarse registration, and the registration result is obtained.The application uses the orientation information between the template contour and the contour of the target to be registered for coarse registration, calculates the initial rotation matrix and the initial offset matrix, and performs fast registration on the template contour and the contour of the target to be registered, which can ensure the accuracy of registration and greatly improve the registration speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of contour registration, and more particularly to an approximately symmetrical contour registration method and system. Background Technology

[0002] In the industrial sector, many products have approximately symmetrical contours, and there may be a need to align these contours during the manufacturing process. For example, a robotic arm needs to pick up approximately symmetrical workpieces and place them into a designated mold. This requires aligning the contours of the mold and the workpiece. Because the product contours are approximately symmetrical, it is very easy to misalign them, causing the workpiece to be unable to be placed into the mold correctly.

[0003] There are three main types of conventional image registration methods: gray-scale-based matching algorithms, feature-based matching algorithms, and relation-based matching algorithms.

[0004] Conventional registration algorithms perform well when the features of the object being registered are obvious, but they are not very stable when registering near-symmetrical target contours and often match the wrong direction.

[0005] For scenarios requiring high-precision registration, conventional registration methods are often limited by image quality and the quality of the product itself, and thus often fail to achieve optimal registration results. Currently, algorithms that can ensure accuracy mainly rely on iterative optimization, such as the ICP algorithm. The ICP algorithm iterates step by step between two unregistered contours until they are fully registered. However, iterative methods are usually very slow and cannot meet the requirements of industrial production. Furthermore, if the initial positions of the registration template and the registration target are too far apart, convergence is often difficult to achieve. Summary of the Invention

[0006] The purpose of this invention is to provide an approximately symmetrical contour registration method and system to solve the problem of slow speed in existing iterative registration methods.

[0007] On one hand, embodiments of the present invention provide an approximately symmetrical contour registration method, comprising the following steps:

[0008] S1, obtain the template information of the image to be registered, including the template contour point set, template center point coordinates (cx1, cy1), template length, template width, template aspect ratio, and template angle1;

[0009] S2, segment and calculate the image to be registered, filter the workpiece connected components based on the target information obtained in S1, extract the contour of the workpiece connected components to obtain the contour point set contour2, rotate the image and record the angle2 before rotation relative to the rotation after rotation.

[0010] S3, correct the target to be registered so that the target to be registered is in the same orientation as the template, and obtain the orientation information of the target to be registered;

[0011] S4. Using the template information and target orientation information obtained in S1, coarse registration is performed to obtain the registration result.

[0012] Furthermore, S1 also includes:

[0013] S1-1, Read in the original image to be registered, and select the ROI region of the template;

[0014] S1-2, binarize the ROI region to obtain a binary map;

[0015] S1-3, retain the largest connected component in the binary image as the template binary image;

[0016] S1-4: Extract the contour of the largest connected component as the template contour to obtain the contour point set contour1;

[0017] S1-5, calculate the rotational bounding moment of the template, and calculate the center point (cx1, cy1), length, width, and aspect ratio respectively;

[0018] S1-6, calculate the angle of the rotation encirclement moment, straighten the workpiece according to the rotation angle, and record the angle1 of the template before straightening relative to the template after straightening.

[0019] S1-7, perform morphological analysis on the template after rotation and update the angle before rotation relative to the angle after rotation.

[0020] Furthermore, S1-7 also includes:

[0021] S1-7-1, Determine the orientation of the workpiece: Cut the image in S1-6 in half vertically or horizontally, and count the number of white pixels in the two images after cutting to determine the orientation. The half of the image with more white pixels is the bottom of the template, and the half of the image with fewer white pixels is the top of the template.

[0022] S1-7-2, if the number of pixels in the upper region of the template is greater than the number of pixels in the lower region, then update the template angle angle1. The updated template angle angle1 is the angle recorded in S1-6 plus 180 degrees.

[0023] Furthermore, S2 also includes:

[0024] S2-1, For the template ROI region selected in S1-1, threshold segmentation of the workpieces in the ROI region;

[0025] S2-2, set the minimum area and the maximum area, and search for connected components whose area is greater than the set minimum area and less than the set maximum area;

[0026] S2-3, extract the minimum bounding box for each retrieved connected region and obtain the binary image within the minimum bounding box;

[0027] S2-4: Retain the largest connected component in the minimum bounding box binary graph and use it as the workpiece binary graph;

[0028] S2-5, calculate the rotational bounding moment of the workpiece binary image, and calculate the template center point (x2, y2), template length, template width and template aspect ratio respectively;

[0029] S2-6, combining the template center point coordinates (cx1, cy1), template length, template width, template aspect ratio, and the parameters obtained in S2-5, determine whether the workpiece binary graph is a connected component of the workpiece;

[0030] S2-7: If the binary graph of the workpiece is not a connected component of the workpiece, return to S4 and calculate other connected components; if the binary graph of the workpiece is a connected component of the workpiece, extract the contour of the connected component of the workpiece and obtain the contour point set contour2.

[0031] S2-8, calculate the angle of the rotation bounding moment, straighten the image according to the rotation angle, and record the angle before straightening relative to the straightened image angle2.

[0032] Furthermore, S2 also includes:

[0033] Whether the binary graph of the workpiece in S2-6 is a connected component of the workpiece includes:

[0034] If the workpiece dimensions meet the following conditions:

[0035] (1) |Connected domain length - Template length| < Set minimum size deviation;

[0036] (2) |Connection width - Template width| < Set minimum size deviation;

[0037] (3) |Aspect ratio of connected components - Aspect ratio of template| < set minimum proportional deviation;

[0038] This indicates that the binary graph of the workpiece is a connected region of the workpiece.

[0039] Furthermore, S3 also includes:

[0040] S3-1, Determine the orientation of the target to be registered;

[0041] S3-2, If the number of pixels in the upper region of the target to be registered is greater than the number of pixels in the lower region, then update the angle angle2 before rotation relative to after rotation.

[0042] S3-3, calculate the curvature theta1 of the template contour relative to the workpiece contour.

[0043] Furthermore, in S3-2, the angle angle2 before rotation relative to after rotation is updated to the original angle before rotation relative to after rotation plus 180 degrees.

[0044] Furthermore, in step 3-3, the formula for calculating the curvature theta1 of the template contour relative to the workpiece contour is:

[0045]

[0046] In the formula, angle1 is the angle before rotation relative to after rotation.

[0047] Furthermore, S4 also includes:

[0048] S4-1, rotate the center point of the template outline by radians theta1 to obtain the rotated center point of the template outline (cx1', cx2'). The rotation formula is:

[0049] cx1'=cos(theta1)×cx1-sin(theta1)×cy1

[0050] cy1'=sin(theta1)×cx1+cos(theta1)×cy1

[0051] S4-2, Calculate the deviation between the center point of the template and the center point of the workpiece after rotation. The formula for calculating the deviation is:

[0052] dx = cx2 - cx1'

[0053] dy = cy2 - cy1'

[0054] Where dx represents the pixel offset between the horizontal coordinate of the template center and the horizontal coordinate of the workpiece center after rotation, and dy represents the pixel offset between the vertical coordinate of the template center and the vertical coordinate of the workpiece center after rotation.

[0055] S4-3: Coarse registration. The template contour point set contour1 is translated by deviations dx and dy, and rotated by radians theta1. The template contour point set contour1' is updated. The relationship between any point (x', y') in the point set contour1' and the corresponding point (x, y) in the original point set contour1 is:

[0056] x'=cos(theta1)×x-sin(theta1)×y+dx

[0057] y'=sin(theta1)×x+cos(theta1)×y+dy

[0058] S4-4: Normalize the set of contour points to be registered, contour2, to obtain the normalized workpiece contour point set norm_contour2. The relationship between any point (x', y') in norm_contour2 and the corresponding point (x, y) in the original point set contour2 is as follows:

[0059] x'=x-cx2

[0060] y'=y-cy2

[0061] Where (cx2, cy2) are the center points of the workpiece contour;

[0062] S4-5, ICP iteratively calculates the rotation and translation matrices, and initializes the rotation matrix R and translation matrix T:

[0063]

[0064] S4-6, Calculate the center point (cx1', cx2') of the template contour in the current iteration;

[0065] S4-7: Normalize the template contour points to obtain norm_contour1. The normalization formula for the template contour points is the same as that in S16.

[0066] S4-8: Calculate the radian dtheta for a single iteration. The formula for calculating radians (derived from ICP):

[0067]

[0068] in, For normalized template contour points, The normalized workpiece contour point that is closest to the normalized template contour point;

[0069] S4-9, Calculate the rotation matrix for a single iteration:

[0070]

[0071] S4-10, Calculate the translation matrix for a single iteration:

[0072]

[0073] S4-11: Update the template contour point set contour1'. The formula for calculating the value of any point (x', y') in the updated template contour points and the corresponding point (x, y) in the original point set is as follows:

[0074]

[0075] S4-12: Update the total rotation matrix R and translation matrix T:

[0076] R = deltR × R

[0077] T = deltR × T + deltT

[0078] S4-13: Calculate the distance between the template contour point set contour1' and the workpiece contour point set contour2. The distance is calculated by finding the shortest distance from each point in contour1' to contour2 and taking the average value.

[0079] S4-14: Determine whether to stop iteration; otherwise, jump to S18 to continue iteration. Stop iteration condition:

[0080] (1) The number of iterations is greater than the set number;

[0081] (2) The iteration distance is less than the set value;

[0082] S4-15: Integrate theta1, dx, and dy obtained during coarse registration into R and T obtained during fine registration, and update R and T.

[0083]

[0084] S4-16: Output the rotation matrix R and translation matrix T as the registration result to complete the registration.

[0085] The beneficial effects of the present invention are as follows: By constructing a registration method based on morphological analysis, the present invention effectively ensures that the registration direction of the target is not wrong and also ensures that the wrong target is registered, thereby improving the stability of registration;

[0086] This invention utilizes the orientation information between the pre-acquired template contour and the target contour to be registered for coarse registration, calculates the preliminary rotation matrix and preliminary offset matrix to quickly register the template contour and the target contour to be registered. By combining coarse registration with the ICP algorithm, convergence can be completed with fewer iterations, which can ensure the accuracy of registration and greatly improve the registration speed. Attached Figure Description

[0087] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:

[0088] Figure 1 This is a schematic diagram of the overall process of the approximately symmetrical contour registration method provided in the embodiments of the present invention;

[0089] Figure 2 This is a schematic diagram of the registration process of the approximately symmetrical contour registration method provided in this embodiment of the invention;

[0090] Figure 3 This is a schematic diagram of the registration process in the approximately symmetrical contour registration method provided in this embodiment of the invention.

[0091] Figure 4 This is a schematic diagram of a leaf workpiece in an embodiment of the present invention. Detailed Implementation

[0092] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0093] In the description of this specification, the terms "comprising," "including," "having," and "containing" are open-ended terms, meaning that they include but are not limited to. The terms "an embodiment," "a specific embodiment," "some embodiments," and "for example," etc., refer to specific features, structures, or characteristics described in connection with that embodiment or example that are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, or characteristics described can be combined in any suitable manner in one or more embodiments or examples. The order of steps involved in the various embodiments is used to illustrate the implementation of this application, and the order of steps is not limited and can be adjusted appropriately as needed.

[0094] This invention provides an approximately symmetrical contour registration method. Figure 1 This is a schematic diagram of the overall process of the method, which includes a registration stage and a registration stage, such as... Figure 2 As shown, the registration process is used to obtain template information, such as... Figure 3 As shown, the registration step is used to register the image by calling the template information obtained in the registration step.

[0095] The processing object applicable to this invention is approximately symmetrical image, which is defined as an image that satisfies the following conditions:

[0096] Extract the minimum rotation bounding moment from the target image. Divide the target image into two parts, S1 and S2, according to the central axis of the width or height of the minimum rotation bounding moment. Mirror one of the parts, S1, along the central axis to obtain S1'. If a logical XOR operation is performed on S1' and S2 to obtain the pixel areas that differ, and if the pixel areas that differ are less than a set value, then the image is considered approximately symmetrical.

[0097] like Figure 4 As shown, the algorithm steps are illustrated using an apple leaf artwork as an example of the image to be registered. The apple leaf artwork has a thicker base and a thinner top, with an approximately symmetrical outline.

[0098] like Figure 1 As shown, the method includes the following steps:

[0099] S1, obtain the template information of the image to be registered, including the template contour point set, template center point coordinates (cx1, cy1), template length, template width, template aspect ratio, and template angle1;

[0100] Specifically, S1 also includes the following steps:

[0101] S1-1, Read in the original image to be registered, and select the ROI region of the template;

[0102] S1-2, binarize the ROI region;

[0103] S1-3 preserves the largest connected component in the binary image and uses it as the template binary image.

[0104] S1-4: Extract the contour of the largest connected component, use it as the template contour, and save the contour point set contour1;

[0105] S1-5, calculate the rotational bounding moment of the template, and calculate the center point (cx1, cy1), length, width, and aspect ratio respectively;

[0106] The center point is used for coarse registration, while the length, width, and aspect ratio are used for contour filtering.

[0107] S1-6, calculate the angle of the rotational encirclement moment, and straighten the workpiece according to the rotational angle;

[0108] Specifically, record the angle angle1 before rotation relative to after rotation.

[0109] S1-7, perform morphological analysis on the template after rotation and update the angle before rotation relative to the angle after rotation;

[0110] The actual orientation of the template after rotation cannot be determined, therefore morphological analysis is required. The morphological analysis of the template includes the following steps:

[0111] S1-7-1, Determine the orientation of the workpiece.

[0112] Specifically, the image in S1-6 is cut in half vertically or horizontally, and the number of white pixels in the two cut images is counted to determine the orientation. The following analysis examines the upper and lower regions of the rotated template, counting the number of white pixels in each region. The region with more white pixels is the bottom of the template, and the region with fewer white pixels is the top of the template.

[0113] S1-7-2, If the number of pixels in the upper region of the template is greater than the number of pixels in the lower region, then update angle1;

[0114] angle1 = angle1 + 180

[0115] S1-8, complete registration and obtain the template outline point set, template center point coordinates (cx1, cy1), template length, template width, template aspect ratio, and template angle1.

[0116] S2, filter the targets to be registered to obtain the targets to be matched, and extract the contour points of the targets to be matched to obtain contour2;

[0117] Specifically, the target to be matched is obtained by filtering, and then the contour point set contour2 of the target to be matched is extracted. Considering that there may be multiple targets to be matched, multiple contour point sets contour2 can be obtained to form a contour set. The contour set to be matched is obtained through S2 and the contour set is registered in subsequent steps.

[0118] S2 also includes the following steps:

[0119] S2-1, Select the image to be registered, and select the ROI region for registration.

[0120] S2-2, Threshold segmentation of ROI regions for workpieces.

[0121] S2-3, search for connected components whose areas meet the requirements: minimum area < connected component area < maximum area.

[0122] S2-4: Extract the minimum bounding box for each retrieved connected region and obtain the binary image within the minimum bounding box.

[0123] S2-5 preserves the largest connected region in the minimum bounding box binary graph, which is the workpiece binary graph.

[0124] S2-6, calculate the rotational encirclement moment of the workpiece, and calculate the center point (x2, y2), length, width, and aspect ratio respectively.

[0125] S2-7, combining the template center point coordinates (cx1, cy1), template length, template width, template aspect ratio, and the parameters obtained from S2-6, determines whether it is a connected component of the workpiece. The workpiece dimensions must meet the following conditions:

[0126] (1) | Length of connected component - Length of template | < Set minimum size deviation

[0127] (2) |Connection width - Template width| < Set minimum size deviation

[0128] (3) |Aspect ratio of connected components - Aspect ratio of template| < Set minimum proportional deviation

[0129] S2-8: If the dimensions do not conform to the rules, return to S4 to calculate other connected components. If they meet the requirements, extract the contour of the workpiece's connected components and obtain the contour point set contour2.

[0130] S2-9, calculate the rotational encirclement angle, and straighten the workpiece according to the rotation angle. (At this time, the upper and lower ends of the workpiece cannot be distinguished; it could be the tip of a leaf or the root of a leaf.)

[0131] Record the angle angle2 before rotation relative to the angle after rotation.

[0132] S3, correct the target to be registered so that the target is aligned with the template in the same orientation, and obtain the target's orientation information;

[0133] S3-1, Determine the orientation of the workpiece. (Method is the same as S2-7 in the registration process)

[0134] S3-2, If the number of pixels in the upper region of the image is greater than the number of pixels in the lower region, then update angle2.

[0135] angle2 = angle2 + 180

[0136] S3-3, Calculate the curvature theta1 of the template contour relative to the workpiece contour. The calculation formula is:

[0137]

[0138] S4. Using the template information and target orientation information obtained in S1, coarse registration is performed to obtain the registration result.

[0139] S4-1, rotate the center point of the template outline by radians theta1 to obtain the rotated center point of the template outline (cx1', cx2'). The rotation formula is:

[0140] cx1'=cos(theta1)×cx1-sin(theta1)×cy1

[0141] cy1'=sin(theta1)×cx1+cos(theta1)×cy1

[0142] S4-2, Calculate the deviation between the center point of the template and the center point of the workpiece after rotation. The formula for calculating the deviation is:

[0143] dx = cx2 - cx1'

[0144] dy = cy2 - cy1'

[0145] Where dx represents the pixel offset between the horizontal coordinate of the template center and the horizontal coordinate of the workpiece center after rotation, and dy represents the pixel offset between the vertical coordinate of the template center and the vertical coordinate of the workpiece center after rotation.

[0146] S4-3: Coarse registration. The template contour point set contour1 is translated by deviations dx and dy, and rotated by radians theta1. The template contour point set contour1' is updated. The relationship between any point (x', y') in the point set contour1' and the corresponding point (x, y) in the original point set contour1 is:

[0147] x'=cos(theta1)×x-sin(theta1)×y+dx

[0148] y'=sin(theta1)×x+cos(theta1)×y+dy

[0149] S4-4: Normalize the set of contour points to be registered, contour2, to obtain the normalized workpiece contour point set norm_contour2. The relationship between any point (x', y') in norm_contour2 and the corresponding point (x, y) in the original point set contour2 is as follows:

[0150] x'=x-cx2

[0151] y'=y-cy2

[0152] Where (cx2, cy2) are the center points of the workpiece contour.

[0153] S4-5, ICP iteratively calculates the rotation and translation matrices, and initializes the rotation matrix R and translation matrix T:

[0154]

[0155]

[0156] S4-6, Calculate the center point (cx1', cx2') of the template contour in the current iteration.

[0157] S4-7: Normalize the template contour points to obtain norm_contour1. The normalization formula for the template contour points is the same as that in S16.

[0158] S4-8: Calculate the radian dtheta for a single iteration. The formula for calculating radians (derived from ICP):

[0159]

[0160] in, For normalized template contour points, It is the normalized workpiece contour point that is closest to the normalized template contour point.

[0161] S4-9, Calculate the rotation matrix for a single iteration:

[0162]

[0163] S4-10, Calculate the translation matrix for a single iteration:

[0164]

[0165] S4-11: Update the template contour point set contour1'. The formula for calculating the value of any point (x', y') in the updated template contour points and the corresponding point (x, y) in the original point set is as follows:

[0166]

[0167] S4-12: Update the total rotation matrix R and translation matrix T:

[0168] R = deltR × R

[0169] T = deltR × T + deltT

[0170] S4-13: Calculate the distance between the template contour point set contour1' and the workpiece contour point set contour2. The distance is calculated by finding the shortest distance from each point in contour1' to contour2 and taking the average value.

[0171] S4-14: Determine whether to stop iteration; otherwise, jump to S18 to continue iteration. Stop iteration condition:

[0172] (1) The number of iterations is greater than the set number.

[0173] (2) The iteration distance is less than the set value

[0174] S4-15: Integrate theta1, dx, and dy obtained during coarse registration into R and T obtained during fine registration, and update R and T.

[0175]

[0176] S4-16: Output the rotation matrix R and translation matrix T as the registration result to complete the registration.

[0177] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0178] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0179] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0180] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0181] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for approximately symmetrical contour registration, characterized in that, Includes the following steps: S1, obtain the template information of the image to be registered, including the template contour point set, template center point coordinates (cx1, cy1), template length, template width, template aspect ratio, and template angle1; S2, segment and calculate the image to be registered, filter the connected components of the workpiece by combining the template information obtained in S1, extract the contour of the connected components of the workpiece to obtain the contour point set contour2, straighten the image and record the angle2 before straightening relative to the straightened image. S3, correct the target to be registered so that the target and the template are in the same orientation, and obtain the orientation information of the target to be registered; S4. Using the template information and target orientation information obtained in S1, coarse registration is performed to obtain the registration result; S1 further includes: S1-1, Read in the original image to be registered, and select the ROI region of the template; S1-2, binarize the ROI region to obtain a binary map; S1-3, retain the largest connected component in the binary image as the template binary image; S1-4: Extract the contour of the largest connected component as the template contour to obtain the contour point set contour1; S1-5, calculate the rotational bounding moment of the template, and calculate the center point (cx1, cy1), length, width, and aspect ratio respectively; S1-6, calculate the angle of the rotation encirclement moment, straighten the workpiece according to the rotation angle, and record the angle1 of the template before straightening relative to the template after straightening. S1-7, perform morphological analysis on the template after rotation and update the angle before rotation relative to the angle after rotation; S1-7 further includes: S1-7-1, Determine the orientation of the workpiece: Cut the image in S1-6 in half vertically or horizontally, and count the number of white pixels in the two images after cutting to determine the orientation. The half of the image with more white pixels is the bottom of the template, and the half of the image with fewer white pixels is the top of the template. S1-7-2, If the number of pixels in the upper region of the template is greater than the number of pixels in the lower region, then update the template angle angle1. The updated template angle angle1 is the angle recorded in S1-6 plus 180 degrees. S4 further includes: S4-1, rotate the center point of the template outline by radians theta1 to obtain the rotated center point of the template outline (cx1', cy1'). The rotation formula is: ; ; S4-2, Calculate the deviation between the center point of the template and the center point of the workpiece after rotation. The formula for calculating the deviation is: ; ; Where dx represents the pixel offset between the horizontal coordinate of the template center and the horizontal coordinate of the workpiece center after rotation, and dy represents the pixel offset between the vertical coordinate of the template center and the vertical coordinate of the workpiece center after rotation. S4-3: Coarse registration. The template contour point set contour1 is translated by deviations dx and dy, and rotated by radians theta1. The template contour point set contour1' is updated. The relationship between any point (x', y') in the point set contour1' and the corresponding point (x, y) in the original point set contour1 is: ; ; S4-4: Normalize the set of contour points to be registered, contour2, to obtain the normalized workpiece contour point set norm_contour2. The relationship between any point (x', y') in norm_contour2 and the corresponding point (x, y) in the original point set contour2 is as follows: ; ; Where (cx2, cy2) are the center points of the workpiece contour; S4-5, ICP iteratively calculates the rotation and translation matrices, and initializes the rotation matrix R and translation matrix T: ; ; S4-6, Calculate the center point (cx1', cy1') of the template contour in the current iteration. S4-7: Normalize the template contour points to obtain norm_contour1. The normalization formula for the template contour points is the same as that in S4-4. S4-8: Calculate the radian dtheta for a single iteration. The formula for calculating radians is derived from ICP: ; in, For normalized template contour points, The normalized workpiece contour point that is closest to the normalized template contour point; S4-9, Calculate the rotation matrix for a single iteration: ; S4-10, Calculate the translation matrix for a single iteration: ; S4-11: Update the template contour point set contour1'. The formula for calculating the value of any point (x', y') in the updated template contour points and the corresponding point (x, y) in the original point set is as follows: ; S4-12: Update the total rotation matrix R and translation matrix T: ; ; S4-13: Calculate the distance between the template contour point set contour1' and the workpiece contour point set contour2. The distance is calculated by finding the shortest distance from each point in contour1' to contour2 and taking the average value. S4-14: Determine whether to stop iteration; otherwise, jump to S4-6 to continue iteration. Stop iteration condition: (1) The number of iterations is greater than the set number; (2) The iteration distance is less than the set value; S4-15: Integrate theta1, dx, and dy obtained during coarse registration into R and T obtained during fine registration, and update R and T; ; ; S4-16: Output the rotation matrix R and translation matrix T as the registration result to complete the registration.

2. The approximately symmetrical contour registration method as described in claim 1, characterized in that, S2 further includes: S2-1, For the template ROI region selected in S1-1, threshold segmentation of the workpieces in the ROI region; S2-2, set the minimum area and the maximum area, and search for connected components whose area is greater than the set minimum area and less than the set maximum area; S2-3, extract the minimum bounding box for each retrieved connected region and obtain the binary image within the minimum bounding box; S2-4: Retain the largest connected component in the minimum bounding box binary graph and use it as the workpiece binary graph; S2-5, calculate the rotational bounding moment of the workpiece binary image, and calculate the template center point (x2, y2), template length, template width and template aspect ratio respectively; S2-6, combining the template center point coordinates (cx1, cy1), template length, template width, template aspect ratio, and the parameters obtained in S2-5, determine whether the workpiece binary graph is a connected component of the workpiece; S2-7: If the binary graph of the workpiece is not a connected component of the workpiece, return to S4 and calculate other connected components; if the binary graph of the workpiece is a connected component of the workpiece, extract the contour of the connected component of the workpiece and obtain the contour point set contour2. S2-8, calculate the angle of the rotation bounding moment, straighten the image according to the rotation angle, and record the angle before straightening relative to the straightened image angle2.

3. The approximately symmetrical contour registration method as described in claim 2, characterized in that, S2 further includes: Whether the binary graph of the workpiece in S2-6 is a connected component of the workpiece includes: If the workpiece dimensions meet the following conditions: (1) |Connected Component Length - Template Length| < Set minimum size deviation; (2) |Connected domain width - Template width| < Set minimum size deviation; (3) |Aspect Ratio of Connected Components - Aspect Ratio of Template| < Set minimum proportional deviation; This indicates that the binary graph of the workpiece is a connected region of the workpiece.

4. The approximately symmetrical contour registration method as described in claim 1, characterized in that, S3 further includes: S3-1, Determine the orientation of the target to be registered; S3-2, If the number of pixels in the upper region of the target to be registered is greater than the number of pixels in the lower region, then update the angle angle2 before rotation relative to after rotation. S3-3, calculate the curvature theta1 of the template contour relative to the workpiece contour.

5. The approximately symmetrical contour registration method as described in claim 4, characterized in that, In step S3-2, the angle angle2 before rotation relative to after rotation is updated to the original angle before rotation relative to after rotation plus 180 degrees.

6. The approximately symmetrical contour registration method as described in claim 4, characterized in that, In S3-3, the formula for calculating the curvature theta1 of the template contour relative to the workpiece contour is: ; In the formula, angle1 is the angle before rotation relative to after rotation.

Citation Information

Patent Citations

  • Method and apparatus for generating fiducial via die cutting

    CN111278615A

  • Property management method and device based on image processing

    CN116246265A