def write_xyz_file(file_name):
    points = read_raw_las_data(file_name)
    pc = create_vtkpc_from_array(points)
    writer = vtk.vtkSimplePointsWriter()
    writer.SetFileName(file_name[:-4] + ".xyz")
    writer.SetInputData(pc.vtkPolyData)
    print("Writing to %s" % file_name[:-4] + ".xyz")
    writer.Write()
Exemplo n.º 2
0
def main():
    input1 = "Data/MantecaFiltered/MantecaRailSlice.las"
    with File(input1, mode='r') as f:
        input_header = f.header
        to_plot = []  # list of VTK Point Clouds to plot

        points = subsample_frac_from_las_data(input1, .01)
        pc = create_vtkpc_from_array(points)
        to_plot.append(pc)

        create_point_cloud_plot_qt(to_plot,
                                   input_header=input_header,
                                   axes_on=True)
Exemplo n.º 3
0
    print("Finding histogram took %d seconds" % end)
    # del point_set
    print(max(H))
    return max(H)


with File(input1, mode='r') as f:
    input_header = f.header
    to_plot = []

    # points = subsample_frac_from_las_data(input1, .0625)
    # pc = create_vtkpc_from_array(points)
    # to_plot.append(pc)

    points2 = subsample_frac_from_las_data(input2, .0625)
    pc2 = create_vtkpc_from_array(points2)
    to_plot.append(pc2)

    theta = cp.Variable(1)
    objective = cp.Maximize(max_bin(points2, theta))
    constraints = [0 <= theta, theta <= np.pi / 2.]
    prob = cp.Problem(objective, constraints)
    result = prob.solve()

    # print(max_bin(points2, theta))
    print(theta.value)
    pc3 = create_vtkpc_from_array(points2)
    to_plot.append(pc3)
    # pdb.set_trace()

    create_point_cloud_plot_qt(to_plot,
    # pc2 = create_vtkpc_from_array(points2)
    # to_plot.append(pc2)

    # points = read_raw_las_data(input1)
    # warehouse = subsample_frac_from_las_data(input2, .1)
    #
    # # points = subsample_frac_from_las_data(input1, .01)
    # pc = create_vtkpc_from_array(points+warehouse)
    # to_plot.append(pc)

    points = naive_slice_from_las(input1,
                                  AxisAlignedBox3D([7, -13, -.5], [9, -11, 3]))
    # points = subsample_frac_from_las_data(input1, .01)
    points = ann_guided_filter(points, num_neighbors=50, filter_eps=.07)
    # points = subsample_frac_from_las_data(input1, .1)
    pc = create_vtkpc_from_array(points)
    to_plot.append(pc)

    # points2 = threshold_filter(points, threshold=.01)
    # pc2 = create_vtkpc_from_array(points2)
    # to_plot.append(pc2)

    # points2 = read_raw_las_data(input2)
    # pc2 = create_vtkpc_from_array(points2)
    # to_plot.append(pc2)

    # points2 = threshold_filter(points, threshold=.015)
    # pc2 = create_vtkpc_from_array(points2)
    # to_plot.append(pc2)

    # points3 = rounding_filter(points2, decimal_places=3)