当前位置: 首页>>代码示例>>Python>>正文


Python pymesh.save_mesh方法代码示例

本文整理汇总了Python中pymesh.save_mesh方法的典型用法代码示例。如果您正苦于以下问题:Python pymesh.save_mesh方法的具体用法?Python pymesh.save_mesh怎么用?Python pymesh.save_mesh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymesh的用法示例。


在下文中一共展示了pymesh.save_mesh方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: isolate_files

# 需要导入模块: import pymesh [as 别名]
# 或者: from pymesh import save_mesh [as 别名]
def isolate_files():
    """
    Utility fonction to generate the metro_file archive. Useless to all users but the author.
    """
    with open('./dataset/data/metro_files/files-metro.txt', 'r') as file:
        files = file.read().split('\n')
    for file in files:
        if file[-3:] == "ply":
            cat = file.split('/')[0]
            name = file.split('/')[1][:-4]
            path_points = '/'.join(['.', 'dataset', 'data', 'ShapeNetV1PointCloud', cat, name + '.points.ply.npy'])
            path_png = '/'.join(['.', 'dataset', 'data', 'ShapeNetV1Renderings', cat, name, "rendering", '00.png'])

            path_obj = '/'.join(['', 'home', 'thibault', 'hdd', 'data', 'ShapeNetCore.v1', cat, name, 'model.obj'])
            mesh = pymesh.load_mesh(path_obj)
            points = np.load((path_points))
            if not exists('/'.join(['.', 'dataset', 'data', 'metro_files', cat])):
                os.mkdir('/'.join(['.', 'dataset', 'data', 'metro_files', cat]))

            pymesh.save_mesh('/'.join(['.', 'dataset', 'data', 'metro_files', cat, name + '.ply']), mesh, ascii=True)
            np.save('/'.join(['.', 'dataset', 'data', 'metro_files', cat, name + '.npy']), points)
            copy(path_png, '/'.join(['.', 'dataset', 'data', 'metro_files', cat, name + '.png'])) 
开发者ID:ThibaultGROUEIX,项目名称:AtlasNet,代码行数:24,代码来源:metro.py

示例2: shuffle_pc

# 需要导入模块: import pymesh [as 别名]
# 或者: from pymesh import save_mesh [as 别名]
def shuffle_pc(file, output_path):
    """
    Function to shuffle a point cloud produced by virtual scanner.
    """
    mesh = pymesh.load_mesh(file)
    vertices = copy.deepcopy(mesh.vertices)
    permutation = np.random.permutation(len(vertices))
    vertices = vertices[permutation]
    new_mesh = pymesh.meshio.form_mesh(vertices, mesh.faces)
    new_mesh.add_attribute("vertex_nx")
    new_mesh.set_attribute("vertex_nx", mesh.get_vertex_attribute("vertex_nx")[permutation])
    new_mesh.add_attribute("vertex_ny")
    new_mesh.set_attribute("vertex_ny", mesh.get_vertex_attribute("vertex_ny")[permutation])
    new_mesh.add_attribute("vertex_nz")
    new_mesh.set_attribute("vertex_nz", mesh.get_vertex_attribute("vertex_nz")[permutation])
    pymesh.save_mesh(output_path, new_mesh, ascii=True, anonymous=True, use_float=True, *new_mesh.get_attribute_names()) 
开发者ID:ThibaultGROUEIX,项目名称:AtlasNet,代码行数:18,代码来源:shuffle.py

示例3: downsample_pointcloud

# 需要导入模块: import pymesh [as 别名]
# 或者: from pymesh import save_mesh [as 别名]
def downsample_pointcloud(pc_path, point_num):
    mesh_raw = pymesh.load_mesh(pc_path)
    points_raw = mesh_raw.vertices
    if points_raw.shape[0] > point_num:
        point_subset = np.random.choice(points_raw.shape[0], point_num, replace=False)
        points = points_raw[point_subset]
    else:
        points = points_raw
    mesh = pymesh.form_mesh(points, np.ones((0, 3)))
    pymesh.save_mesh(join(dirname(pc_path), 'compressed.ply'), mesh) 
开发者ID:YoungXIAO13,项目名称:ObjectPoseEstimationSummary,代码行数:12,代码来源:pointclouds.py

示例4: output_patch_coords

# 需要导入模块: import pymesh [as 别名]
# 或者: from pymesh import save_mesh [as 别名]
def output_patch_coords(subv, subf, subn, i, neigh_i, theta, rho): 
    """ 
        For debugging purposes, save a patch to visualize it.
    """ 
    
    mesh = pymesh.form_mesh(subv, subf)
    n1 = subn[:,0]
    n2 = subn[:,1]
    n3 = subn[:,2]
    mesh.add_attribute('vertex_nx')
    mesh.set_attribute('vertex_nx', n1)
    mesh.add_attribute('vertex_ny')
    mesh.set_attribute('vertex_ny', n2)
    mesh.add_attribute('vertex_nz')
    mesh.set_attribute('vertex_nz', n3)

    rho = np.array([rho[0,ix] for ix in range(rho.shape[1]) if ix in neigh_i])
    mesh.add_attribute('rho')
    mesh.set_attribute('rho', rho)

    theta= np.array([theta[ix] for ix in range((theta.shape[0])) if ix in neigh_i])
    mesh.add_attribute('theta')
    mesh.set_attribute('theta', theta)

    charge = np.zeros(len(neigh_i))
    mesh.add_attribute('charge')
    mesh.set_attribute('charge', charge)

    pymesh.save_mesh('v{}.ply'.format(i), mesh, *mesh.get_attribute_names(), use_float=True, ascii=True)

