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)
Example #2
0
input2 = "../MantecaDock/palletsRadial.las"
pointCloud = VtkPointCloud()
filteredPointCloud = VtkPointCloud()
pc2 = VtkPointCloud()

with File(input_file, mode='r') as f:
    input_header = f.header

    print("reading %s" % input_file)

    points = read_raw_las_data(input_file)
    for point in tqdm(points, total=len(points), desc="Adding"):
        pointCloud.addPoint(point)

    points2 = read_raw_las_data(input2)
    for point in tqdm(points, total=len(points2), desc="Adding"):
        pc2.addPoint(point)

    filtered_points = ann_guided_filter(points2, 40, .1)
    # filtered_points = radius_outlier_filter(points, r=1, search_eps=0, sd_cutoff=1)
    for filtered_point in tqdm(filtered_points,
                               total=len(filtered_points),
                               desc="Adding"):
        filteredPointCloud.addPoint(filtered_point)

    print("Original has %d points" % len(points))
    print("Filtered has %d points" % len(filtered_points))

    to_plot = [pointCloud, pc2, filteredPointCloud]
    create_point_cloud_plot_qt(to_plot)
Example #3
0
    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,
                               input_header=input_header,
                               axes_on=True)
    input_header = f.header
    # print("reading %s" % input_file)

    points = read_raw_las_data(input1)
    for point in tqdm(points, total=len(points), desc="Adding"):
        pc.addPoint(point)

    points_z = [point[2] for point in points]
    points2d = [point[:2] for point in points]

    points_f = ann_guided_filter(points2d, neighbors=1000, filter_eps=.1, dim=2)

    # pdb.set_trace()
    for i in range(len(points)):
        # points_f[i].append(points_z[i])
        points_f[i] = np.append(points_f[i], points_z[i])

    pdb.set_trace()
    for point in tqdm(points_f, total=len(points_f), desc="Adding"):
        pc2.addPoint(point)

    points3 = read_raw_las_data(input2)
    for point in tqdm(points3, total=len(points3), desc="Adding"):
        pc3.addPoint(point)

    to_plot = [pc, pc3, pc2]
    create_point_cloud_plot_qt(to_plot, axes_on=False)
    pdb.set_trace()
    # close after creating, else save won't work
    # f.close()