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


Python PlyElement.describe方法代码示例

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


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

示例1: write_ply_color

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_ply_color(points, labels, filename, num_classes=None, colormap=pyplot.cm.jet):
    """ Color (N,3) points with labels (N) within range 0 ~ num_classes-1 as OBJ file """
    labels = labels.astype(int)
    N = points.shape[0]
    if num_classes is None:
        num_classes = np.max(labels)+1
    else:
        assert(num_classes>np.max(labels))
    
    vertex = []
    #colors = [pyplot.cm.jet(i/float(num_classes)) for i in range(num_classes)]    
    colors = [colormap(i/float(num_classes)) for i in range(num_classes)]    
    for i in range(N):
        c = colors[labels[i]]
        c = [int(x*255) for x in c]
        vertex.append( (points[i,0],points[i,1],points[i,2],c[0],c[1],c[2]) )
    vertex = np.array(vertex, dtype=[('x', 'f4'), ('y', 'f4'),('z', 'f4'),('red', 'u1'), ('green', 'u1'),('blue', 'u1')])
    
    el = PlyElement.describe(vertex, 'vertex', comments=['vertices'])
    PlyData([el], text=True).write(filename) 
开发者ID:zaiweizhang,项目名称:H3DNet,代码行数:22,代码来源:pc_util.py

示例2: write_ply_color_multi

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_ply_color_multi(points, labels, filename, pre_dict=None, colormap=pyplot.cm.jet):
    """ Color (N,3) points with labels (N) within range 0 ~ num_classes-1 as OBJ file """
    #labels = labels.astype(int)
    N = points.shape[0]
    
    cdict = construct_dict(labels, predict=pre_dict)
            
    num_classes = len(cdict.keys())
    vertex = []
    #colors = [pyplot.cm.jet(i/float(num_classes)) for i in range(num_classes)]    
    colors = [colormap(i/float(num_classes)) for i in range(num_classes)]    
    for i in range(N):
        c = colors[cdict[hashlist(labels[i,:])]]
        c = [int(x*255) for x in c]
        vertex.append( (points[i,0],points[i,1],points[i,2],c[0],c[1],c[2]) )
    vertex = np.array(vertex, dtype=[('x', 'f4'), ('y', 'f4'),('z', 'f4'),('red', 'u1'), ('green', 'u1'),('blue', 'u1')])
    
    el = PlyElement.describe(vertex, 'vertex', comments=['vertices'])
    PlyData([el], text=True).write(filename)
    return cdict 
开发者ID:zaiweizhang,项目名称:H3DNet,代码行数:22,代码来源:pc_util.py

示例3: write_ply_label

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_ply_label(points, labels, filename, num_classes, colormap=pyplot.cm.jet):
    """ Color (N,3) points with labels (N) within range 0 ~ num_classes-1 as OBJ file """
    labels = labels.astype(int)
    N = points.shape[0]
    #cdict = construct_dict(labels, predict=pre_dict)
            
    #num_classes = len(cdict.keys())
    vertex = []
    #colors = [pyplot.cm.jet(i/float(num_classes)) for i in range(num_classes)]    
    colors = [colormap(i/float(num_classes)) for i in range(num_classes)]    
    for i in range(N):
        c = colors[labels[i]]
        c = [int(x*255) for x in c]
        vertex.append( (points[i,0],points[i,1],points[i,2],c[0],c[1],c[2]) )
    vertex = np.array(vertex, dtype=[('x', 'f4'), ('y', 'f4'),('z', 'f4'),('red', 'u1'), ('green', 'u1'),('blue', 'u1')])
    
    el = PlyElement.describe(vertex, 'vertex', comments=['vertices'])
    PlyData([el], text=True).write(filename) 
开发者ID:zaiweizhang,项目名称:H3DNet,代码行数:20,代码来源:pc_util.py

示例4: write_ply_color

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_ply_color(points, filename, text=True):
    """ input: Nx6, write points to filename as PLY format. """
    points_ = [(points[i,0], points[i,1], points[i,2]) for i in range(points.shape[0])]
    points_color_ = [(255*points[i,3], 255*points[i,4], 255*points[i,5]) for i in range(points.shape[0])]

    n = points.shape[0]
    vertex = np.array(points_, dtype=[('x', 'f4'), ('y', 'f4'),('z', 'f4')])
    vertex_color = np.array(points_color_, dtype=[('red', 'u1'), ('green', 'u1'),('blue', 'u1')])
    vertex_all = np.empty(n, vertex.dtype.descr + vertex_color.dtype.descr)

    for prop in vertex.dtype.names:
        vertex_all[prop] = vertex[prop]

    for prop in vertex_color.dtype.names:
        vertex_all[prop] = vertex_color[prop]

    ply = PlyData([PlyElement.describe(vertex_all, 'vertex')], text=True)
    ply.write(filename)