#@jit 
开发者ID:LPDI-EPFL,项目名称:masif,代码行数:33,代码来源:compute_polar_coordinates.py

示例5: save

# 需要导入模块: import pymesh [as 别名]
# 或者: from pymesh import save_mesh [as 别名]
def save(mesh, path, colormap):
    try:
        vertex_sources = mesh.get_attribute("vertex_sources")  # batch, nb_prim, num_point, 3
        if vertex_sources.max() > 0:
            vertex_sources = (255 * (vertex_sources / vertex_sources.max())).astype('int')
            mesh.add_attribute("vertex_red")
            mesh.add_attribute("vertex_green")
            mesh.add_attribute("vertex_blue")
            mesh.set_attribute("vertex_red", colormap.colormap[vertex_sources][:, 0])
            mesh.set_attribute("vertex_green", colormap.colormap[vertex_sources][:, 1])
            mesh.set_attribute("vertex_blue", colormap.colormap[vertex_sources][:, 2])
    except:
        pass
    pymesh.save_mesh(path[:-3] + "ply", mesh, *mesh.get_attribute_names(), ascii=True) 
开发者ID:ThibaultGROUEIX,项目名称:AtlasNet,代码行数:16,代码来源:mesh_processor.py

示例6: shuffle_pc

# 需要导入模块: import pymesh [as 别名]
# 或者: from pymesh import save_mesh [as 别名]
def shuffle_pc(file, output_path):
    mesh = pymesh.load_mesh(file)
    vertices = copy.deepcopy(mesh.vertices)
    permutation = np.random.permutation(len(vertices))
    vertices = vertices[permutation]
    new_mesh = pymesh.meshio.form_mesh(vertices, mesh.faces)
    new_mesh.add_attribute("vertex_nx")
    new_mesh.set_attribute("vertex_nx", mesh.get_vertex_attribute("vertex_nx")[permutation])
    new_mesh.add_attribute("vertex_ny")
    new_mesh.set_attribute("vertex_ny", mesh.get_vertex_attribute("vertex_ny")[permutation])
    new_mesh.add_attribute("vertex_nz")
    new_mesh.set_attribute("vertex_nz", mesh.get_vertex_attribute("vertex_nz")[permutation])
    pymesh.save_mesh(output_path, new_mesh, ascii=True, anonymous=True, use_float=True, *new_mesh.get_attribute_names()) 
开发者ID:ThibaultGROUEIX,项目名称:AtlasNet,代码行数:15,代码来源:parallel_shuffle.py

示例7: remesh_and_save

# 需要导入模块: import pymesh [as 别名]
# 或者: from pymesh import save_mesh [as 别名]
def remesh_and_save(input_path, output_path):
    try:
        obj = remesh(input_path)
        pymesh.save_mesh(output_path, obj, )
    except Exception as e:
        return ("", str(e))
    else:
        return ("","") 
开发者ID:yifita,项目名称:deep_cage,代码行数:10,代码来源:remesh_shapenet.py

示例8: save_ply

# 需要导入模块: import pymesh [as 别名]
# 或者: from pymesh import save_mesh [as 别名]
def save_ply(
    filename,
    vertices,
    faces=[],
    normals=None,
    charges=None,
    vertex_cb=None,
    hbond=None,
    hphob=None,
    iface=None,
    normalize_charges=False,
):
    """ Save vertices, mesh in ply format.
        vertices: coordinates of vertices
        faces: mesh
    """
    mesh = pymesh.form_mesh(vertices, faces)
    if normals is not None:
        n1 = normals[:, 0]
        n2 = normals[:, 1]
        n3 = normals[:, 2]
        mesh.add_attribute("vertex_nx")
        mesh.set_attribute("vertex_nx", n1)
        mesh.add_attribute("vertex_ny")
        mesh.set_attribute("vertex_ny", n2)
        mesh.add_attribute("vertex_nz")
        mesh.set_attribute("vertex_nz", n3)
    if charges is not None:
        mesh.add_attribute("charge")
        if normalize_charges:
            charges = charges / 10
        mesh.set_attribute("charge", charges)
    if hbond is not None:
        mesh.add_attribute("hbond")
        mesh.set_attribute("hbond", hbond)
    if vertex_cb is not None:
        mesh.add_attribute("vertex_cb")
        mesh.set_attribute("vertex_cb", vertex_cb)
    if hphob is not None:
        mesh.add_attribute("vertex_hphob")
        mesh.set_attribute("vertex_hphob", hphob)
    if iface is not None:
        mesh.add_attribute("vertex_iface")
        mesh.set_attribute("vertex_iface", iface)

    pymesh.save_mesh(
        filename, mesh, *mesh.get_attribute_names(), use_float=True, ascii=True
    ) 
开发者ID:LPDI-EPFL,项目名称:masif,代码行数:50,代码来源:save_ply.py


注:本文中的pymesh.save_mesh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。