vedo

vedo是一个基于VTK开发的3维对象显示和分析的开源库,我常用于显示三维对象,这里记录一下常用的操作

  • 显示模型及点集
def show_stl_pts_point_two(stl_path, pts_path, target_pts, point):
    stl_model = vedo.load(stl_path).c(("magenta"))   # 显示stl模型
    pts_points = get_gum_line_pts(pts_path)
    target_pts_points = get_gum_line_pts(target_pts)  # numpy格式点 N*3
    points = vedo.Points(pts_points.reshape(-1, 3)).pointSize(10).c(("green"))  # 显示点
    target_points = vedo.Points(target_pts_points.reshape(-1, 3)).pointSize(8).c(("red"))
    p = vedo.Point(point, r=20, c="yellow")
    vedo.show(stl_model, points, target_points, p)
  • 显示多个模型
    for stl_model in stl_models:
        basename = os.path.basename(stl_model)
        filename = os.path.splitext(basename)[0]
        print(filename)
        sharp_face_model = os.path.join(SAVE_DIR, filename + "sharpFaces.stl")

        a = load(stl_model).c(("grey")).opacity(0.5)
        b = load(sharp_face_model).c(('blue'))
        show(a, b)
  • 显示点及标签
    pt_position = np.array([[10, 10, 10], [14, 13, 15]])
    pts = vedo.Points(pt_position, r=10)
    labels = pts.labels(["1", "2"]).c("green2")
    vedo.show(labels, pts)
posted @ 2021-10-06 11:32  半夜打老虎  阅读(805)  评论(0编辑  收藏  举报