當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。