# ----------------------------------------
# Simple Point cloud and Volume Renderers
# ---------------------------------------- 
开发者ID:laughtervv,项目名称:SGPN,代码行数:25,代码来源:pc_util.py

示例5: write_ply

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_ply(points, filename, text=True):
    """ input: Nx3, write points to filename as PLY format. """
    points = [(points[i,0], points[i,1], points[i,2]) for i in range(points.shape[0])]
    vertex = np.array(points, dtype=[('x', 'f4'), ('y', 'f4'),('z', 'f4')])
    el = PlyElement.describe(vertex, 'vertex', comments=['vertices'])
    PlyData([el], text=text).write(filename)


# ----------------------------------------
# Simple Point cloud and Volume Renderers
# ---------------------------------------- 
开发者ID:vinits5,项目名称:pointnet-registration-framework,代码行数:13,代码来源:pc_util.py

示例6: write_ply

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_ply(points, filename, text=True):
    """ input: Nx3, write points to filename as PLY format. """
    points = [(points[i,0], points[i,1], points[i,2]) for i in range(points.shape[0])]
    vertex = np.array(points, dtype=[('x', 'f4'), ('y', 'f4'),('z', 'f4')])
    el = PlyElement.describe(vertex, 'vertex', comments=['vertices'])
    PlyData([el], text=text).write(filename) 
开发者ID:zaiweizhang,项目名称:H3DNet,代码行数:8,代码来源:pc_util.py

示例7: visualize

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def visualize(args):
    print("visualizing...")
    scene = np.load(CONF.SCANNETV2_FILE.format(args.scene_id))

    vertex = []
    for i in range(scene.shape[0]):
        vertex.append(
            (
                scene[i][0],
                scene[i][1],
                scene[i][2],
                CONF.PALETTE[int(scene[i][7])][0],
                CONF.PALETTE[int(scene[i][7])][1],
                CONF.PALETTE[int(scene[i][7])][2]
            )
        )
    
    vertex = np.array(
        vertex,
        dtype=[
            ("x", np.dtype("float32")), 
            ("y", np.dtype("float32")), 
            ("z", np.dtype("float32")),
            ("red", np.dtype("uint8")),
            ("green", np.dtype("uint8")),
            ("blue", np.dtype("uint8"))
        ]
    )

    output_pc = PlyElement.describe(vertex, "vertex")
    output_pc = PlyData([output_pc])
    os.makedirs(CONF.SCAN_LABELS, exist_ok=True)
    output_pc.write(CONF.SCANNETV2_LABEL.format(args.scene_id)) 
开发者ID:daveredrum,项目名称:Pointnet2.ScanNet,代码行数:35,代码来源:visualize_prep_scene.py

示例8: visualize

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def visualize(args, preds):
    vertex = []
    for i in range(preds.shape[0]):
        vertex.append(
            (
                preds[i][0],
                preds[i][1],
                preds[i][2],
                preds[i][3],
                preds[i][4],
                preds[i][5],
            )
        )

    vertex = np.array(
        vertex,
        dtype=[
            ("x", np.dtype("float32")), 
            ("y", np.dtype("float32")), 
            ("z", np.dtype("float32")),
            ("red", np.dtype("uint8")),
            ("green", np.dtype("uint8")),
            ("blue", np.dtype("uint8"))
        ]
    )

    output_pc = PlyElement.describe(vertex, "vertex")
    output_pc = PlyData([output_pc])
    output_root = os.path.join(CONF.OUTPUT_ROOT, args.folder, "preds")
    os.makedirs(output_root, exist_ok=True)
    output_pc.write(os.path.join(output_root, "{}.ply".format(args.scene_id))) 
开发者ID:daveredrum,项目名称:Pointnet2.ScanNet,代码行数:33,代码来源:visualize.py

