问询:3D扫描PLY网格孔隙结构最长轴方向角度量化方法
Hey Mathieu, great question—measuring the orientation of pore structures is super valuable for fields like materials science, geotechnics, and porous media research. I’ve got practical methods to do this with your current tool (MeshLab) plus some alternatives that offer more flexibility for batch processing or custom workflows.
Using MeshLab (Your Current Tool)
MeshLab can handle this with a few built-in filters, though you’ll need to split your mesh into individual connected components first, then compute orientation metrics for each.
Step 1: Split Mesh into Connected Components
First, separate your single pore mesh into its disconnected parts:
- Go to
Filters > Remeshing, Simplification and Reconstruction > Split Mesh into Connected Components - This will automatically create a new mesh layer for each isolated pore component in your workspace.
Step 2: Compute Principal Axes (Longest Axis) for Each Component
For each component layer:
- Select the component mesh in the Layer dialog.
- Run
Filters > Quality Measures and Computations > Compute Geometric Measures - In the output log (bottom pane of MeshLab), look for the Inertia Tensor section. The longest axis corresponds to the eigenvector associated with the largest eigenvalue. MeshLab will output the eigenvectors as three 3D vectors (e.g.,
Eigenvector 0: (x,y,z)which is the longest axis).
Step 3: Convert Vector to Angle
To get the angle of the longest axis relative to a reference (like the X/Y/Z axis), use basic trigonometry. For example, the angle between the longest axis vector (vx, vy, vz) and the X-axis is:
angle_x = arccos(vx) * (180/π)
You can calculate this manually or use a quick spreadsheet script for batch processing.
Batch Processing Tip
If you have hundreds of components, manual processing is tedious. Use MeshLab’s MLX scripting to automate the workflow:
- Record a macro of the split + compute steps.
- Save it as an
.mlxfile, then modify it to loop through all components and export results to a text file.
Alternative Tools for More Flexibility
If you need to scale up or customize the analysis, these tools are great options:
Open3D (Python)
Perfect for code-driven batch processing. You can load your PLY mesh, split components, and compute principal axes in just a few lines:
import open3d as o3d import numpy as np # Load your pore mesh mesh = o3d.io.read_triangle_mesh("your_pores.ply") # Split into connected components cluster_labels = mesh.cluster_connected_triangles()[0] unique_components = np.unique(cluster_labels) # Iterate through each component for idx, label in enumerate(unique_components): # Extract the component mesh component_triangles = np.where(cluster_labels == label)[0] component = mesh.select_by_index(component_triangles) # Compute principal axes (longest axis is first eigenvector) pca_results = component.compute_principal_components() longest_axis = pca_results.principal_components[:, 0] # Calculate angle relative to X-axis (convert radians to degrees) angle_with_x = np.arccos(np.dot(longest_axis, [1, 0, 0])) * 180 / np.pi print(f"Component {idx}: Longest axis angle (X-axis): {angle_with_x:.2f}°")
CloudCompare
A user-friendly GUI tool with strong mesh analysis features:
- Load your PLY mesh.
- Use
Edit > Split > Split mesh into connected componentsto separate pores. - For each component, run
Tools > Analysis > Compute geometric features—this will directly output principal axis orientations and even angle metrics relative to the coordinate system. You can export all results to a CSV file for further analysis.
MATLAB
If you’re familiar with MATLAB, you can convert your mesh to a point cloud and use built-in functions:
- Use
readplyto load the mesh, then convert to a point cloud withpointCloud. - Use
regionprops3to identify connected components and compute their principal axes. TheOrientationproperty gives the angles of the principal axes relative to the coordinate system.
Key Notes
- Clean Your Mesh First: Remove tiny noise components with MeshLab’s
Filters > Cleaning and Repairing > Remove Isolated Piecesto avoid skewing your orientation data. - Coordinate System Alignment: Make sure your mesh’s coordinate system matches the real-world orientation of your sample. If not, use
Filters > Transformation > Rotatein MeshLab to adjust it before analysis.
内容的提问来源于stack exchange,提问作者Mathieu Leclerc

