Beispiel #1
0
def main():
    plt.grid_generic()
    plt.show(persistent=False)
    plt.scatter_generic(**generate_real_size_points())

    generate_animation()
    plt.close_app()
Beispiel #2
0
def main():
    path = sys.argv[-1]
    print('Loading file: {}'.format(path))
    # path = u'/home/chicheng/ARMLab/data/VolumeDeformData/hoodie/canonical/frame-000000.canonical.ply'
    meshdata = MeshData(**load_mesh(path))
    plt.grid_generic()
    plt.mesh_generic(meshdata)
    plt.show(persistent=False)
Beispiel #3
0
def add_grid():
    gx = plt.grid_generic()
    gx.rotate(90, 0, 1, 0)
    gx.translate(-10, 0, 0)
    gy = plt.grid_generic()
    gy.rotate(90, 1, 0, 0)
    gy.translate(0, -10, 0)
    gz = plt.grid_generic()
    gz.translate(0, 0, -10)
Beispiel #4
0
def simple_visualize(input_arr,
                     tracking_result_history,
                     template_edges,
                     key_func,
                     filter_point_cloud=False,
                     target_fps=30):

    offset = -tracking_result_history[0].mean(axis=0)

    glplt.clear()
    glplt.show()
    glplt.grid_generic()
    tracking_result_edges_item = glplt.edge_set(tracking_result_history[0] +
                                                offset,
                                                template_edges,
                                                color=(1, 1, 1, 1),
                                                width=2.0)
    tracking_result_points_item = glplt.scatter_generic(
        tracking_result_history[0] + offset,
        color=(1, 0, 0, 1),
        size=0.01,
        pxMode=False)

    point_cloud_item = None
    desired_frame_time = 1 / target_fps
    last_time = time.time()
    for i in cycle(range(len(tracking_result_history))):
        print(i)
        point_cloud_img, color_img = input_arr[i]
        tracking_result = tracking_result_history[i]

        # generate mask
        mask_img = key_func(point_cloud_img, color_img)
        filtered_point_cloud = point_cloud_img
        if filter_point_cloud:
            filtered_point_cloud = point_cloud_img[mask_img]

        # update point cloud
        if point_cloud_item is None:
            point_cloud_item = glplt.point_cloud(filtered_point_cloud + offset,
                                                 color_img,
                                                 size=0.9,
                                                 pxMode=True)
        else:
            glplt.update_point_cloud(point_cloud_item,
                                     filtered_point_cloud + offset, color_img)

        glplt.update_edge_set(tracking_result_edges_item,
                              tracking_result + offset, template_edges)
        tracking_result_points_item.setData(pos=tracking_result + offset)

        curr_time = time.time()
        curr_frame_time = curr_time - last_time
        last_time = curr_time
        if curr_frame_time < desired_frame_time:
            time.sleep(desired_frame_time - curr_frame_time)
Beispiel #5
0
 def __init__(self, offset, template, grid=None, num_correspondence=5):
     self.offset = offset
     self.template_item = glplt.scatter_generic(pos=template + self.offset,
                                                color=(1, 0, 1, 1),
                                                size=0.005,
                                                pxMode=False)
     self.source_item = None
     self.target_item = None
     self.correspondence_item = None
     self.grid_item = None
     self.grid_verts = None
     self.grid_edges = None
     self.grid_kernel = None
     if grid is not None:
         self.grid_verts, self.grid_edges, beta = grid
         self.grid_kernel = gaussian_kernel_any(self.grid_verts, template,
                                                beta)
         self.grid_item = glplt.edge_set(self.grid_verts + self.offset,
                                         self.grid_edges,
                                         width=0.1,
                                         color=(1, 1, 1, 1))
     self.num_correspondence = num_correspondence
     self.coord_item = glplt.grid_generic()
     glplt.show()