示例9: write_point_ply

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_point_ply(filename, v, n):
  """Write point cloud to ply file.

  Args:
    filename: str, filename for ply file to load.
    v: np.array of shape [#v, 3], vertex coordinates
    n: np.array of shape [#v, 3], vertex normals
  """
  vn = np.concatenate([v, n], axis=1)
  vn = [tuple(vn[i]) for i in range(vn.shape[0])]
  vn = np.array(vn, dtype=[('x', 'f4'), ('y', 'f4'), ('z', 'f4'),
                           ('nx', 'f4'), ('ny', 'f4'), ('nz', 'f4')])
  el = PlyElement.describe(vn, 'vertex')
  PlyData([el]).write(filename) 
开发者ID:tensorflow,项目名称:graphics,代码行数:16,代码来源:point_utils.py

示例10: export_pointcloud

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def export_pointcloud(vertices, out_file, as_text=True):
    assert(vertices.shape[1] == 3)
    vertices = vertices.astype(np.float32)
    vector_dtype = [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]
    vertices = vertices.view(dtype=vector_dtype).flatten()
    plyel = PlyElement.describe(vertices, 'vertex')
    plydata = PlyData([plyel], text=as_text)
    plydata.write(out_file) 
开发者ID:autonomousvision,项目名称:texture_fields,代码行数:10,代码来源:io.py

示例11: write_color_ply

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_color_ply(points, filename, text=True):
    points = [(points[i,0], points[i,1], points[i,2], points[i,3], points[i,4], points[i,5]) for i in range(points.shape[0])]
    vertex = np.array(points, dtype=[('x', 'f4'), ('y', 'f4'), ('z', 'f4'), ('red', 'u1'), ('green', 'u1'), ('blue', 'u1')])
    el = PlyElement.describe(vertex, 'vertex', comments=['vertices'])
    PlyData([el], text=text).write(filename) 
开发者ID:ericyi,项目名称:GSPN,代码行数:7,代码来源:io_util.py

示例12: export_pointcloud

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def export_pointcloud(vertices, out_file, as_text=True):
    assert(vertices.shape[1] == 3)
    vertices = vertices.astype(np.float32)
    vertices = np.ascontiguousarray(vertices)
    vector_dtype = [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]
    vertices = vertices.view(dtype=vector_dtype).flatten()
    plyel = PlyElement.describe(vertices, 'vertex')
    plydata = PlyData([plyel], text=as_text)
    plydata.write(out_file) 
开发者ID:autonomousvision,项目名称:occupancy_flow,代码行数:11,代码来源:io.py

示例13: write_ply

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_ply(array, filepath):
    ply_el = PlyElement.describe(array, 'vertex')
    target_path, _ = os.path.split(filepath)
    if target_path != '' and not os.path.exists(target_path):
      os.makedirs(target_path)
    PlyData([ply_el]).write(filepath) 
开发者ID:chrischoy,项目名称:SpatioTemporalSegmentation,代码行数:8,代码来源:pc_utils.py

示例14: write_point_cloud

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_point_cloud(path, point_cloud):
    point_clouds_list = []
    for i in range(point_cloud.shape[0]):
        point_clouds_list.append((point_cloud[i, 0], point_cloud[i, 1], point_cloud[i, 2], point_cloud[i, 3],
                                  point_cloud[i, 4], point_cloud[i, 5]))

    vertex = np.array(point_clouds_list,
                      dtype=[('x', 'f4'), ('y', 'f4'), ('z', 'f4'), ('red', 'u1'), ('green', 'u1'), ('blue', 'u1')])
    el = PlyElement.describe(vertex, 'vertex')
    PlyData([el], text=True).write(path)
    return 
开发者ID:lppllppl920,项目名称:EndoscopyDepthEstimation-Pytorch,代码行数:13,代码来源:utils.py

示例15: write_ply

# 需要导入模块: from plyfile import PlyElement [as 别名]
# 或者: from plyfile.PlyElement import describe [as 别名]
def write_ply(points, filename, text=True):
    """ input: Nx3, write points to filename as PLY format. """
    points = [(points[i, 0], points[i, 1], points[i, 2]) for i in range(points.shape[0])]
    vertex = np.array(points, dtype=[('x', 'f4'), ('y', 'f4'), ('z', 'f4')])
    el = PlyElement.describe(vertex, 'vertex', comments=['vertices'])
    PlyData([el], text=text).write(filename)


# ----------------------------------------
# Simple Point cloud and Volume Renderers
# ---------------------------------------- 
开发者ID:hkust-vgd,项目名称:scanobjectnn,代码行数:13,代码来源:pc_util.py


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