Created
July 20, 2020 18:17
-
-
Save wkentaro/9c46bafe2ba7fb7350c7ce5c206dcdb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import trimesh | |
import pickpp | |
models = pickpp.datasets.YCBVideoModelDataset() | |
# cad_ids = models.get_cad_ids(class_id=15) | |
cad_ids = models.get_cad_ids(class_id=20) | |
visual_file = models.get_cad_file_from_id(cad_ids[0]) | |
collision_file = pickpp.utils.get_collision_file(visual_file) | |
print(visual_file) | |
print(collision_file) | |
visual = trimesh.load(visual_file) | |
collision = trimesh.load( | |
collision_file, split_object=True, group_material=False | |
) | |
if isinstance(collision, trimesh.Scene): | |
for name, geometry in collision.geometry.items(): | |
geometry.visual.vertex_colors = np.random.random((3,)) | |
else: | |
collision.visual.vertex_colors = np.random.random((3,)) | |
scene = trimesh.Scene() | |
scene.add_geometry(collision) | |
scene.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment