def meshPlay(folder, every=100, wait=0.05): files = glob.glob(folder + '/*') files.sort() files = files[-1000:] view = MeshViewer() for i in range(0, len(files), every): mesh = Mesh(filename=files[i]) view.dynamic_meshes = [mesh] time.sleep(wait)
mesh.v /= 1e3 n_vertices = len(mesh.v) prediction_vertex_values = np.arange(n_vertices) minima = min(prediction_vertex_values) maxima = max(prediction_vertex_values) norm = matplotlib.colors.Normalize(vmin=minima, vmax=maxima, clip=True) mapper = cm.ScalarMappable(norm=norm, cmap=cm.viridis) mapper_list = [mapper.to_rgba(x)[0] for x in prediction_vertex_values] mesh.vc = mapper_list mv = MeshViewer() mv.dynamic_meshes = [mesh] time.sleep(100) mv.save_snapshot( '/home/eman/Documents/PhD/pytorch_geometric-master/examples/reference-mesh.png' ) #################################################################### if args.case == 'MPI': data_path = '/home/eman/Documents/PhD/body-modeling-master_initial/smpl-viewer/Data-survey-smpl/AllData/' dirs = os.listdir(data_path) dirs.sort() print(dirs) meshes = []
for i in range(len(objFiles)): #Displaying original faces #i = 24 originalMeshFile = Mesh(filename=path + objFiles[i]) originalMeshFile.texture_filepath = path + bmpFiles[i] leftVerts = originalMeshFile rightVerts = originalMeshFile #print vars(leftVerts) name = (objFiles[i])[:-4] mv = MeshViewer() mv.dynamic_meshes = [originalMeshFile] time.sleep(0.3) mv.save_snapshot(saving_path + name + '_frontal.png') #time.sleep(0.1) #mv. #Left view newleftVerts = (np.dot(rotation_matrix(axis, theta_l), (leftVerts.v).transpose())) leftVerts.v = newleftVerts.transpose() #mv_l = MeshViewer() mv.dynamic_meshes = [leftVerts] time.sleep(0.3) mv.save_snapshot(saving_path + name + '_left.png') #write_mesh('left.obj',vertices=leftVerts.v, faces=leftVerts.f, normals=None, texcoords=None, overwrite=True)