What is the use of Armadillo-meshes and knotMeshes in open3d? - python

Since I am still a beginner with open3d and still reading the documentation. Nowhere seems to be a clear explanation for Armadillo mesh class in open3d neither for knot mesh.
Why are they different types of meshes and what are the cases one should use them?

The reason behind the existence of these classes is explained in their GitHub repository as
The Dataset classes in Open3D are designed for convenient access to "built-in" example and test data.
Example usages of Armadillo mesh include surface deformations (ARAP), mesh optimization (Laplacian Mesh Optimization), skeleton extraction (Skeleton Extraction by Mesh Contraction), and key point detection (Intrinsic shape signatures (ISS)).
I haven't used a knot mesh before, but I believe that it is useful for applications in knot theory.
If you want to visualize the meshes and understand the difference better, you can do it the following way.
import open3d as o3d
knot_data = o3d.data.KnotMesh()
mesh = o3d.io.read_triangle_mesh(knot_data.path)
mesh.compute_vertex_normals() # for better visualization
o3d.visualization.draw_geometries([mesh])
armadillo_data = o3d.data.ArmadilloMesh()
mesh = o3d.io.read_triangle_mesh(armadillo_data.path)
o3d.visualization.draw_geometries([mesh])

Related

Represent hairstyle using open3d

I need to visualize a set of hairstyles in 3D using open3d (or any similar package, if that makes things easier). In particular, I am looking for a way to visualize one of the hairstyles of the USC-HairSalon dataset available here.
Each hairstyle consists of 10.000 hair strands, with each strand made of 100 points. In Blender, hairstyles can be represented in 3D using the script available here.
Do you have any suggestions on what could be an efficient way to represent all hair strands? Each dataset is stored in a .data file and needs to be processed before being rendered.
To load the reference head, I am using a few lines of code:
import open3d as o3d
mesh = o3d.io.read_triangle_mesh("./USC-HairSalon_dataset/Raw_data/head_model.obj")
mesh.compute_vertex_normals()
o3d.visualization.draw_geometries([mesh])

How to clean up the mesh in Open3D?

I created surface mesh from 3D cloud points using Open3D library in python. I have a lot of cases where the domains are similar to each other. For most of the cases, the open3D does a fine job in creating a closed surface mesh, but for few cases it creates some outlier meshes from the domain.
Below is the code for surface mesh from Open3D.
pcd = o3d.io.read_point_cloud('./mesh.xyz')
pcd.estimate_normals()
# to obtain a consistent normal orientation
pcd.orient_normals_towards_camera_location(pcd.get_center())
pcd.normals = o3d.utility.Vector3dVector( - np.asarray(pcd.normals))
# surface reconstruction using Poisson reconstruction
mesh, _ = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(pcd, depth=9)
o3d.io.write_triangle_mesh('mesh.stl', mesh)
I have attached pics of the outlier mesh obtained from the domain. How to clean those mesh from Open3D?. This occurs for only few of the test cases. We can easily see in the outlier image how the mesh is outside the domain.
Any leads will be appreciated.
Regards,
Sunag R A.
You can use Open3D Connected-components to remove outliers.
Example link -
http://www.open3d.org/docs/release/tutorial/geometry/mesh.html#Connected-components
Note - Please remove the duplicate vertices from mesh before using Connected-components.

Noisy 3D point cloud to interpolated surface mesh in python

My general goal is going from a noisy point cloud describing a surface, to a regular surface mesh, in Python. I have found a few solution to this problem, none of which apply to my case well enough. The best ones I found:
B-spline -> sample it -> get new points. This calculates the z values of a function based on a regular set of x,y coordinates, which won't work well for near-vertical surfaces, of which I have a lot.
Rolling ball / convex hull algorithms. My data is noisy along the normal to the surface, so I would get a surface that's "inflated". I would need first to denoise it, which itself requires the calculation of a spline, or something similar.
I feel like there must be an "easy" way to do this, but I just don't know what to look for. Can someone point me in the right direction?
My best guess is that there should be a way to sample a spline surface "regularly" relatively to itself, but I can't figure out how.
The problem which you describe is named surface reconstruction. There is many algorithms and software (standalone program or libraries) able to reconstruct one surface from a set of sample points. There is important differences depending if you have only the XYZ coordinates of the points, or you have more information as the color or the normal to the surface.
Naming some examples, you can use:
Screened Poisson, by Kazhdan and Bolitho. Which is implemented in meshlab, and many other python libraries. Probably your best option.
PowerCRUST, by Nina Amenta, Sunghee Choi and Ravi Kolluri.
Ball Pivoting, by Bernardini, Mittleman, et al. Quite simple and easy to implement by yourself.

Change the origin of a 3D mesh vtk

I'm working with 3D meshes using vtk. I want to apply the scale transformation filter but it works holding, as a reference, the origin of the mesh. Now I would like to apply the same transformation but using a different fixed point.
The idea is to change the origin of the mesh to that point and than to apply the filter. Is it possible in vtk or with other libraries? Is there another method that works better?
I attach here two images that explain the problem.
Thank you in advance!

How to determine and extract surface points of 3D object?

I have a 3D object which is not hollow, so there are many 3D points. How would you determine which of these points of such an object (especially with a very curvaceous surface) are on the surface? I understand how to extract them, but I need either a function somewhat like libraryUNK.surfacePoint... Which I don't know.
Or better an understanding of what is considered to be a surface point, which I don't know either and couldn't (yet) develop (for myself) any proper definition.
I know I can do triangulation to get the surface. But I don't get what to do next, as I will be left now with a set of triangles, some of which are on the surface, some of which are not... but again I have no definition how to consider what's on surface and what is not...
It seems to me that you want to compute the convex hull of your 3D points cloud.
It's not an easy problem, but there's plently of solutions (and algorithms) to do that. One of the efficients one is called "convex hull". There's a ConvexHull function in scipy.spatial.
Here is the details with an example (2D, but it works in any dimension)
http://scipy.github.io/devdocs/generated/scipy.spatial.ConvexHull.html
This function use the QHull library
http://www.qhull.org/
There's plently of ressources on the QHull page. There's also a Wikipedia page (Again, this is not the only method to compute convex hulls, you may want to try others):
https://en.wikipedia.org/wiki/Quickhull
Edit: after re-reading the question, it seems your volume may not be convex. Unfortunately, if it isn't, there's no way to tell whether a point is inside the volume or in the surface without additional informations on the volume or on the points cloud.

Categories