Is there a way to get the individual segments?
Hello!
Is there a way to save the individual segments as separate meshes?
Thanks!
Hi, you can amend this function, to output different meshes based on the face labels https://github.com/clinplayer/SEG-MAT/blob/400ee4d6901987606c542219ff93a2d3cc44c049/src/Decomposer.cpp#L35
You can also try to use the colors of the output mesh to categorize the face triangles, here is a simple code with Python. Note it is for obj and you can slightly change it to adapt the off format.
import numpy as np
import trimesh
def process_obj(filename):
mesh = trimesh.load_mesh(filename)
vertex_colors = np.array(mesh.visual.vertex_colors)
vertex_colors = np.round(vertex_colors).astype(int)
face_classes = []
# For each face, finds its category id
for face in mesh.faces:
face_color = vertex_colors[face[0]]
face_class = None
for i, c in enumerate(face_classes):
if np.array_equal(c, face_color):
face_class = i
break
if face_class is None:
face_classes.append(face_color)
face_class = len(face_classes) - 1
Awesome, thanks!
Also, does the qmat code have a command line interface? I can't seem to find one in the source.
I'm afraid not. But you can download the source code provided by the author and convert it to command line interface
https://binwangthss.github.io/qmat/qmat.html