A method for reconstructing a three-dimensional CAD entity model of a workpiece with internal defects based on an industrial CT image
Patent Information
- Application Number
- CN202211123445.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-15
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2042-09-15
AI Technical Summary
[0009](1)在CAD实体模型重构环节中存在大量手工操作,过程复杂繁琐、效率低下;
[0077] To address the difficulty in obtaining 3D CAD solid models of workpieces with internal defects, this invention combines industrial CT technology and makes full use of the original CAD solid model existing in the workpiece design stage, directly reconstructing the internal defect information extracted from industrial CT images in the original CAD solid model of the workpiece.
Smart Images

Figure CN115828339B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of mechanical technology, specifically a method for reconstructing a three-dimensional CAD solid model of a workpiece with internal defects based on industrial CT images. Background Technology
[0002] Some workpieces inevitably develop various internal defects during manufacturing and use. To assess the impact of these internal defects on the workpiece's performance, a 3D CAD solid model of the workpiece with internal defects can be created. Then, quantitative analysis of the defective workpiece can be performed using digital simulation methods. To reconstruct the 3D CAD solid model of the workpiece with internal defects, the internal defects must first be detected. Industrial computed tomography (CT) technology can, under non-destructive conditions, clearly, accurately, and intuitively display the internal structure, composition, material, and defects of an object by reconstructing a 2D tomographic image or 3D model of the object being inspected.
[0003] Currently, research on workpieces with internal defects using industrial CT technology mainly focuses on three-dimensional visualization of defects, defect measurement and statistics, and defect evolution analysis.
[0004] Some scholars have used high-resolution CT scans to examine cracks in carbon fiber reinforced composites generated under localized impacts. By analyzing the damage mechanism and the distribution of defects, they have been able to quantitatively identify potential damage and failure mechanisms in workpieces.
[0005] Some scholars have used industrial CT technology to scan and reconstruct cylindrical specimens of 2A12 aluminum alloy that have undergone low-cycle fatigue testing. They then used 3D volume rendering to reconstruct the specimens, obtaining 3D visualization images and dimensional information that closely match the actual crack conditions. However, this reconstruction method is inefficient and prone to missing small internal defects in the workpiece during the reconstruction process.
[0006] Some scholars have used microfocus CT to reconstruct and visualize crack surfaces in three dimensions, studying the three-dimensional distribution of crack front propagation increments in 2A50 forged aluminum notched specimens. However, this method is limited to visualizing internal defects and cannot perform quantitative analysis. The aforementioned studies only reconstruct the three-dimensional surface of internal defects in the workpiece and then observe and measure the spatial location and size of the defects. Because these studies cannot obtain a three-dimensional CAD solid model of the workpiece with internal defects, they cannot assess the impact of internal defects on the overall performance of the workpiece through digital simulation.
[0007] Some research has been conducted on the reconstruction of CAD solid models of workpieces with defects. Some scholars have proposed a method based on reverse engineering to reconstruct CAD solid models of worn workpieces, aiming to improve the repair efficiency and reliability of worn parts. This method allows for the acquisition and reconstruction of surface wear defects. However, this method is only applicable to the reconstruction of 3D CAD solid models of workpieces with surface defects; a better method for reconstructing workpieces with internal defects remains lacking. Other scholars have proposed a novel CAD solid model reconstruction method that fits a parameter description (CAD template) containing the reconstructed object into the mesh data to generate a more accurate CAD solid model. This method relies on the CAD template and is not suitable for reconstructing CAD solid models of workpieces with defects.
[0008] It is evident that directly reconstructing a 3D CAD solid model of a workpiece with internal defects currently presents the following problems:
[0009] (1) There are a lot of manual operations in the CAD solid model reconstruction process, which is complicated, tedious and inefficient.
[0010] (2) The reconstruction results are closely related to individual professional ability. The more complex the structure of the workpiece, the less the reconstruction efficiency and accuracy can be guaranteed.
[0011] (3) The defect volume ratio is low and there are no obvious geometric features. Small features are difficult to retain during reconstruction, which reduces the model fidelity. Summary of the Invention
[0012] The purpose of this invention is to provide a method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images, comprising the following steps:
[0013] 1) Acquire CT sequence images of the defective workpiece;
[0014] 2) Process the CT sequence images of the defective workpiece to obtain the STL model of the workpiece;
[0015] The steps for processing CT sequence images of defective workpieces include:
[0016] The volume data processing and STL model reconstruction of CT sequence images of defective workpieces were performed using a 3D CV model and the MC algorithm to obtain the STL model of the defective workpiece.
[0017] The steps for volume data processing and STL model reconstruction of CT sequence images of defective workpieces using 3D CV models and MC algorithms include:
[0018] 2.1) Read the CT sequence images of the workpiece sequentially to obtain the three-dimensional volume data to be processed;
[0019] 2.2) Iteratively calculate the energy function using a 3D CV model to minimize the energy function;
[0020] The energy function F(C,c1,c2) of the 3D CV model is shown below:
[0021] F(C,c1,c2)=μArea(C)+νVolume(C)+λ1∫ in(c) |u0(x,y,z)-c1| 2 dxdydz+λ2∫ out(C) |u0(x,y,z)-c2| 2 dxdydz (1)
[0022] Where Area(C) represents the surface area of the evolving surface, and Volume(C) represents the volume enclosed by the evolving surface; c1 and c2 represent the average pixel gray values inside and outside the evolving surface C, respectively; constants μ and ν ≥ 0, and constants λ1 and λ2 > 0; u0(x,y,z) is the gray value of any point on the spatial region.
[0023] The steps for iteratively calculating the energy function using a 3D CV model include:
[0024] 2.2.1) Set parameters μ, ν, λ1, λ2, and Δt, and initialize the level set function φ0(x,y,z);
[0025] 2.2.2) Establish the level set iterative expression for the energy function, i.e.:
[0026]
[0027] In the formula, φ is the symbolic distance function; H is the Heaviside function; and δ is the Dirac function. The gradient operator; u0 refers to u0(x,y,z);
[0028] 2.2.3) The discrete iterative expression of the level set iterative expression (2) is obtained by using the finite difference method, and the curve C is inverted by using the discrete iterative expression, so as to perform iterative calculation of the energy function.
[0029] 2.3) For each iteration T cycle, extract the zero level set of the 3D CV model and use the MC algorithm to reconstruct the isosurface of the zero level set;
[0030] 2.4) Determine if the number of iterations has reached the termination iteration count. If yes, output the STL model of the defective workpiece reconstructed by the MC algorithm; otherwise, return to step 3).
[0031] The steps for extracting an STL model of a defective workpiece include:
[0032] 2.2.1) Establish an edge information table based on the vertex coordinates of each facet of the STL model of the defective workpiece;
[0033] 2.2.2) Select an unmarked triangular facet as a seed and mark it; add the marked triangular facet to the facet queue;
[0034] 2.2.3) Take out the marked triangular facet from the queue, and using the three sides of the marked triangular facet as the starting point, find other unmarked facets that contain any side of the marked triangular facet, and mark these facets with the same mark as the marked triangular facet.
[0035] 2.2.4) Repeat step 2.2.3) until there are no more unmarked faces containing any edge of the marked triangle face;
[0036] 2.2.5) Check if the queue is empty. If it is, proceed to step 2.2.6); otherwise, return to step 2.2.2).
[0037] 2.2.6) Extract a specified region and output the facets with the same marking as a new STL model. The specified region is a connected region composed of facets with the same marking, including the workpiece surface region and several internal defect regions.
[0038] 3) Register the original CAD solid model and the STL model of the workpiece, and perform spatial transformation on the STL model of the workpiece to obtain the spatially transformed STL model of the workpiece.
[0039] The steps for registering the original CAD solid model and the STL model of the workpiece include:
[0040] 3.1) The original CAD solid model of the workpiece is converted into a point cloud using the Delaunay triangulation method to obtain the original point cloud model of the workpiece.
[0041] 3.2) The steps for coarse point cloud registration of the original CAD solid model and the STL model of the workpiece using the fast point feature histogram algorithm include:
[0042] 3.2.1) For the target point cloud Q and the source point cloud P, the FPFH of the point cloud set is calculated using formula (3), i.e.:
[0043]
[0044] In the formula, ω i It is query point p q and adjacent point p i The distance between points is measured by k, which is the average number of points in the neighborhood of each point. SPFH(p i) and SPFH(p q ) are respectively p i and p q The values corresponding to the simplified feature histogram of the query point;
[0045] 3.2.2) Obtaining sampling points: Sample the source point cloud P to obtain m points. In order to maximize the coverage of the sampling point cloud, the minimum distance between the sampling points is limited.
[0046] 3.2.3) Finding point pairs: Based on the sampling points in the source point cloud, find one or more corresponding points in the target point cloud with similar FPFH, and randomly select one as a spatial transformation point pair;
[0047] 3.2.4) Spatial Transformation: Calculate the rigid body transformation matrix based on the selected point pairs, and perform spatial transformation on the source point cloud to complete the coarse registration of the point cloud between the original point cloud model and the workpiece STL model.
[0048] 3.3) The iterative nearest point algorithm is used to perform fine registration of the point cloud model of the workpiece and the STL model of the workpiece after the first rigid body transformation to obtain the rigid body transformation matrix.
[0049] The steps for fine registration of the point cloud model of the workpiece and the STL model of the workpiece after the first rigid body transformation using the iterative nearest point algorithm include:
[0050] 3.3.1) Let the point cloud set of the workpiece STL model after the first rigid body transformation be denoted as . The point cloud set of the original point cloud model of the workpiece is
[0051] 3.3.2) For point P i Search for the nearest point in the point cloud set X as the corresponding point and write it into the corresponding point set. N; q N is the number of points; p N x Points;
[0052] 3.3.3) Calculate the rotation transformation matrix R and translation transformation matrix T for fine registration based on the corresponding point set Q;
[0053] 3.3.4) Perform rigid body transformation on the internal defect STL model after the first rigid body transformation based on the finely registered rotation transformation matrix R and translation transformation matrix T;
[0054] 3.3.5) Calculate the error change E between two consecutive transformations. k If the error change E kIf the value is less than the given threshold τ, the registration process ends; otherwise, it is determined whether the number of iterations k has reached the maximum number of iterations. If so, the registration process ends; otherwise, the number of iterations k = k + 1 is set, and the process returns to step 3.3.1.
[0055] The error measure function E(R,T) after the rigid body transformation is shown below:
[0056]
[0057] In the formula, R represents the rotation transformation matrix for fine registration, and T represents the translation transformation matrix.
[0058] 3.4) Use the rigid body transformation matrix to perform a spatial transformation on the internal defect STL model after the first rigid body transformation, so as to obtain the workpiece STL model after spatial transformation.
[0059] 4) Based on the workpiece STL model from step 3), generate a CAD solid model of the workpiece with internal defects.
[0060] The steps to generate a CAD solid model of a workpiece with internal defects include:
[0061] 4.1) Perform topological reconstruction on the STL model of the workpiece after spatial transformation to obtain the defect CAD solid model. The steps include:
[0062] 4.1.1) Use the three-axis block sorting algorithm to remove duplicate vertices. The steps include:
[0063] 4.1.1.1) Create vertex arrays X, Y, and Z, input the internal defect STL model, and read the three coordinate values (x, y, z) of one vertex at a time;
[0064] 4.1.1.2) Determine if a vertex has been saved based on its coordinate values: Check the x, y, and z coordinates in sequence. If the value does not exist in the corresponding vertex array, proceed to step 4.1.1.3). If the x coordinate exists, check if the y coordinate exists in the Y array pointed to by the x coordinate. Otherwise, proceed to step 4.1.1.3.
[0065] If coordinate y exists, then proceed to the Z array pointed to by coordinate y to check if coordinate z exists; otherwise, proceed to step 4.1.1.3.
[0066] If the coordinate z exists, the current coordinate value (x, y, z) is not saved, and step 4.1.1.1 is returned; otherwise, step 4.1.1.3 is performed.
[0067] 4.1.1.3) Save the coordinate values (x, y, z) into the corresponding X, Y, Z arrays and sort them;
[0068] The sorting rules are as follows: After saving the coordinate x, sort the X array and change the Y and Z arrays pointed to by the coordinate x accordingly; after saving the coordinate y, sort the Y array and change the Z array pointed to by the coordinate xy accordingly; after saving the coordinate z, sort the Z array.
[0069] 4.1.2) Establish vertex, edge, and face data tables;
[0070] The steps for creating the vertex data table include: starting from the X array, determining the y and z coordinates corresponding to each coordinate x, and adding them to the vertex table as new vertex coordinates (x, y, z);
[0071] The steps for creating an edge data table include: creating edges in pairs based on the coordinates of the three vertices of each grid; determining whether the created edges are in the edge data table; if not, establishing an index between the edge and the corresponding vertex in the vertex table, creating edge information, and adding the created edges to the edge data table.
[0072] The steps to create a face data table include: adding the face number and its corresponding normal vector, as well as the indices of the three vertices and three edges that make up the face, as face information to the face data table;
[0073] 4.1.3) Utilizing the topological relationships between the reconstructed triangular facets, with the edges as the core, all triangular vertices are reconstructed into entities. From the points to the edges, triangular faces are generated. All triangular faces are merged into a whole to obtain a closed spatial boundary. Based on the closed boundary surface, a defect CAD entity model is generated.
[0074] 4.2) Perform Boolean operations on the internal defect CAD solid model and the original workpiece CAD solid model to generate a CAD solid model of the defective workpiece.
[0075] It is worth noting that this patent addresses the difficulty in obtaining 3D CAD solid models of workpieces with internal defects. Based on industrial CT technology, it proposes a method for reconstructing 3D CAD solid models of workpieces with internal defects from industrial CT images. This method mainly consists of three steps: (1) 3D segmentation and extraction of internal defects; (2) Registration of the workpiece CAD solid model with the reconstructed model; and (3) Generation of the CAD solid model of the workpiece with internal defects.
[0076] The technical effects of this invention are undeniable, and its beneficial effects are as follows:
[0077] To address the difficulty in obtaining 3D CAD solid models of workpieces with internal defects, this invention combines industrial CT technology and makes full use of the original CAD solid model existing in the workpiece design stage, directly reconstructing the internal defect information extracted from industrial CT images in the original CAD solid model of the workpiece.
[0078] This invention first reconstructs the STL model of the workpiece and the STL model of the defect from industrial CT sequence images of a workpiece with internal defects. Then, to obtain the correct location of the internal defect in the original CAD solid model of the workpiece, the STL model of the workpiece is registered with the original CAD solid model. Finally, the STL model of the internal defect is solidified and Boolean operations are performed with the original CAD solid model of the workpiece to generate a 3D CAD solid model of the workpiece with internal defects. The practical effectiveness of this invention is verified by reconstructing a 3D CAD solid model of an actual combustion chamber insert.
[0079] This invention addresses the problem of difficulty in obtaining CAD solid models in the digital analysis of workpieces with internal defects. It proposes a method for reconstructing three-dimensional CAD solid models of workpieces with defects based on industrial CT images, providing a direct and accurate model basis for the digital model simulation of workpieces with internal defects, thereby enabling more accurate evaluation of the workpiece's performance and service life.
[0080] This invention acquires defect information from industrial CT sequence images of workpieces with internal defects, fully utilizing existing 3D CAD solid models from the design phase. Through defect segmentation and extraction, model registration, and 3D CAD solid model reconstruction, it solves the problem of difficulty in obtaining 3D CAD solid models of workpieces with internal defects. The effectiveness of this invention is verified by reconstructing a 3D CAD solid model of a combustion chamber insert and performing finite element simulation. This invention is also applicable to the reconstruction of solid models of workpieces containing small-volume or multi-target internal defects. This invention can provide direct and accurate model support for subsequent digital simulation of specific defective workpieces, and the technical route is designed based on a comprehensive consideration of the method's practicality, adaptability, and ease of optimization.
[0081] This invention enables the reconstruction of CAD solid models of workpieces with internal defects, allowing for further qualitative and quantitative analysis of the impact of defects on the overall performance of the workpiece. This invention can effectively control the reconstruction time, avoiding the time-consuming process and loss of small workpiece features caused by reverse engineering. Attached Figure Description
[0082] Figure 1 A flowchart for the method implementation;
[0083] Figure 2 Industrial CT sequence images of combustion chamber inserts;
[0084] Figure 3 STL model of a combustion chamber insert with air vents;
[0085] Figure 4 (a) is the STL model of the combustion chamber insert, and (b) is the STL model of the vent (magnified by approximately 9 times).
[0086] Figure 5 To convert the CAD solid model of the combustion chamber insert into point cloud form, Figure 5 (a) is a CAD solid model. Figure 5 (b) is a point cloud model (displayed as a patch). Figure 5 (c) is a point cloud model (mesh display);
[0087] Figure 6 For the registration of the combustion chamber insert CAD solid model and the reconstructed model, Figure 6 (a) is the initial position. Figure 6 (b) shows the coarse registration result. Figure 6 (c) shows the fine registration result;
[0088] Figure 7 To check the registration effect between the CAD solid model and the reconstructed model of the combustion chamber insert;
[0089] Figure 8 This refers to the change in the position of the air vents and combustion chamber inserts (the arrow points to the air vents). Figure 8 (a) is the initial position. Figure 8 (b) is the position after spatial transformation;
[0090] Figure 9 For pore CAD solid model, Figure 9 (a) Appearance drawing, Figure 9 (b) is a cross-sectional view;
[0091] Figure 10 This is a CAD solid model of a combustion chamber insert with air vents. Figure 10 (a) is an appearance diagram (the arrow points to the pores). Figure 10 (b) is a longitudinal cross-sectional view. Figure 10 (c) is a partial view;
[0092] Figure 11 Pressure cloud diagram for thermodynamic simulation of combustion chamber inserts. Detailed Implementation
[0093] The present invention will be further described below with reference to embodiments, but it should not be construed that the scope of the present invention is limited to the following embodiments. Various substitutions and modifications made based on ordinary technical knowledge and common practices in the art without departing from the above-described technical concept of the present invention should be included within the scope of protection of the present invention.
[0094] Example 1:
[0095] See Figures 1 to 11 A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images includes the following steps:
[0096] 1) Acquire CT sequence images of the defective workpiece;
[0097] 2) Process the CT sequence images of the defective workpiece to obtain the STL model of the workpiece surface and the STL model of the internal defects;
[0098] The steps for processing CT sequence images of defective workpieces include:
[0099] 2.1) Using the three-dimensional CV model (Chan-Vese model, level set model) and the MC algorithm (moving cube algorithm, marching cube algorithm) to perform volume data processing and STL model reconstruction on the CT sequence images of the defective workpiece, the STL model of the defective workpiece is obtained.
[0100] The steps for volume data processing and STL model reconstruction of CT sequence images of defective workpieces using 3D CV models and MC algorithms include:
[0101] 2.1.1) Read the CT sequence images of the workpiece sequentially to obtain the three-dimensional volume data to be processed;
[0102] 2.1.2) Iteratively calculate the energy function using a 3D CV model to minimize the energy function;
[0103] The energy function F(C,c1,c2) of the 3D CV model is shown below:
[0104] F(C,c1,c2)=μArea(C)+νVolume(C)+λ1∫ in(c) |u0(x,y,z)-c1| 2 dxdydz+λ2∫ out(C) |u0(x,y,z)-c2| 2 dxdydz (1)
[0105] Where Area(C) represents the surface area of the evolving surface, and Volume(C) represents the volume enclosed by the evolving surface; c1 and c2 represent the average pixel gray values inside and outside the evolving surface C, respectively; constants μ and ν ≥ 0, and constants λ1 and λ2 > 0; u0(x,y,z) is the gray value of any point on the spatial region.
[0106] The steps for iteratively calculating the energy function using a 3D CV model include:
[0107] 2.1.2.1) Set parameters μ, ν, λ1, λ2, and Δt, and initialize the level set function φ0(x,y,z);
[0108] 2.1.2.2) Establish the level set iterative expression for the energy function, i.e.:
[0109]
[0110] In the formula, φ is the signed distance function; H is the Heaviside function; δ is the Dirac function; ▽ is the gradient operator; u0 refers to u0(x,y,z);
[0111] 2.1.2.3) The discrete iterative expression of the level set iterative expression (2) is obtained by using the finite difference method, and the curve C is inverted by using the discrete iterative expression, so as to perform iterative calculation of the energy function.
[0112] 2.1.3) For each iteration T cycle, extract the zero level set of the 3D CV model and use the MC algorithm to reconstruct the isosurface of the zero level set;
[0113] 2.1.4) Determine whether the number of iterations has reached the termination iteration count. If yes, output the STL model of the defective workpiece reconstructed by the MC algorithm; otherwise, return to step 3).
[0114] 2.2) Extract the STL model of the defective workpiece to obtain the workpiece STL model and the internal defect STL model.
[0115] The steps for extracting an STL model of a defective workpiece include:
[0116] 2.2.1) Establish an edge information table based on the vertex coordinates of each facet of the STL model of the defective workpiece;
[0117] 2.2.2) Select an unmarked triangular facet as a seed and mark it; add the marked triangular facet to the facet queue;
[0118] 2.2.3) Take the marked triangular facet from the queue, and using the three sides of the marked triangular facet as the starting point, find other unmarked facets that contain any side of the marked triangular facet, and mark these facets with the same mark as the marked triangular facet.
[0119] 2.2.4) Repeat step 2.2.3) until there are no more unmarked faces containing any edge of the marked triangle face;
[0120] 2.2.5) Check if the queue is empty. If it is, proceed to step 2.2.6); otherwise, return to step 2.2.2).
[0121] 2.2.6) Extract the specified region and output the facets with the same marking as a new STL model; the specified region is a connected region composed of facets with the same marking, including the workpiece surface region and several internal defect regions. There are two types of facet markings, one of which corresponds to the workpiece STL model and the other corresponds to the internal defect STL model.
[0122] 3) Register the original CAD solid model of the workpiece and the complete STL model of the workpiece, and perform spatial transformation on the STL model of the workpiece to obtain the STL model of internal defects after spatial transformation.
[0123] The steps for registering the original CAD solid model and the STL model of the workpiece include:
[0124] 3.1) Use the Delaunay triangulation method to convert the original CAD solid model of the workpiece (e.g., the CAD solid model of the combustion chamber insert) into point cloud to obtain the original point cloud model of the workpiece.
[0125] 3.2) The steps for coarse point cloud registration of the original CAD solid model and the STL model of the workpiece using the fast point feature histogram algorithm include:
[0126] 3.2.1) For the target point cloud Q and the source point cloud P, the FPFH of the point cloud set is calculated using formula (3), i.e.:
[0127]
[0128] In the formula, ω i It is query point p q and adjacent point p i The distance between points is measured by k, which is the average number of points in the neighborhood of each point. SPFH(p i ) and SPFH(p q ) are respectively p i and p q The values corresponding to the simplified feature histogram of the query point;
[0129] 3.2.2) Obtaining sampling points: Sample the source point cloud P to obtain m points. In order to maximize the coverage of the sampling point cloud, the minimum distance between the sampling points is limited.
[0130] 3.2.3) Finding point pairs: Based on the sampling points in the source point cloud, find one or more corresponding points in the target point cloud with similar FPFH, and randomly select one as a spatial transformation point pair;
[0131] 3.2.4) Spatial Transformation: Calculate the rigid body transformation matrix based on the selected point pairs, and perform spatial transformation on the source point cloud to complete the coarse registration of the point cloud between the original point cloud model and the workpiece STL model.
[0132] 3.3) The iterative nearest point algorithm is used to perform fine registration of the point cloud model of the workpiece and the STL model of the workpiece after the first rigid body transformation to obtain the rigid body transformation matrix.
[0133] The steps for fine registration of the point cloud model of the workpiece and the STL model of the workpiece after the first rigid body transformation using the iterative nearest point algorithm include:
[0134] 3.3.1) Let the point cloud set of the workpiece STL model after the first rigid body transformation be denoted as . The point cloud set of the original point cloud model of the workpiece is
[0135] 3.3.2) For point P i Search for the nearest point in the point cloud set X as the corresponding point and write it into the corresponding point set. N; q N is the number of points; p N x Points;
[0136] 3.3.3) Calculate the rotation transformation matrix R and translation transformation matrix T for fine registration based on the corresponding point set Q;
[0137] 3.3.4) Perform rigid body transformation on the workpiece STL model after the first rigid body transformation based on the finely registered rotation transformation matrix R and translation transformation matrix T;
[0138] 3.3.5) Calculate the error change E between two consecutive transformations. k If the error change E k If the value is less than the given threshold τ, the registration process ends; otherwise, it is determined whether the number of iterations k has reached the maximum number of iterations. If so, the registration process ends; otherwise, the number of iterations k = k + 1 is set, and the process returns to step 3.3.1.
[0139] The error measure function E(R,T) after the rigid body transformation is shown below:
[0140]
[0141] In the formula, R represents the rotation transformation matrix for fine registration, and T represents the translation transformation matrix. qi and pi are represented in coordinate form.
[0142] 3.4) Use the rigid body transformation matrix to perform a spatial transformation on the workpiece STL model after the first rigid body transformation, thereby obtaining the workpiece STL model after spatial transformation.
[0143] 4) Based on the workpiece STL model from step 3), generate a CAD solid model of the workpiece with internal defects.
[0144] The steps to generate a CAD solid model of a workpiece with internal defects include:
[0145] 4.1) Perform topological reconstruction on the STL model of the workpiece after spatial transformation to obtain the defect CAD solid model. The steps include:
[0146] 4.1.1) A three-axis block sorting algorithm (refer to Cui Shubiao, Zhang Yisheng, Liang Shuyun, Li Dequn. Fast filtering algorithm for redundant vertices in STL patches and its application. China Mechanical Engineering, 2001(02):173-175+117) is used to delete duplicate vertices. The steps include:
[0147] 4.1.1.1) Create vertex arrays X, Y, and Z, input the internal defect STL model, and read the three coordinate values (x, y, z) of one vertex at a time;
[0148] 4.1.1.2) Determine if a vertex has been saved based on its coordinate values: Check the x, y, and z coordinates in sequence. If the value does not exist in the corresponding vertex array, proceed to step 4.1.1.3). If the x coordinate exists, check if the y coordinate exists in the Y array pointed to by the x coordinate. Otherwise, proceed to step 4.1.1.3.
[0149] If coordinate y exists, then proceed to the Z array pointed to by coordinate y to check if coordinate z exists; otherwise, proceed to step 4.1.1.3.
[0150] If the coordinate z exists, the current coordinate value (x, y, z) is not saved, and step 4.1.1.1 is returned; otherwise, step 4.1.1.3 is performed.
[0151] 4.1.1.3) Save the coordinate values (x, y, z) into the corresponding X, Y, Z arrays and sort them;
[0152] The sorting rules are as follows: After saving the coordinate x, sort the X array and change the Y and Z arrays pointed to by the coordinate x accordingly; after saving the coordinate y, sort the Y array and change the Z array pointed to by the coordinate xy accordingly; after saving the coordinate z, sort the Z array.
[0153] 4.1.2) Establish vertex, edge, and face data tables;
[0154] The steps for creating a vertex data table include: starting from the X array, determining the y and z coordinates corresponding to each coordinate x, and adding them to the vertex table as new vertex coordinates (x, y, z);
[0155] The steps for creating an edge data table include: creating edges in pairs based on the coordinates of the three vertices of each grid; determining whether the created edges are in the edge data table; if not, establishing an index between the edge and the corresponding vertex in the vertex table, creating edge information, and adding the created edges to the edge data table.
[0156] The steps to create a face data table include: adding the face number and its corresponding normal vector, as well as the indices of the three vertices and three edges that make up the face, as face information to the face data table;
[0157] 4.1.3) Utilizing the topological relationships between the reconstructed triangular facets, with the edges as the core, all triangular vertices are reconstructed into entities. From the points to the edges, triangular faces are generated. All triangular faces are merged into a whole to obtain a closed spatial boundary. Based on the closed boundary surface, a defect CAD entity model is generated.
[0158] 4.2) Perform Boolean operations on the internal defect CAD solid model and the original workpiece CAD solid model to generate a CAD solid model of the defective workpiece.
[0159] Example 2:
[0160] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images includes the following steps:
[0161] 1. Three-dimensional segmentation and extraction of internal defects
[0162] (1) Input CT sequence images of a workpiece with internal defects from an industrial CT scan;
[0163] (2) Using a 3D CV model, volume data processing and STL model reconstruction were performed to obtain an STL model of the workpiece with internal defects. The results are as follows: Figure 3 ;
[0164] (3) STL model extraction of combustion chamber inserts and internal defects, the results are as follows: Figure 4 .
[0165] 2. Registration of the workpiece CAD solid model and the reconstructed model
[0166] (1) Delaunay triangulation was used to perform point cloudification of the combustion chamber insert CAD solid model, such as... Figure 5 ;
[0167] (2) Use the Fast Point Feature Histogram (FPFH) algorithm for coarse registration of point clouds;
[0168] (3) Fine registration of the point cloud was performed using the Iterative Closest Point (ICP) algorithm, and the results are as follows: Figure 6 The registration accuracy was tested and displayed, and the results are as follows: Figure 7 .
[0169] (4) The positional relationship between the internal defects and the original CAD solid model of the workpiece is obtained by performing a rigid body transformation on the internal defects, such as... Figure 8 .
[0170] 3. Generation of CAD solid models of workpieces with internal defects
[0171] (1) Internal defect STL model topology reconstruction, the CAD solid model after internal defect reconstruction is as follows: Figure 9 As shown;
[0172] (2) Perform Boolean operations between the internal defect CAD solid model and the original workpiece CAD solid model to generate a CAD solid model of the defective workpiece, such as... Figure 10 ;
[0173] (3) Import the reconstructed CAD solid model of the workpiece with internal defects into ANSYS finite element simulation software to verify the usability of the reconstructed model. The results are as follows: Figure 11 .
[0174] Example 3:
[0175] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images, the main steps of which are described in Example 2, including the 3D segmentation and extraction steps of internal defects:
[0176] The 3D CV model directly segments defects from volume data, obtaining the enclosed surface surrounding the internal defects. The spatial region composed of industrial CT sequence images is considered as consisting of a background and a target with approximately constant grayscale values, whose grayscale values are u0 and u0, respectively. b and u0 t At this point, a closed evolutionary surface C divides the spatial region, with the spatial regions inside and outside the surface denoted by in(C) and out(C), respectively. Let the grayscale value of any point on the spatial region be u0(x,y,z), then the energy function of the 3D CV model is:
[0177] F(C,c1,c2)=μArea(C)+νVolume(C)+λ1∫ in(c) |u0(x,y,z)-c1| 2 dxdydz+λ2∫ out(C) |u0(x,y,z)-c2| 2 dxdydz (1)
[0178] Where Area(C) represents the surface area of the evolving surface, Volume(C) represents the volume enclosed by the evolving surface, c1 and c2 represent the average pixel grayscale values inside and outside the evolving surface C, respectively, and constants μ, ν≥0, λ1, λ2>0, where λ1 and λ2 are usually taken as 1.
[0179] The process of surface evolution of the 3D CV model is to solve equation (1) to minimize its value. By introducing the symbolic distance function φ, the Heaviside function H, and the Dirac function δ, the time variable t is used to obtain the level set iterative expression of equation (1) as follows:
[0180]
[0181] By using the finite difference method to obtain the discrete iterative expression of equation (2), the three-dimensional volume data composed of industrial CT sequence slices can be segmented by programming.
[0182] The experimental steps for volume data processing and STL model reconstruction of the sample using a 3D CV model and the MC algorithm are as follows:
[0183] Step 1: Sequentially read the industrial CT sequence images of the workpiece with internal defects to obtain the three-dimensional volume data to be processed;
[0184] Step II: Set parameters μ,ν,λ1,λ2,Δt, and initialize the level set function φ0(x,y,z);
[0185] Step 3: Iterate the level set function continuously using a discrete iteration method until the termination condition is met;
[0186] Step IV: At intervals between iterations, use the MC algorithm to reconstruct isosurfaces for the zero-level set for display.
[0187] Step V: When the iteration terminates, save the triangular mesh STL model reconstructed by the MC algorithm for the next step of analysis.
[0188] For the STL model of a workpiece with internal defects obtained through triangular mesh surface reconstruction, it is necessary to extract the STL model of the internal defects. The workpiece surface and the internal defect surface are each enclosed by different triangular facets, forming different connected regions. The defect STL model can be extracted using connected component analysis. In the STL model composed of triangular facets, any side must be shared by two triangles. Regions with adjacent isosurfaces connected are considered as a whole. Through iterative merging, the entire isosurface is divided into independent connected regions. This method completes the calibration and extraction of the defect region and the workpiece itself. The specific implementation steps are as follows:
[0189] Step 1: Input the STL model of the defective workpiece and create an edge information table based on the vertex coordinates in the facets;
[0190] Step II: Using a certain triangular facet as a seed, mark it and add it to the facet queue;
[0191] Step 3: Take out the marked triangular facets from the queue one by one. Using the three edges of the facet as the starting point, find other unmarked facets that contain these edges and consider them as connected sets. Mark them and add them to the facet queue.
[0192] Step IV: When the queue is empty, all marked faces are treated as a connected region;
[0193] Step V: Repeat steps II-IV until all facets are marked;
[0194] Step VI: Extract the specified region and output the same marked patches as a new STL model.
[0195] Analysis of the STL model of the combustion chamber insert with pores showed that the area ratio of pore defects was 1.26% and the volume ratio was 0.27%. This experiment verifies that the present invention has a good effect on three-dimensional segmentation of small volume defects.
[0196] Example 4:
[0197] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images, the main steps of which are described in Example 2, including the registration step between the workpiece CAD solid model and the reconstructed model:
[0198] (1) Coarse registration implementation
[0199] The purpose of coarse registration is to make the poses of the source point cloud and the target point cloud as close as possible after rigid body transformation through initial registration. The Fast Point Feature Histogram (FPFH) algorithm has the advantages of fast solution speed and convenient application. This paper adopts the FPFH algorithm for coarse matching.
[0200] FPFH is an optimization of the computational complexity of Point Feature Histogram (PFH). PFH is based on the relationship between a center point and its neighborhood. It calculates the interaction between normals and uses four feature element values <α, φ, θ, d> to form a descriptor. Here, <α, φ, θ> represent the angular deviation of the normals between two points, and d = ||p2-p1||2 represents the Euclidean distance between two points. Finally, by calculating the descriptors between all two points in the neighborhood, a multi-dimensional histogram is formed to express the feature changes on the model surface.
[0201] For point cloud data with n points, if the number of points in the neighborhood of each point is k, then the theoretical computational complexity of PFH is O(nk). 2 FPFH only calculates the feature elements between the center point and its immediate neighbors within the neighborhood, forming a simplified point feature histogram (SPFH), thus improving computation speed. The calculation process is as follows:
[0202] Step I: Calculate only the query point P q Within its neighborhood, it is immediately adjacent to point P. i The characteristic elements between them form SPFH;
[0203] Step II: For P q Each neighboring point P in the neighborhood i Determine P i SPFH for the query point;
[0204] Step III: Use P q and all P i SPFH weighted calculation P q The weighted calculation formula for FPFH is as follows:
[0205]
[0206] Where, ω i It is query point P q With adjacent point P i The distance between points is a measure of the distance between them, representing the area occupied by each point pair (P). q ,P i The weight of ).
[0207] The FPFH algorithm quickly obtains the FPFH feature of a point within a point cloud. Its application in point cloud registration involves comparing the FPFH features of pairs of points in two point clouds to determine their similarity. The coarse registration algorithm process is as follows:
[0208] Step 1: Calculate FPFH. For the target point cloud Q and the source point cloud P, calculate the FPFH of the point cloud sets respectively;
[0209] Step II: Obtain sampling points. Sample the source point cloud P to obtain m points. In order to maximize the coverage of the sampling point cloud, limit the minimum distance between sampling points;
[0210] Step III: Find point pairs. Based on the sampling points in the source point cloud, find one or more corresponding points in the target point cloud with similar FPFH values, and randomly select one as a spatial transformation point pair;
[0211] Step IV: Spatial Transformation. Calculate the rigid body transformation matrix based on the selected point pairs, and perform a spatial transformation on the source point cloud to make it approximate the target point cloud.
[0212] (2) Precise registration is achieved
[0213] Fine registration builds upon coarse registration, bringing the poses of two point cloud models closer together to achieve the optimal matching position. Currently, the most widely used algorithm is the Iterative Closest Point (ICP) algorithm.
[22] The essence of this algorithm is optimal matching based on the least squares method. It performs an iterative process from determining the point set of correspondences to calculating the optimal rigid body transformation until the measurement error meets the set convergence accuracy or reaches the maximum number of iterations, thus ending the entire registration process.
[0214] Assume there exists a set of source point clouds. and target point cloud set For each point P in P i We search for the nearest point in X as the corresponding point, and let the set of corresponding points of P found in X be . The functional expression for the error measure is:
[0215]
[0216] Where R represents the rotation transformation matrix for fine registration, and T represents the translation transformation matrix.
[0217] For the target point cloud X and the source point cloud P, the registration process of the ICP algorithm is as follows:
[0218] Step 1: Select the corresponding point set. Calculate the nearest corresponding point set Q of the source point cloud P in the target point cloud X, such that P:Q=C(P,X), where C represents the nearest point.
[0219] Step II: Calculate the rigid body transformation matrices R and T from the corresponding point sets.
[0220] Step III: Position Information Transformation. Perform a rigid body transformation on the source point cloud according to the matrix in Step II to reach the new position.
[0221] Step IV: Calculate the change in error E for two consecutive transformations. k If the value is less than the given threshold τ, the iteration termination condition is met, and the registration process ends. Otherwise, the iteration count k = k + 1 is set. If k has not reached the maximum iteration count, the process returns to step I to continue iterating.
[0222] Example 5:
[0223] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images, the main steps of which are described in Example 2, wherein the steps for generating the CAD solid model of the workpiece with internal defects include:
[0224] (1) STL model topology reconstruction of internal defects
[0225] The STL file format, which represents a triangular mesh model, stores information about all the triangular faces used to approximate the CAD solid model. It includes the coordinates of the three vertices of each facet and the normal vector of the plane it occupies. The resulting spatial region is closed and bounded. Compared to CAD solid models expressed using Boundary Representation (B-Rep), STL models lack the topological relationships between triangular meshes, such as the association between edges and faces. Therefore, the key step in converting an STL model to a B-Rep solid model is reconstructing the topological relationships between triangular meshes. This reconstruction mainly involves two steps: deleting duplicate vertices and creating a table of vertex, face, and edge data.
[0226] Step 1: Remove duplicate vertices. The STL file repeatedly stores vertex information for connected surfaces. This duplicate vertex storage results in a large memory footprint for the STL file and reduces the efficiency of topology reconstruction. A three-axis block sorting algorithm is used to remove duplicate vertices.
[22] The specific implementation process is as follows:
[0227] (a) Create vertex arrays X, Y, Z, input an STL file, and read the three coordinate values (x, y, z) of one vertex at a time;
[0228] (b) Determine whether the vertex has been saved based on the coordinate values. Check the x, y, and z values in turn. If the value does not exist in the corresponding vertex array, proceed to (c). If the x value exists, check the y array pointed to by x. If y exists, check the z array pointed to by y. If z exists, proceed to (a).
[0229] (c) Save the x, y, and z values that were not saved in this step to the corresponding X, Y, and Z arrays, and sort them. The rule is as follows: if x is saved, sort the X array and change the Y and Z arrays it points to accordingly; if y is saved, sort the Y array and change the Z array it points to accordingly; if z is saved, sort the Z array.
[0230] Step II: Create vertex, edge, and face data tables
[0231] (a) Create a vertex data table. Based on the three coordinate value arrays X, Y, and Z obtained in step I, starting from the X array, determine the y and z coordinates corresponding to each x, and add them as a new vertex coordinate (x, y, z) to the vertex table;
[0232] (b) Create an edge data table. In the vertex coordinate table after deduplication in (a), create edges in pairs based on the coordinates of the three vertices of each grid, check if they are in the edge data table, and if not, create an index between this edge and the corresponding vertex in the vertex table, create the edge information, and add it to the edge data table;
[0233] (c) Create a face data table. Add the face number and its corresponding normal vector, along with the indices of the three vertices and three edges that make up the face, to the face data table as face information.
[0234] After completing the topological reconstruction of the STL model, in order to preserve the defect space information as much as possible, the topological relationship between the reconstructed triangular facets is directly used. Taking the edges as the core, all the triangular vertices are reconstructed into entities. From the points to the edges, triangular faces are generated. Then, all the triangular faces are merged into a whole, forming a closed spatial boundary just like the STL model. Finally, the B-Rep entity model is generated from the closed boundary surface.
[0235] (2) Boolean operations
[0236] This invention utilizes the Boolean operation function provided by the OpenCasCade open-source library to perform Boolean operations between three-dimensional entities, and finally reconstructs a three-dimensional CAD solid model of a workpiece with internal defects.
[0237] Example 6:
[0238] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images includes the following steps:
[0239] 1) Acquire CT sequence images of the defective workpiece;
[0240] 2) Process the CT sequence images of the defective workpiece to obtain the STL model of the workpiece;
[0241] 3) Register the original CAD solid model and the STL model of the workpiece, and perform spatial transformation on the STL model of the workpiece to obtain the spatially transformed STL model of the workpiece.
[0242] 4) Generate a CAD solid model of the workpiece with internal defects based on the STL model of the workpiece after spatial transformation.
[0243] Example 7:
[0244] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images is described in Example 6. The steps for processing the CT sequence images of the defective workpiece include:
[0245] The volume data of CT sequence images of defective workpieces are processed and STL model is reconstructed using a 3D CV model and the MC algorithm to obtain the STL model of the defective workpiece.
[0246] Example 8:
[0247] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images is described in Example 6. The steps of using a 3D CV model and the McLeod algorithm to perform volume data processing and STL model reconstruction on the CT sequence images of the defective workpiece include:
[0248] 1) Read the CT sequence images of the workpiece sequentially to obtain the three-dimensional volume data to be processed;
[0249] 2) Iteratively calculate the energy function using a 3D CV model to minimize the energy function;
[0250] 3) For each iteration T cycles, extract the zero level set of the 3D CV model and use the MC algorithm to reconstruct the isosurface of the zero level set;
[0251] 4) Determine if the number of iterations has reached the termination iteration count. If yes, output the STL model of the defective workpiece reconstructed by the MC algorithm; otherwise, return to step 3).
[0252] Example 9:
[0253] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images is described in Example 6. The energy function F(C,c1,c2) of the 3D CV model is shown below:
[0254] F(C,c1,c2)=μArea(C)+νVolume(C)+λ1∫ in(c) |u0(x,y,z)-c1| 2 dxdydz+λ2∫ out(C) |u0(x,y,z)-c2| 2 dxdydz (1)
[0255] Where Area(C) represents the surface area of the evolving surface, and Volume(C) represents the volume enclosed by the evolving surface; c1 and c2 represent the average pixel gray values inside and outside the evolving surface C, respectively; constants μ and ν ≥ 0, and constants λ1 and λ2 > 0; u0(x,y,z) is the gray value of any point on the spatial region.
[0256] Example 10:
[0257] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images is described in Example 6. The step of iteratively calculating the energy function using a 3D CV model includes:
[0258] 1) Set parameters μ, ν, λ1, λ2, and Δt, and initialize the level set function φ0(x,y,z);
[0259] 2) Establish the level set iterative expression for the energy function, i.e.:
[0260]
[0261] In the formula, φ is the symbolic distance function; H is the Heaviside function; and δ is the Dirac function. The gradient operator; u0 refers to u0(x,y,z);
[0262] 3) The discrete iterative expression of the level set iterative expression (2) is obtained by using the finite difference method, and the curve C is inverted by using the discrete iterative expression, so as to perform iterative calculation of the energy function.
[0263] Example 11:
[0264] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images is described in Example 6. The steps for extracting the STL model of the defective workpiece include:
[0265] 1) Establish an edge information table based on the vertex coordinates of each facet of the STL model of the defective workpiece;
[0266] 2) Select an unmarked triangular facet as the seed and mark it; add the marked triangular facet to the facet queue;
[0267] 3) Take the marked triangular facet from the queue, and using the three sides of the marked triangular facet as the starting point, find other unmarked facets that contain any side of the marked triangular facet, and mark these facets with the same mark as the marked triangular facet.
[0268] 4) Repeat step 3) until there are no more unmarked faces containing any edge of the marked triangle face;
[0269] 5) Check if the queue is empty. If it is, proceed to step 6); otherwise, return to step 2.
[0270] 6) Extract the specified region and output the facets with the same marking as a new STL model; the specified region is a connected region composed of facets with the same marking, including the workpiece surface region and several internal defect regions.
[0271] Example 12:
[0272] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images is described in Example 6. The main steps of registering the original CAD solid model and the workpiece STL model include:
[0273] 1) The original CAD solid model of the workpiece is converted into a point cloud using the Delaunay triangulation method to obtain the original point cloud model of the workpiece.
[0274] 2) Use the fast point feature histogram algorithm to perform coarse point cloud registration on the original point cloud model and the STL model of the workpiece to obtain the STL model of the workpiece after the first rigid body transformation.
[0275] 3) The point cloud model of the workpiece and the STL model of the workpiece after the first rigid body transformation are finely registered using the iterative nearest point algorithm to obtain the rigid body transformation matrix.
[0276] 4) Use the rigid body transformation matrix to perform a spatial transformation on the workpiece STL model after the first rigid body transformation, thereby obtaining the workpiece STL model after spatial transformation.
[0277] Example 13:
[0278] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images is described in Example 6. The method includes the step of coarsely registering the point clouds of the original CAD solid model and the workpiece STL model using a fast point feature histogram algorithm.
[0279] 1) For the target point cloud Q and the source point cloud P, calculate the FPFH of the point cloud set using formula (3), i.e.:
[0280]
[0281] In the formula, ω i It is query point p q and adjacent point p i The distance between points is measured by k, which is the average number of points in the neighborhood of each point. SPFH(p i ) and SPFH(p q ) are respectively p i and p q The values corresponding to the simplified feature histogram of the query point;
[0282] 2) Obtain sampling points: Sample the source point cloud P to obtain m points. In order to maximize the coverage of the sampling point cloud, limit the minimum distance between sampling points.
[0283] 3) Find point pairs: Based on the sampling points in the source point cloud, find one or more corresponding points in the target point cloud with similar FPFH, and randomly select one as a spatial transformation point pair;
[0284] 4) Spatial transformation: Calculate the rigid body transformation matrix based on the selected point pairs, and perform spatial transformation on the source point cloud to complete the coarse registration of the point cloud between the original point cloud model and the workpiece STL model.
[0285] Example 14:
[0286] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images is described in Example 6. The method includes the step of finely registering the point cloud of the original workpiece point cloud model and the workpiece STL model after the first rigid body transformation using an iterative nearest-point algorithm.
[0287] 1) Let the point cloud set of the workpiece STL model after the first rigid body transformation be denoted as . The point cloud set of the original point cloud model of the workpiece is N p N x Points;
[0288] 2) For point P i Search for the nearest point in the point cloud set X as the corresponding point and write it into the corresponding point set. N; q Points;
[0289] 3) Calculate the rotation transformation matrix R and translation transformation matrix T for precise registration based on the corresponding point set Q;
[0290] 4) Perform rigid body transformation on the internal defect STL model after the first rigid body transformation based on the finely registered rotation transformation matrix R and translation transformation matrix T;
[0291] 5) Calculate the error change E between two consecutive transformations. k If the error change E k If the value is less than the given threshold τ, the registration process ends; otherwise, it is determined whether the number of iterations k has reached the maximum number of iterations. If so, the registration process ends; otherwise, the number of iterations k = k + 1 is set, and the process returns to step 1.
[0292] The error measure function E(R,T) after the rigid body transformation is shown below:
[0293]
[0294] In the formula, R represents the rotation transformation matrix for fine registration, and T represents the translation transformation matrix.
[0295] Example 15:
[0296] A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images is described in Example 6. The steps for generating the CAD solid model of the workpiece with internal defects include:
[0297] 1) Perform topological reconstruction on the STL model of the workpiece after spatial transformation to obtain the CAD solid model of internal defects. The steps include:
[0298] 1.1) Use the three-axis block sorting algorithm to remove duplicate vertices. The steps include:
[0299] 1.1.1) Create vertex arrays X, Y, Z, input the internal defect STL model, and read the three coordinate values (x, y, z) of one vertex at a time;
[0300] 1.1.2) Determine if a vertex has been saved based on its coordinate values: Check the x, y, and z coordinates in sequence. If the value does not exist in the corresponding vertex array, proceed to step 1.1.3). If the x coordinate exists, check if the y coordinate exists in the Y array pointed to by the x coordinate. Otherwise, proceed to step 1.1.3.
[0301] If coordinate y exists, then proceed to the Z array pointed to by coordinate y to check if coordinate z exists; otherwise, proceed to step 1.1.3.
[0302] If the coordinate z exists, the current coordinate value (x, y, z) is not saved, and step 1.1.1 is returned; otherwise, proceed to step 3.
[0303] 1.1.3) Save the coordinate values (x, y, z) into the corresponding X, Y, Z arrays and sort them;
[0304] The sorting rules are as follows: After saving the coordinate x, sort the X array and change the Y and Z arrays pointed to by the coordinate x accordingly; after saving the coordinate y, sort the Y array and change the Z array pointed to by the coordinate xy accordingly; after saving the coordinate z, sort the Z array.
[0305] 1.2) Establish vertex, edge, and face data tables;
[0306] The steps for creating a vertex data table include: starting from the X array, determining the y and z coordinates corresponding to each coordinate x, and adding them to the vertex table as new vertex coordinates (x, y, z);
[0307] The steps for creating an edge data table include: creating edges in pairs based on the coordinates of the three vertices of each grid; determining whether the created edges are in the edge data table; if not, establishing an index between the edge and the corresponding vertex in the vertex table, creating edge information, and adding the created edges to the edge data table.
[0308] The steps to create a face data table include: adding the face number and its corresponding normal vector, as well as the indices of the three vertices and three edges that make up the face, as face information to the face data table;
[0309] 1.3) Utilizing the topological relationships between the reconstructed triangular facets, with the edges as the core, all triangular vertices are reconstructed into entities. From the points to the edges, triangular faces are generated. All triangular faces are merged into a whole to obtain a closed spatial boundary. Based on the closed boundary surface, a defect CAD entity model is generated.
[0310] 2) Perform Boolean operations on the internal defect CAD solid model and the original workpiece CAD solid model to generate a CAD solid model of the defective workpiece.
Claims
1. A method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images, characterized in that, Includes the following steps: Step 1) Obtain CT sequence images of the defective workpiece; Step 2) Process the CT sequence images of the defective workpiece to obtain the STL model of the workpiece; Step 3) Register the original CAD solid model and the STL model of the workpiece, and perform spatial transformation on the STL model of the workpiece to obtain the spatially transformed STL model of the workpiece. Step 4) Generate a CAD solid model of the workpiece with internal defects based on the STL model of the workpiece after spatial transformation; The steps for processing CT sequence images of defective workpieces include: The volume data processing and STL model reconstruction of CT sequence images of defective workpieces were performed using a 3D CV model and the MC algorithm to obtain the STL model of the defective workpiece. The steps for volume data processing and STL model reconstruction of CT sequence images of defective workpieces using 3D CV models and MC algorithms include: S1) Read the CT sequence images of the workpiece sequentially to obtain the three-dimensional volume data to be processed; S2) Iteratively calculate the energy function using a 3D CV model to minimize the energy function; S3) For each iteration T cycle, extract the zero level set of the 3D CV model and use the MC algorithm to reconstruct the isosurface of the zero level set; S4) Determine if the iteration count has reached the termination iteration count. If yes, output the STL model of the defective workpiece reconstructed by the MC algorithm; otherwise, return to step 3). The energy function of the 3D CV model As shown below: (1) in, Represents the surface area of the evolving surface. Represents the volume enclosed by the evolving surface; Representing the evolution surfaces Average pixel grayscale values (internal and external); constant ,constant ; The gray value is the gray value of any point in the spatial region.
2. The method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images according to claim 1, characterized in that, The steps for iteratively calculating the energy function using a 3D CV model include: Step 1) Set parameters ,parameter ,parameter ,parameter ,parameter Initialize level set function ; Step 2) Establish the level set iterative expression for the energy function, i.e.: (2) In the formula, The symbolic distance function; For the Heaviside function; For Dirac functions; For gradient operators; Reference ; Step 3) Use the finite difference method to obtain the discrete iterative expression of the level set iterative expression (2), and use the discrete iterative expression to invert the curve C, thereby performing iterative calculation of the energy function.
3. The method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images according to claim 1, characterized in that, The steps for extracting an STL model of a defective workpiece include: Step 1) Establish an edge information table based on the vertex coordinates of each facet of the STL model of the defective workpiece; Step 2) Select an unmarked triangular facet as a seed and mark it; add the marked triangular facet to the facet queue; Step 3) Take out the marked triangular facet from the queue, and using the three sides of the marked triangular facet as the starting point, find other unmarked facets that contain any side of the marked triangular facet, and mark these facets with the same mark as the marked triangular facet. Step 4) Repeat step 3) until there are no more unmarked faces containing any edge of the marked triangle face; Step 5) Check if the queue is empty. If it is, proceed to step 6; otherwise, return to step 2. Step 6) Extract the specified region and output the facets with the same marking as a new STL model; the specified region is a connected region composed of facets with the same marking, including the workpiece surface region and several internal defect regions.
4. The method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images according to claim 1, characterized in that, The steps for registering the original CAD solid model and the STL model of the workpiece include: Step 1) Use the Delaunay triangulation method to convert the original CAD solid model of the workpiece into a point cloud, and obtain the original point cloud model of the workpiece. Step 2) Use the fast point feature histogram algorithm to perform coarse point cloud registration on the original point cloud model and the STL model of the workpiece to obtain the STL model of the workpiece after the first rigid body transformation. Step 3) Use the iterative nearest point algorithm to perform fine registration of the point cloud model of the workpiece and the STL model of the workpiece after the first rigid body transformation to obtain the rigid body transformation matrix. Step 4) Use the rigid body transformation matrix to perform a spatial transformation on the workpiece STL model after the first rigid body transformation, thereby obtaining the workpiece STL model after spatial transformation.
5. The method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images according to claim 4, characterized in that, The steps for coarse point cloud registration of the original CAD solid model and the STL model of the workpiece using the fast point feature histogram algorithm include: Step 1) For the target point cloud Q and the source point cloud P, calculate the FPFH of the point cloud set using formula (3), i.e.: (3) In the formula, It is a query point and adjacent points The distance between points is measured by k, where k is the average number of points in the neighborhood of each point. and They are respectively based on and The values corresponding to the simplified feature histogram of the query point; Step 2) Obtain sampling points: Sample the source point cloud P to obtain m points. In order to maximize the coverage of the sampling point cloud, limit the minimum distance between sampling points. Step 3) Find point pairs: Based on the sampling points in the source point cloud, find one or more corresponding points in the target point cloud with similar FPFH, and randomly select one as a spatial transformation point pair; Step 4) Spatial transformation: Calculate the rigid body transformation matrix based on the selected point pairs, and perform spatial transformation on the source point cloud to complete the coarse registration of the point cloud of the original workpiece point cloud model and the workpiece STL model.
6. The method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images according to claim 4, characterized in that, The steps for fine point cloud registration of the original point cloud model and the STL model of the workpiece after the first rigid body transformation using the iterative nearest point algorithm include: Step 1) Let the point cloud set of the workpiece STL model after the first rigid body transformation be denoted as . The point cloud set of the original point cloud model of the workpiece is ; , Points; Step 2) For point P i Search for the nearest point in the point cloud set X as the corresponding point and write it into the corresponding point set. middle; Points; Step 3) Calculate the rotation transformation matrix for fine registration based on the corresponding point set Q. Translation matrix ; Step 4) Based on the finely registered rotation transformation matrix Translation matrix Perform a rigid body transformation on the STL model of the internal defect after the first rigid body transformation. Step 5) Calculate the error change between two adjacent transformations. If the error changes Less than a given threshold If the registration process ends, then the registration process ends; otherwise, the number of iterations is checked. Check if the maximum number of iterations has been reached. If so, end the registration process; otherwise, set the iteration count to zero. And return to step 1); Wherein, the error measure function after the current rigid body transformation As shown below: (4) In the formula, Represents the rotation transformation matrix for fine registration. This represents the translation transformation matrix.
7. The method for reconstructing a 3D CAD solid model of a workpiece with internal defects based on industrial CT images according to claim 4, characterized in that, The steps to generate a CAD solid model of a workpiece with internal defects include: Step 1) Perform topology reconstruction on the STL model of the workpiece after spatial transformation to obtain the CAD solid model of internal defects. The steps include: Step 1.1) Use the three-axis block sorting algorithm to remove duplicate vertices. The steps include: Step 1.1.1) Create vertex arrays X, Y, and Z. Input the internal defect STL model and read the three coordinate values of one vertex at a time. ; Step 1.1.2) Determine if the vertex has been saved based on its coordinate values: (Based on coordinate values...) The values are checked sequentially. If the value does not exist in the corresponding vertex array, proceed to step 1.1.3). If the coordinates... If the value exists, then the coordinates are rotated. The Y array points to determine the coordinates If it exists, otherwise proceed to step 1.1.3). If coordinates If it exists, then turn to coordinates. The Z array points to determine the coordinates If it exists, otherwise proceed to step 1.1.3). If coordinates If it exists, the current coordinate value will not be saved. If the condition is met, return to step 1.1.1; otherwise, proceed to step 3. Step 1.1.3) Set the coordinate values Save the data to the corresponding X, Y, Z arrays and sort them. The sorting rule is: save coordinates Then, sort the X array and transform the coordinates accordingly. Points to the Y and Z arrays; stores the coordinates Then, sort the Y array and transform the coordinates accordingly. Points to the Z array; stores coordinates Then, sort the Z array; Step 1.2) Create vertex, edge, and face data tables; The steps for creating the vertex data table include: determining each coordinate based on the X array. The corresponding y and z coordinates are used as the coordinates of the new vertex. Add to the vertex table; The steps for creating an edge data table include: creating edges in pairs based on the coordinates of the three vertices of each grid; determining whether the created edges are in the edge data table; if not, establishing an index between the edge and the corresponding vertex in the vertex table, creating edge information, and adding the created edges to the edge data table. The steps to create a face data table include: adding the face number and its corresponding normal vector, as well as the indices of the three vertices and three edges that make up the face, as face information to the face data table; Step 1.3) Utilize the topological relationships between the reconstructed triangular facets, with the edges as the core, to reconstruct all the triangular vertices into entities. Generate triangular faces from points to edges, merge all the triangular faces into a whole, and obtain a closed spatial boundary. Generate a defect CAD entity model based on the closed boundary surface. Step 2) Perform Boolean operations on the internal defect CAD solid model and the original workpiece CAD solid model to generate a CAD solid model of the defective workpiece.
Citation Information
Patent Citations
In-process evaluation based complex spatial surface error feedback compensating method
CN103218475A
Point cloud curved surface segmentation method based on IGES model guidance
CN113658184A