I want to visualize the created meshes through MeshLab from the out['face_uvm']. I need to change this UV map to a mesh using the provided code. But I couldn't find uv_triangles path in the code. What should be the path to it. Below is the code I am using:
Code
import numpy as np
import trimesh
def uvm2mesh(uv_position_map, only_foreface=True, is_extra_triangle=False):
"""
If no texture map is provided, translate the position map to a point cloud
:param uv_position_map:
:param only_foreface:
:param is_extra_triangle:
:return:
"""
uv_h, uv_w = UV_MAP_SIZE, UV_MAP_SIZE
vertices = []
colors = []
triangles = []
triangles = [[t[0] * uv_w + t[1], t[4] * uv_w + t[5], t[2] * uv_w + t[3], ] for t in uv_triangles]
for i in range(uv_h):
for j in range(uv_w):
vertices.append(uv_position_map[i][j])
colors.append([25, 25, 50, 128])
vertices = np.array(vertices)
triangles = np.array(triangles)
colors = np.array(colors)
face_mesh = trimesh.Trimesh(vertices=vertices, faces=triangles)
return face_mesh
I want to visualize the created meshes through MeshLab from the
out['face_uvm']
. I need to change this UV map to a mesh using the provided code. But I couldn't find uv_triangles path in the code. What should be the path to it. Below is the code I am using:Code