A similarity detection method of a three-dimensional model and an electronic device
By adjusting the pose and rigidly registering the 3D model, the problem of low accuracy caused by manual annotation in the existing technology is solved, and efficient and accurate 3D model similarity detection is achieved, which is applicable to complex structures and free-form surfaces.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG LAB
- Filing Date
- 2026-01-27
- Publication Date
- 2026-07-28
AI Technical Summary
Existing 3D model similarity detection methods rely on manually labeled descriptive text, resulting in low accuracy and efficiency, and failing to accurately reflect geometric shape and topological structure information.
By acquiring the pose adjustment of the 3D model, its principal axis is made to form a specified positional relationship with the coordinate system, point cloud is sampled, and the point cloud is transformed in a rigid registration manner to determine the similarity detection result.
It achieves similarity detection that is unaffected by the original pose of the 3D model, improves detection accuracy and efficiency, can capture features of complex structures and freeform surfaces, and expands the scope of application of the detection.
Smart Images

Figure CN121582613B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of digital design and manufacturing, and in particular to a method and electronic device for detecting the similarity of three-dimensional models. Background Technology
[0002] Currently, CAD (Computer-Aided Design) technology is widely used in product design, structural analysis, and manufacturing simulation, resulting in a large number of 3D models. Selecting models similar to specified 3D models from this vast pool is crucial for design reference and reuse, standardization management, and knowledge engineering.
[0003] Currently, the similarity between two 3D models is typically determined by the degree of similarity between their descriptive texts (such as names, functional descriptions, and geometric feature descriptions). However, this method requires manual annotation of the 3D model's descriptive text, which introduces human error into the similarity detection results, leading to low accuracy and efficiency. Furthermore, the descriptive text cannot accurately reflect the geometric and topological information of the 3D model, resulting in low accuracy of similarity detection results determined based on the descriptive text.
[0004] Therefore, there is a need to provide a similarity detection method for 3D models to improve detection accuracy and efficiency. Summary of the Invention
[0005] In view of this, this application provides a method for similarity detection of three-dimensional models, the method comprising: Obtain the three-dimensional model to be detected in a three-dimensional coordinate system; the three-dimensional model includes a specified three-dimensional model as the detection object and a candidate three-dimensional model as the object to be detected; The posture of the 3D model is adjusted so that the principal axis of the 3D model forms a specified positional relationship with any coordinate axis of the 3D coordinate system; the specified positional relationship includes parallel or perpendicular. The 3D model after attitude adjustment is sampled to obtain a sampled point cloud; the sampled point cloud includes a first point cloud corresponding to the specified 3D model and a second point cloud corresponding to the candidate 3D model; With the rigid registration of the first point cloud and the second point cloud as the target, a rigid transformation is performed on the second point cloud to obtain the second target point cloud; Based on the first point cloud and the second target point cloud, the similarity detection result between the specified 3D model and the candidate 3D model is determined.
[0006] Optionally, adjusting the pose of the 3D model so that the principal axis of the 3D model forms a specified positional relationship with any coordinate axis of the 3D coordinate system includes: Determine the normal vectors of each plane; the planes include the planes of the three-dimensional model body and the planes formed by the holes and slots on the three-dimensional model; Determine whether there exists an orthogonal first normal vector pair among the stated normal vectors; If it exists, then construct a rotation matrix using the first normal vector pair; If none exists, determine the area of each plane; based on the area, sort each plane in descending order; take the normal vectors of the two planes with the highest sort order as the second normal vector pair; and construct a rotation matrix using the second normal vector pair. The 3D model is rotated using the rotation matrix to adjust its posture.
[0007] Optionally, the step of performing a rigid transformation on the second point cloud to obtain a second target point cloud, with the rigid registration of the first point cloud and the second point cloud as the target, includes: The second point cloud is subjected to multiple rigid transformations to obtain each second candidate point cloud; The nearest neighbor error between the second candidate point cloud and the first point cloud is determined; the nearest neighbor error is used to characterize the degree of rigid registration between the second candidate point cloud and the first point cloud; the nearest neighbor error is negatively correlated with the degree of rigid registration. The smallest of the nearest neighbor errors is taken as the target nearest neighbor error; The second candidate point cloud corresponding to the nearest neighbor error of the target is taken as the second target point cloud.
[0008] Optionally, the step of performing multiple rigid transformations on the second point cloud to obtain each second candidate point cloud includes: Obtain a pre-constructed set of Euler angle combinations; the Euler angle combinations in the set of Euler angle combinations include Euler angles that correspond one-to-one with each of the coordinate axes; Take any Euler angle combination from the set of Euler angle combinations as the current Euler angle combination; The second point cloud is rotated sequentially around each of the coordinate axes by the Euler angles in the current Euler angle combination; The rotated second point cloud is translated so that the first designated point in the first point cloud coincides with the second designated point in the second point cloud, thus obtaining the second candidate point cloud; Take any unselected Euler angle combination from the set of Euler angle combinations as the current Euler angle combination; return to the step of rotating the second point cloud around each of the coordinate axes in turn the Euler angles in the current Euler angle combination until all Euler angle combinations are selected.
[0009] Optionally, determining the nearest neighbor error between the second candidate point cloud and the first point cloud includes: For each first sampling point in the first point cloud, the positive Euclidean distance between the first sampling point and each second sampling point in the second candidate point cloud is determined; and the smallest of the positive Euclidean distances is taken as the positive nearest neighbor distance corresponding to the first sampling point; the positive nearest neighbor distance corresponds one-to-one with the first sampling point; For each second sampling point, the reverse Euclidean distance between the second sampling point and each of the first sampling points is determined; and the smallest of the reverse Euclidean distances is taken as the reverse nearest neighbor distance corresponding to the second sampling point; the reverse nearest neighbor distance corresponds one-to-one with the second sampling point; The nearest neighbor error is determined based on the forward nearest neighbor distance and the reverse nearest neighbor distance.
[0010] Optionally, determining the nearest neighbor error based on the forward nearest neighbor distance and the reverse nearest neighbor distance includes: Determine a first average value for each of the forward nearest neighbor distances; and determine a second average value for each of the reverse nearest neighbor distances; The sum of the first average value and the second average value is taken as the nearest neighbor error.
[0011] Optionally, determining the similarity detection result between the specified 3D model and the candidate 3D model based on the first point cloud and the second target point cloud includes: For each first sampling point in the first point cloud, the Euclidean distance between the first sampling point and each sampling point in the second target point cloud is determined; the first sampling point whose Euclidean distance is less than a preset distance is taken as the overlapping sampling point. Determine the first total number of overlapping sampling points and the second total number of the first sampling points; Based on the first total number and the second total number, determine the proportion of the overlapping sampling points to the first sampling points; and determine whether the proportion is greater than a preset threshold. If so, the similarity between the specified 3D model and the candidate 3D model is taken as the similarity detection result; If not, then the specified 3D model is not similar to the candidate 3D model, and this is taken as the similarity detection result.
[0012] Optionally, obtain candidate 3D models, including: Retrieve historical 3D models from the historical model database; Extract geometric feature parameters; the geometric feature parameters include the first geometric feature parameters of the historical 3D model and the second geometric feature parameters of the specified 3D model; the geometric feature parameters include at least one of the following: total number of edges, total number of faces, total surface area, volume, and outer box dimensions; Determine the feature deviation value between the first geometric feature parameter and the second geometric feature parameter; The historical 3D models whose feature deviation values are all within the corresponding preset tolerance range are used as the candidate 3D models.
[0013] Optionally, sampling the 3D model after attitude adjustment to obtain a sampled point cloud includes: Obtain the pre-set number of edge sampling points and face sampling points; Determine the side length of each side, the area of each face, the total side length, and the total area of the three-dimensional model; Determine the proportion of the side length to the total side length; determine the number of side sampling points based on the side proportion and the number of side sampling points to be sampled; Determine the proportion of the area to the total area; determine the number of surface sampling points based on the proportion and the number of surface sampling points to be sampled. For the 3D model after attitude adjustment, the edges are uniformly sampled according to the number of edge sampling points, and the faces are uniformly sampled according to the number of face sampling points to obtain the sampling point cloud.
[0014] This application also provides an electronic device, including: Memory, used to store computer programs; A processor, configured to implement the steps of any of the above-described three-dimensional model similarity detection methods when executing the computer program.
[0015] In summary, this application provides a similarity detection method and electronic device for three-dimensional models. Firstly, after acquiring the three-dimensional model, its pose is adjusted so that the principal axis of the three-dimensional model forms a specified positional relationship with any coordinate axis of the three-dimensional coordinate system, achieving pose standardization. This ensures that the similarity detection results are not affected by the original pose of the three-dimensional model and facilitates subsequent rigid registration.
[0016] On the other hand, sampling the 3D model after attitude adjustment yields the first point cloud corresponding to the specified 3D model and the second point cloud corresponding to the candidate 3D model, providing a data foundation for determining similarity detection results from the perspective of geometry and topology. It can also capture the features of the 3D model in complex structures, fine structures and freeform surfaces, expanding the applicability of similarity detection methods.
[0017] On the other hand, with the rigid registration of the first and second point clouds as the goal, a rigid transformation is performed on the second point cloud to obtain the second target point cloud, further eliminating the negative impact of the original pose on the similarity detection results. Based on the first and second point clouds, the similarity detection results of the specified 3D model and the candidate 3D model are determined from the perspective of geometric shape and topology, and the similarity detection results are not affected by human intervention, thus improving the accuracy of the similarity detection results. Attached Figure Description
[0018] Figure 1 A flowchart illustrating a similarity detection method for a 3D model provided in this application; Figure 2 A schematic diagram of a specified three-dimensional model provided for this application; Figure 3 A first schematic diagram of a first point cloud provided in this application; Figure 4 A second schematic diagram of a first point cloud provided in this application; Figure 5 A schematic diagram of a specified three-dimensional model after attitude adjustment provided in this application; Figure 6 A schematic diagram of a candidate 3D model after attitude adjustment provided in this application; Figure 7 A schematic diagram of rigid registration of point clouds provided in this application; Figure 8 A schematic diagram of a set of Euler angle combinations provided in this application; Figure 9 This is a schematic diagram illustrating the principle of a similarity detection method for three-dimensional models provided in this application. Detailed Implementation
[0019] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0020] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0021] Please refer to Figure 1 , Figure 1 A flowchart illustrating a similarity detection method for three-dimensional models provided in this application is shown. The method includes: S101. Obtain the 3D model to be detected in the 3D coordinate system; the 3D model includes the specified 3D model as the detection object and the candidate 3D model as the object to be detected.
[0022] Both the specified 3D model and the candidate 3D model mentioned above are 3D CAD models. The specified 3D model is the object of inspection, and the candidate 3D model is the object to be inspected. The purpose is to detect whether the candidate 3D model is similar to the specified 3D model, which facilitates design reference, reuse, and standardized management.
[0023] The specified 3D model can be specified by the user, and the candidate 3D model can be extracted from the historical 3D model database. The specific implementation method of obtaining the candidate 3D model will be described in subsequent embodiments, and will not be elaborated here.
[0024] S102. Adjust the posture of the 3D model so that the principal axis of the 3D model forms a specified positional relationship with any coordinate axis of the 3D coordinate system; the specified positional relationship includes parallel or perpendicular.
[0025] Considering that the original pose of a 3D model in a 3D coordinate system is random, directly performing similarity detection on a specified 3D model and a candidate 3D model will cause the similarity detection results to be affected by the original pose of the 3D model, resulting in low accuracy.
[0026] Therefore, this application first performs pose standardization processing on the 3D model, that is, by adjusting the pose of the 3D model, it ensures that the principal axis of the 3D model is parallel or perpendicular to any coordinate axis of the 3D coordinate system. The specific implementation method of pose adjustment will be described in subsequent embodiments and will not be repeated here. In summary, by performing pose standardization processing, the subsequent similarity detection results are not affected by the original placement pose of the 3D model, thereby improving the accuracy of the similarity detection results.
[0027] S103. Sample the 3D model after attitude adjustment to obtain a sampled point cloud; the sampled point cloud includes the first point cloud corresponding to the specified 3D model and the second point cloud corresponding to the candidate 3D model.
[0028] When sampling the 3D model after attitude adjustment, sampling can be performed along the edges or faces of the 3D model; this application does not impose any particular limitation on this. Please refer to... Figure 2 , Figure 3 and Figure 4 , Figure 2 A schematic diagram of a specified three-dimensional model provided in this application. Figure 3 This application provides a first schematic diagram of a first point cloud. Figure 4 This is a second schematic diagram of a first point cloud provided in this application. Sampling along the edges of a specified 3D model yields, as shown below. Figure 3 The first point cloud shown; sampling along the surface of the specified 3D model can yield results such as... Figure 4 The first point cloud shown.
[0029] The aforementioned sampling point cloud can reflect the geometry and topology of a 3D model. In particular, for 3D models containing complex structures, fine structures, and freeform surfaces, the sampling point cloud can accurately reflect the geometry and topology of the 3D model at these complex, fine, and freeform surfaces, improving the accuracy of subsequent similarity detection results determined based on the sampling point cloud.
[0030] S104. With the rigid registration of the first point cloud and the second point cloud as the target, perform a rigid transformation on the second point cloud to obtain the second target point cloud.
[0031] In this application, the first point cloud is fixed, and only the second point cloud is rigidly transformed to make the first point cloud and the second point cloud rigidly registered; this is equivalent to adjusting the pose and position of the candidate 3D model based on the specified 3D model, so that the candidate 3D model is precisely aligned with the specified 3D model.
[0032] Rigid transformation of the second point cloud refers to adjusting its pose and translating its position so that the pose and position of the first and second point clouds are consistent in the 3D coordinate system, i.e., achieving rigid registration. Furthermore, since the aforementioned steps have already standardized the pose of the specified 3D model and the candidate 3D model, a finite number of rigid transformations on the second point cloud are sufficient to achieve rigid registration of the first and second point clouds, improving the efficiency of similarity detection. Please refer to... Figure 5 , Figure 6 and Figure 7 , Figure 5 This is a schematic diagram of a specified 3D model after attitude adjustment provided in this application. Figure 6 This is a schematic diagram of a candidate 3D model after attitude adjustment provided in this application. Figure 7 This is a schematic diagram of rigid registration of point clouds provided in this application. Figure 7 As shown, by performing a rigid transformation on the second point cloud, the pose of the second target point cloud is made consistent with the pose of the first point cloud, and the position of the second target point cloud is consistent with the position of the first point cloud. This means that the second target point cloud and the first point cloud are precisely aligned, which facilitates the subsequent accurate determination of similarity detection results based on the second target point cloud and the first point cloud.
[0033] The specific method for determining the second target point cloud will be explained in subsequent embodiments, and will not be elaborated here.
[0034] S105. Based on the first point cloud and the second target point cloud, determine the similarity detection results between the specified 3D model and the candidate 3D model.
[0035] Because the first point cloud and the second target point cloud are rigidly registered, determining the similarity detection result based on the first point cloud and the second target point cloud can further eliminate the negative impact of the original pose and position differences between the specified 3D model and the candidate 3D model on the similarity detection result. This allows the obtained similarity detection result to truly reflect the similarity between the specified 3D model and the candidate 3D model at the geometric and topological levels, further improving the accuracy of the similarity detection result. The specific implementation method for determining the similarity detection result based on the first point cloud and the second target point cloud will be described in subsequent embodiments and will not be elaborated here.
[0036] like Figure 7 As shown, the first point cloud and the second target point cloud are rigidly registered, and their poses and positions are consistent. Therefore, the distance between the sampling points in the first point cloud and the second target point cloud accurately reflects the differences between the specified 3D model and the candidate 3D model in terms of geometry and topology. Figure 7 In this context, the warmer the color of a sampling point, the greater the difference in geometry and topology between the specified 3D model and the candidate 3D model at that sampling point.
[0037] In summary, on the one hand, after obtaining the 3D model, this application first adjusts the pose of the 3D model to achieve pose standardization, so that the similarity detection results are not affected by the original pose of the 3D model and facilitate subsequent rigid registration. On the other hand, the 3D model after pose adjustment is sampled to obtain a first point cloud and a second point cloud, providing a data foundation for determining the similarity detection results from the geometric and topological levels, and capturing the features of the 3D model at complex structures, fine structures, and freeform surfaces, thus expanding the applicability of the similarity detection method. Furthermore, with the rigid registration of the first and second point clouds as the goal, a rigid transformation is performed on the second point cloud to obtain a second target point cloud, further eliminating the negative impact of the original pose on the similarity detection results. The similarity detection results are determined from the geometric and topological levels based on the first and second point clouds, and the similarity detection results are not affected by human intervention, thus improving the accuracy of the similarity detection results.
[0038] Based on the above embodiments: The following section details the specific implementation of pose standardization processing for 3D models.
[0039] As an optional embodiment, the pose of the 3D model is adjusted so that the principal axis of the 3D model forms a specified positional relationship with any coordinate axis of the 3D coordinate system, including: Determine the normal vectors of each plane; the planes include the planes of the 3D model body and the planes formed by the holes and slots on the 3D model; Determine whether there exists an orthogonal first normal vector pair among all normal vectors; If it exists, then construct the rotation matrix using the first normal vector pair; If it does not exist, determine the area of each plane; based on the area, sort the planes in descending order; take the normal vectors of the two planes with the highest sort order as the second normal vector pair; and construct the rotation matrix using the second normal vector pair. Rotation matrices are used to rotate the 3D model in order to adjust its pose.
[0040] First, traverse all planes of the 3D model and determine their normal vectors for pose normalization. It's important to note that planes include those of the 3D model itself, as well as those formed by holes and slots on the model. For example, when traversing the edges of the 3D model, if an edge is a closed loop (like a circle), the plane formed by that loop can be considered as a plane formed by holes and slots, and its normal vector can be determined. Furthermore, normal vectors with opposite directions can be considered as the same normal vector.
[0041] From the above normal vectors, determine the first orthogonal normal vector pair, and construct a rotation matrix using the first normal vector pair. As an optional embodiment, the normal vector with the largest area in the first normal vector pair is taken as the first normal vector. Take another normal vector as the second normal vector. For the first normal vector After normalization, we get ; the first normal vector Second normal vector Performing a cross product, we get ;Will and Performing a cross product, we get Finally, the rotation matrix is obtained. .
[0042] If there is no orthogonal first normal vector pair among the above normal vectors, then determine the area of each plane; sort the planes in descending order based on the area, and regard the two planes with the first two in the sort (that is, the two planes with the larger area) as the two principal planes of the 3D model; take the normal vectors of the two principal planes as the second normal vector pair, and construct the rotation matrix based on the second normal vector pair according to the above steps.
[0043] Furthermore, if only one normal vector exists, then that normal vector is taken as the first normal vector. ; will be with the first normal vector A direction vector that is not parallel and is parallel to any coordinate axis of the three-dimensional coordinate system is used as the second normal vector. If no normal vector exists, the identity matrix is directly used as the rotation matrix. .
[0044] After obtaining the rotation matrix, it can be further decomposed using Singular Value Decomposition (SVD) to ensure its orthogonality. By rotating the 3D model using this rotation matrix, the principal axes of the rotated 3D model can be positioned relative to any coordinate axis of the 3D coordinate system, and the principal plane of the 3D model can also be positioned relative to any coordinate axis, thus standardizing the pose of the 3D model.
[0045] Furthermore, this posture standardization method is particularly suitable for 3D models of industrial parts, whose main axes usually correspond to assembly datums or machining surfaces in the industrial field, making it easier to perform similarity detection based on the posture-standardized 3D model and obtain accurate similarity detection results.
[0046] The specific implementation method for determining the second target point cloud is explained below.
[0047] As an optional embodiment, with the goal of rigidly registering the first point cloud and the second point cloud, a rigid transformation is performed on the second point cloud to obtain the second target point cloud, including: Multiple rigid transformations were performed on the second point cloud to obtain each second candidate point cloud. The nearest neighbor error between the second candidate point cloud and the first point cloud is determined; the nearest neighbor error is used to characterize the rigidity of the registration between the second candidate point cloud and the first point cloud; the nearest neighbor error is negatively correlated with the rigidity of the registration. The smallest error among the nearest neighbor errors is taken as the target nearest neighbor error; The second candidate point cloud corresponding to the nearest neighbor error of the target is used as the second target point cloud.
[0048] First, the second point cloud is subjected to multiple rigid transformations, and each rigid transformation yields a second candidate point cloud. Since the specified 3D model and the candidate 3D model have been pre-posed and normalized, a second target point cloud that is rigidly registered with the first point cloud can be obtained through a finite number of rigid transformations.
[0049] For each rigid transformation, the second candidate point cloud obtained is used to determine the nearest neighbor error between the second candidate point cloud and the first point cloud. The nearest neighbor error characterizes the degree of rigid registration between the second candidate point cloud and the first point cloud, and the two are negatively correlated. Therefore, the smaller the nearest neighbor error, the higher the degree of rigid registration between the second candidate point cloud and the first point cloud. Based on this, the second candidate point cloud corresponding to the smallest nearest neighbor error is selected as the second target point cloud to ensure the accuracy of the similarity detection results determined based on the second target point cloud.
[0050] As an optional embodiment, the second point cloud is subjected to multiple rigid transformations to obtain various second candidate point clouds, including: Obtain a pre-constructed set of Euler angle combinations; the Euler angle combinations in the set include Euler angles that correspond one-to-one with each coordinate axis. Take any Euler angle combination from the Euler angle combination set as the current Euler angle combination; Rotate the second point cloud sequentially around each coordinate axis by the Euler angles in the current Euler angle combination; The rotated second point cloud is translated so that the first specified point in the first point cloud coincides with the second specified point in the second point cloud, thus obtaining the second candidate point cloud; Take any unselected Euler angle combination from the Euler angle combination set as the current Euler angle combination; return to the step of rotating the Euler angles in the current Euler angle combination around each coordinate axis in turn for the second point cloud until all Euler angle combinations are selected.
[0051] This embodiment pre-constructs a set of Euler angle combinations, which includes multiple Euler angle combinations, each of which includes Euler angles corresponding to the coordinate axes of the three-dimensional coordinate system. Since this application pre-normalizes the pose of the specified 3D model and the candidate 3D model, and the geometry of industrial 3D CAD models is usually relatively regular, the rotational relationship between the specified 3D model and the candidate 3D model can be considered to be in units of 90 degrees. Based on this, all Euler angle combinations in units of 90 degrees are enumerated to obtain the Euler angle combination set.
[0052] As an optional embodiment, the Euler angle combination set includes the following 24 Euler angle combinations: (0, 0, 0), (0, 0, 90), (0, 0, 180), (0, 0, 270), (0, 90, 0), (0, 90, 90), (0, 90, 180), (0, 90, 270), (90, 0, 0), (90, 0, 90), (90, 0, 180), (90, 0, 270), (180, 0, 0), (180, 0, 90), (180, 0, 180), (180, 0, 270), (0, 180, 0), (0, 180, 90), (0, 180, 180), (0, 180, 270), (90, 180, 0), (90, 180, 90). (90, 180, 180) and (90, 180, 270). In the Euler angle combination, the first value represents the Euler angle corresponding to the X-axis in the 3D coordinate system, the second value represents the Euler angle corresponding to the Y-axis, and the third value represents the Euler angle corresponding to the Z-axis. Visualizing the Euler angle combination yields... Figure 8 The set of Euler angle combinations shown.
[0053] Take any Euler angle combination from the set of Euler angle combinations as the current Euler angle combination. Rotate the second point cloud sequentially around each coordinate axis by the Euler angles in the current Euler angle combination. For example, for the current Euler angle combination (90, 180, 270), first rotate the second point cloud 90 degrees around the X-axis, then rotate it 180 degrees around the Y-axis, and finally rotate it 270 degrees around the Z-axis to achieve the attitude transformation of the second point cloud.
[0054] Based on this, the rotated second point cloud is translated to achieve a position transformation, which completes this rigid transformation. During the translation, the first designated point in the first point cloud is used as a reference to translate the second point cloud so that the second designated point in the second point cloud coincides with the first designated point, thus obtaining the second candidate point cloud.
[0055] It should be noted that one of the vertices of the outer box of the specified 3D model (such as the vertex of the upper left corner) can be used as the first specified point; or the eight vertices of the outer box of the specified 3D model can be used as the first specified points in sequence, and the second point cloud can be translated eight times in sequence to obtain eight second candidate point clouds.
[0056] After obtaining the second candidate point cloud for this rigid transformation, any unselected Euler angle combination in the Euler angle combination set is taken as the current Euler angle combination, and the above steps are repeated until all Euler angle combinations are selected to obtain all the second candidate point clouds.
[0057] It should also be noted that, in terms of specific implementation, the current rotation matrix can be constructed based on the current Euler angle combination, and the current translation matrix can be constructed based on the translation amount of the second specified point; then the current rotation matrix and the current translation matrix are combined to obtain the current rigid transformation matrix; the second point cloud data corresponding to the second point cloud (a matrix composed of the three-dimensional coordinates of each sampling point in the second point cloud in the three-dimensional coordinate system) is multiplied by the current rigid transformation matrix to achieve the purpose of rigidly transforming the second point cloud to obtain the second candidate point cloud.
[0058] As an optional embodiment, determining the nearest neighbor error between the second candidate point cloud and the first point cloud includes: For each first sampling point in the first point cloud, determine the positive Euclidean distance between the first sampling point and each second sampling point in the second candidate point cloud; and take the smallest positive Euclidean distance as the positive nearest neighbor distance corresponding to the first sampling point; the positive nearest neighbor distance corresponds one-to-one with the first sampling point; For each second sampling point, the reverse Euclidean distance between the second sampling point and each first sampling point is determined; and the smallest reverse Euclidean distance is taken as the reverse nearest neighbor distance corresponding to the second sampling point; the reverse nearest neighbor distance corresponds one-to-one with the second sampling point; The nearest neighbor error is determined based on the forward nearest neighbor distance and the reverse nearest neighbor distance.
[0059] In this embodiment, the first point cloud is denoted as The second alternative point cloud is denoted as , This represents the first sampling point in the first point cloud. This represents the second sampling point in the second candidate point cloud. , , This represents the total number of the first sampling points. This represents the total number of the second sampling points.
[0060] For each ,calculate and Each The Euclidean distance between the two samples is used as the positive Euclidean distance; the smallest positive Euclidean distance is taken as the positive nearest neighbor distance corresponding to the first sampling point; the positive nearest neighbor distance can be expressed as... Understandably, each Each corresponds to one That is, the number of positive nearest neighbors is the same as the number of the first sampling points.
[0061] Similarly, for each Calculate separately and Each The Euclidean distance is calculated, and this distance is taken as the reverse Euclidean distance. The smallest reverse Euclidean distance is taken as the reverse nearest neighbor distance corresponding to the second sampling point. The reverse nearest neighbor distance can be expressed as: Understandably, each Each corresponds to one That is, the number of reverse nearest neighbors is the same as the number of second sampling points.
[0062] In addition, when determining the positive nearest neighbor distance, the second candidate point cloud can be selected first. Organize it as a KD Tree (K Dimensional Tree) structure, and then for each ,calculate and Each The positive Euclidean distance between them is used to improve calculation speed. The same principle applies to the reverse nearest neighbor distance, which will not be elaborated here.
[0063] Finally, the nearest neighbor error is determined based on the forward nearest neighbor distance and the reverse nearest neighbor distance.
[0064] As an optional embodiment, the average of all positive nearest neighbor errors is determined and used as the nearest neighbor error. In this case, the nearest neighbor error can be expressed as... ,in, This represents the total number of the first sampling points. The nearest neighbor distance is positive. Although the computational cost of this one-way calculation of the nearest neighbor error is relatively small, when the specified 3D model is missing some key structures compared to the candidate 3D model, the nearest neighbor error cannot accurately reflect the rigid registration degree of the first point cloud and the second point cloud, resulting in inaccurate similarity detection results obtained based on the second target point cloud.
[0065] As an optional embodiment, the maximum value of the forward nearest neighbor error and the reverse nearest neighbor error is determined, and the maximum value is taken as the nearest neighbor error. In this case, the nearest neighbor error can be expressed as... ,in, The positive nearest neighbor distance. The reverse nearest neighbor distance. This indicates taking the maximum value. However, this method makes the nearest neighbor error sensitive to the "worst point". That is, as long as there is a significantly large positive Euclidean distance or negative Euclidean distance, it will greatly interfere with the nearest neighbor error, thus leading to inaccurate similarity detection results determined based on the second target point cloud.
[0066] As an optional embodiment, determining the nearest neighbor error based on the forward nearest neighbor distance and the reverse nearest neighbor distance includes: determining a first average value of each forward nearest neighbor distance; and determining a second average value of each reverse nearest neighbor distance; and using the sum of the first average value and the second average value as the nearest neighbor error.
[0067] In this embodiment, the nearest neighbor error can be expressed as: ,in, This represents the total number of the first sampling points. The positive nearest neighbor distance. This represents the total number of the second sampling points. The nearest neighbor distance is the reverse nearest neighbor distance. In this embodiment, the nearest neighbor error is a bidirectional nearest neighbor error, which can suppress unidirectional bias and enhance noise robustness. For situations where the specified 3D model is missing key structures compared to the candidate 3D model, or where there is a significantly larger forward or reverse Euclidean distance, the nearest neighbor error in this embodiment remains unaffected. Therefore, the second target point cloud is accurately determined based on the nearest neighbor error, thereby ensuring the reliability of the similarity detection results.
[0068] The specific implementation method for determining similarity detection results will be explained below.
[0069] As an optional embodiment, based on the first point cloud and the second target point cloud, the similarity detection result between the specified 3D model and the candidate 3D model is determined, including: For each first sampling point in the first point cloud, determine the Euclidean distance between the first sampling point and each sampling point in the second target point cloud; the first sampling point whose Euclidean distance is less than a preset distance is taken as the overlapping sampling point; Determine the first total number of overlapping sampling points, and the second total number of the first sampling points; Based on the first total number and the second total number, determine the proportion of overlapping sampling points to the first sampling points; and determine whether the proportion is greater than a preset threshold. If so, the similarity between the specified 3D model and the candidate 3D model will be used as the similarity detection result; If not, the specified 3D model will be dissimilar to the candidate 3D model, and this will be considered the similarity detection result.
[0070] In this embodiment, the Euclidean distance between the first sampling point and each sampling point in the second target point cloud is first determined; only when there is a distance less than a preset distance among the Euclidean distances is the first sampling point considered as a coincident sampling point. The above steps are performed for each first sampling point in the first point cloud in order to determine all coincident sampling points from the first point cloud.
[0071] If the preset threshold is denoted as The total number of overlapping sampling points is recorded as the first total number. The total number of the first sampling points is recorded as the second total number. The proportion of overlapping sampling points to the first sampling point can be expressed as: .like If the overlap between the first point cloud and the second target point cloud is high, then the similarity between the specified 3D model and the candidate 3D model is taken as the similarity detection result; if If the overlap between the first point cloud and the second target point cloud is low, then the dissimilarity between the specified 3D model and the candidate 3D model is taken as the similarity detection result.
[0072] This embodiment does not impose any particular limitation on the value of the preset threshold. For example, the preset threshold can be set to 80%. It can be understood that the larger the value of the preset threshold, the higher the requirement for the degree of overlap between the first point cloud and the second target point cloud, and the stricter the condition for judging the candidate 3D model as similar to the specified 3D model.
[0073] In summary, this embodiment determines overlapping sampling points by setting a preset distance; and determines whether the degree of overlap between the specified 3D model and the candidate 3D model meets the requirements by setting a preset threshold, thereby realizing the similarity detection between the specified 3D model and the candidate 3D model. This detection method takes into account both stability and sensitivity, ignoring a small number of noise points while still highlighting the differences in main geometric features and topological structures, ensuring the accuracy of the similarity detection results.
[0074] The following explains how to obtain candidate 3D models.
[0075] As an optional embodiment, obtaining a candidate 3D model includes: Retrieve historical 3D models from the historical model database; Extract geometric feature parameters; the geometric feature parameters include the first geometric feature parameters of the historical 3D model and the second geometric feature parameters of the specified 3D model; the geometric feature parameters include at least one of the following: total number of edges, total number of faces, total surface area, volume, and outer box size; Determine the feature deviation value between the first geometric feature parameter and the second geometric feature parameter; Historical 3D models whose feature deviation values are all within the corresponding preset tolerance range are used as candidate 3D models.
[0076] Please refer to Figure 9 , Figure 9 This is a schematic diagram illustrating the principle of a similarity detection method for three-dimensional models provided in this application. Considering that the historical model database stores numerous historical three-dimensional models, in order to reduce the subsequent computational load, this embodiment removes historical three-dimensional models that have significant differences in geometric features from the specified three-dimensional model based on the geometric feature parameters of the three-dimensional model, and only selects historical three-dimensional models with similar geometric features to the specified three-dimensional model as candidate three-dimensional models.
[0077] In this embodiment, the geometric feature parameters include at least one of the following: total number of sides, total number of faces, total surface area, volume, and outer box dimensions. The specific parameter can be selected according to actual needs. Furthermore, a corresponding preset tolerance range is pre-set for each type of geometric feature parameter. It should be noted that the outer box refers to the smallest cuboid in three-dimensional space that can enclose the entire three-dimensional model; the outer box dimensions are the length, width, and height of the outer box.
[0078] First, extract the first geometric feature parameters of the historical 3D model and the second geometric feature parameters of the specified 3D model; then, determine the feature deviation value between the first and second geometric feature parameters. The feature deviation value can be the relative deviation between the first and second geometric feature parameters.
[0079] The first geometric feature parameter includes the first total number of sides. The second geometric feature parameter includes the second total number of sides. For example, the characteristic deviation value corresponding to the total number of edges is also the first total number of edges. With the second total number of sides The relative deviation between them can be expressed as ,in, Represents the first total number of sides With the second total number of sides The absolute value of the difference Represents the first total number of sides With the second total number of sides The minimum value in.
[0080] If the geometric feature parameters include the outer box dimensions, then the first outer box dimensions in the first geometric feature parameters include a first length, a first width, and a first height; the second outer box dimensions in the second geometric feature parameters include a second length, a second width, and a second height. Taking length as an example, the first length... Second length The characteristic deviation between them can be expressed as ,in, Indicates the first length With the second length The absolute value of the difference Indicates the first length With the second length The minimum value in the range. The same applies to width and height, which will not be elaborated here.
[0081] After determining the feature deviation values between the first geometric feature parameter and the second geometric feature parameter, historical 3D models whose feature deviation values are all within the corresponding preset tolerance range are used as candidate 3D models, so as to select candidate 3D models with similar geometric features to the specified 3D model from a large number of historical 3D models.
[0082] Furthermore, the material properties of the selected candidate 3D models can be further extracted, and models with the same material properties as the specified 3D model can be used as the final candidate 3D models, thereby further reducing the number of candidate 3D models that need to be similar to the specified 3D model and reducing the amount of computation.
[0083] The specific methods for sampling 3D models are explained below.
[0084] As an optional embodiment, the 3D model after attitude adjustment is sampled to obtain a sampled point cloud, including: Obtain the pre-set number of edge sampling points and face sampling points; Determine the side lengths of each side, the area of each face, the total side length, and the total area of the 3D model; Determine the proportion of the side length to the total side length; based on the side proportion and the number of edge sampling points, determine the number of edge sampling points; determine the proportion of the area to the total area of the face; based on the face proportion and the number of face sampling points, determine the number of face sampling points; For the 3D model after attitude adjustment, the edges are sampled uniformly according to the number of edge sampling points, and the faces are sampled uniformly according to the number of face sampling points to obtain the sampling point cloud.
[0085] In this embodiment, the number of edge sampling points and the number of face sampling points are preset. The values of both can be set according to actual needs, and this embodiment does not impose any special limitations on them.
[0086] For each edge of the 3D model, the proportion of that edge's length to the total edge length is taken as the edge ratio; based on the edge ratio and the number of edge sampling points, the number of edge sampling points corresponding to that edge is determined. For example, the product of the edge ratio and the number of edge sampling points is taken as the number of edge sampling points.
[0087] Similarly, for each face of the 3D model, the proportion of that face's area to the total area is used as the face ratio; based on the face ratio and the number of face sampling points, the number of face sampling points corresponding to that face is determined. For example, the product of the face ratio and the number of face sampling points is used as the number of face sampling points.
[0088] Next, for the 3D model after pose adjustment, edges are uniformly sampled according to the number of edge sampling points, and faces are uniformly sampled according to the number of face sampling points, resulting in a sampled point cloud. Alternatively, the same method can be used to uniformly sample only the edges or only the faces of the 3D model. Figure 2 , Figure 3 and Figure 4 As shown, uniform sampling of the edges of a specified 3D model can yield the following results: Figure 3 The first point cloud shown; by uniformly sampling the surfaces of a specified 3D model, the following can be obtained: Figure 4 The first point cloud shown.
[0089] In this embodiment, since the sampling points are evenly distributed proportionally, the sampling point cloud can accurately characterize the geometric features and topological structure of the 3D model, providing a basis for subsequently determining the similarity detection results of the specified 3D model and the candidate 3D model.
[0090] This application also provides an electronic device, which includes: Memory, used to store computer programs; A processor is used to implement the steps of any of the above-mentioned three-dimensional model similarity detection methods when executing a computer program.
[0091] For a detailed description of the electronic device, please refer to the embodiments of the similarity detection method for the three-dimensional model described above; this application will not elaborate further here.
[0092] While this specification contains numerous specific implementation details, these should not be construed as limiting the scope of any invention or the scope of the claims, but rather are primarily intended to describe features of specific embodiments of a particular invention. Certain features described in the various embodiments herein may also be implemented in combination in a single embodiment. Conversely, various features described in a single embodiment may also be implemented separately in various embodiments or in any suitable sub-combination. Furthermore, while features may function in certain combinations as described above and even initially claimed in this way, one or more features from a claimed combination may be removed from that combination in some cases, and a claimed combination may refer to a sub-combination or a variation thereof.
[0093] Similarly, although the operations are depicted in a specific order in the accompanying drawings, this should not be construed as requiring these operations to be performed in the specific order shown or sequentially, or requiring all illustrated operations to be performed to achieve the desired result. In some cases, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system modules and components in the above embodiments should not be construed as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.
[0094] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for similarity detection of three-dimensional models, characterized in that, The method includes: Obtain the three-dimensional model to be detected in a three-dimensional coordinate system; the three-dimensional model includes a specified three-dimensional model as the detection object and a candidate three-dimensional model as the object to be detected; The posture of the 3D model is adjusted so that the principal axis of the 3D model forms a specified positional relationship with any coordinate axis of the 3D coordinate system; the specified positional relationship includes parallel or perpendicular. The 3D model after attitude adjustment is sampled to obtain a sampled point cloud; the sampled point cloud includes a first point cloud corresponding to the specified 3D model and a second point cloud corresponding to the candidate 3D model; With the rigid registration of the first point cloud and the second point cloud as the target, a rigid transformation is performed on the second point cloud to obtain the second target point cloud; Based on the first point cloud and the second target point cloud, determine the similarity detection result between the specified 3D model and the candidate 3D model; The step of rigidly transforming the second point cloud to obtain a second target point cloud, with the goal of rigidly registering the first point cloud and the second point cloud, includes: The second point cloud is subjected to multiple rigid transformations to obtain each second candidate point cloud; The nearest neighbor error between the second candidate point cloud and the first point cloud is determined; the nearest neighbor error is used to characterize the degree of rigid registration between the second candidate point cloud and the first point cloud; the nearest neighbor error is negatively correlated with the degree of rigid registration. The smallest of the nearest neighbor errors is taken as the target nearest neighbor error; The second candidate point cloud corresponding to the nearest neighbor error of the target is taken as the second target point cloud; Determining the nearest neighbor error between the second candidate point cloud and the first point cloud includes: For each first sampling point in the first point cloud, the positive Euclidean distance between the first sampling point and each second sampling point in the second candidate point cloud is determined; and the smallest of the positive Euclidean distances is taken as the positive nearest neighbor distance corresponding to the first sampling point; the positive nearest neighbor distance corresponds one-to-one with the first sampling point; For each second sampling point, the reverse Euclidean distance between the second sampling point and each of the first sampling points is determined; and the smallest of the reverse Euclidean distances is taken as the reverse nearest neighbor distance corresponding to the second sampling point; the reverse nearest neighbor distance corresponds one-to-one with the second sampling point; The nearest neighbor error is determined based on the forward nearest neighbor distance and the reverse nearest neighbor distance.
2. The similarity detection method for three-dimensional models as described in claim 1, characterized in that, The step of adjusting the posture of the 3D model so that the principal axis of the 3D model forms a specified positional relationship with any coordinate axis of the 3D coordinate system includes: Determine the normal vectors of each plane; the planes include the planes of the three-dimensional model body and the planes formed by the holes and slots on the three-dimensional model; Determine whether there exists an orthogonal first normal vector pair among the stated normal vectors; If it exists, then construct a rotation matrix using the first normal vector pair; If none exists, determine the area of each plane; based on the area, sort each plane in descending order; take the normal vectors of the two planes with the highest sort order as the second normal vector pair; and construct a rotation matrix using the second normal vector pair. The 3D model is rotated using the rotation matrix to adjust its posture.
3. The similarity detection method for three-dimensional models as described in claim 1, characterized in that, The process of performing multiple rigid transformations on the second point cloud to obtain each second candidate point cloud includes: Obtain a pre-constructed set of Euler angle combinations; the Euler angle combinations in the set of Euler angle combinations include Euler angles that correspond one-to-one with each of the coordinate axes; Take any Euler angle combination from the set of Euler angle combinations as the current Euler angle combination; The second point cloud is rotated sequentially around each of the coordinate axes by the Euler angles in the current Euler angle combination; The rotated second point cloud is translated so that the first designated point in the first point cloud coincides with the second designated point in the second point cloud, thus obtaining the second candidate point cloud; Take any unselected Euler angle combination from the set of Euler angle combinations as the current Euler angle combination; return to the step of rotating the second point cloud around each of the coordinate axes in turn the Euler angles in the current Euler angle combination until all Euler angle combinations are selected.
4. The similarity detection method for three-dimensional models as described in claim 1, characterized in that, The step of determining the nearest neighbor error based on the forward nearest neighbor distance and the reverse nearest neighbor distance includes: Determine a first average value for each of the forward nearest neighbor distances; and determine a second average value for each of the reverse nearest neighbor distances; The sum of the first average value and the second average value is taken as the nearest neighbor error.
5. The similarity detection method for three-dimensional models as described in claim 1, characterized in that, The step of determining the similarity detection result between the specified 3D model and the candidate 3D model based on the first point cloud and the second target point cloud includes: For each first sampling point in the first point cloud, the Euclidean distance between the first sampling point and each sampling point in the second target point cloud is determined; the first sampling point whose Euclidean distance is less than a preset distance is taken as the overlapping sampling point. Determine the first total number of overlapping sampling points and the second total number of the first sampling points; Based on the first total number and the second total number, determine the proportion of the overlapping sampling points to the first sampling points; and determine whether the proportion is greater than a preset threshold. If so, the similarity between the specified 3D model and the candidate 3D model is taken as the similarity detection result; If not, then the specified 3D model is not similar to the candidate 3D model, and this is taken as the similarity detection result.
6. The similarity detection method for three-dimensional models as described in claim 1, characterized in that, Obtain candidate 3D models, including: Retrieve historical 3D models from the historical model database; Extract geometric feature parameters; the geometric feature parameters include the first geometric feature parameters of the historical 3D model and the second geometric feature parameters of the specified 3D model; the geometric feature parameters include at least one of the following: total number of edges, total number of faces, total surface area, volume, and outer box dimensions; Determine the feature deviation value between the first geometric feature parameter and the second geometric feature parameter; The historical 3D models whose feature deviation values are all within the corresponding preset tolerance range are used as the candidate 3D models.
7. The similarity detection method for three-dimensional models as described in claim 1, characterized in that, The step of sampling the 3D model after attitude adjustment to obtain a sampled point cloud includes: Obtain the pre-set number of edge sampling points and face sampling points; Determine the side length of each side, the area of each face, the total side length, and the total area of the three-dimensional model; Determine the proportion of the side length to the total side length; determine the number of side sampling points based on the side proportion and the number of side sampling points to be sampled; Determine the proportion of the area to the total area; determine the number of surface sampling points based on the proportion and the number of surface sampling points to be sampled. For the 3D model after attitude adjustment, the edges are uniformly sampled according to the number of edge sampling points, and the faces are uniformly sampled according to the number of face sampling points to obtain the sampling point cloud.
8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the similarity detection method for a three-dimensional model as described in any one of claims 1 to 7 when executing the computer program.