MCPcopy Create free account
hub / github.com/JeremyBYU/polylidar / get_image_peaks

Function get_image_peaks

examples/python/basic_mesh.py:63–93  ·  view source on GitHub ↗
(ico_chart, ga, level=2, with_o3d=False,
                    find_peaks_kwargs=dict(threshold_abs=30, min_distance=1, exclude_border=True, indices=False),
                    cluster_kwargs=dict(t=0.10, criterion='distance'),
                    average_filter=dict(min_total_weight=0.01),
                    **kwargs)

Source from the content-addressed store, hash-verified

61
62
63def get_image_peaks(ico_chart, ga, level=2, with_o3d=False,
64 find_peaks_kwargs=dict(threshold_abs=30, min_distance=1, exclude_border=True, indices=False),
65 cluster_kwargs=dict(t=0.10, criterion='distance'),
66 average_filter=dict(min_total_weight=0.01),
67 **kwargs):
68
69 normalized_bucket_counts_by_vertex = ga.get_normalized_bucket_counts_by_vertex(True)
70
71 t1 = time.perf_counter()
72 ico_chart.fill_image(normalized_bucket_counts_by_vertex) # this takes microseconds
73 # plt.imshow(np.asarray(ico_chart.image))
74 # plt.show()
75 peaks, clusters, avg_peaks, avg_weights = find_peaks_from_ico_charts(ico_chart, np.asarray(
76 normalized_bucket_counts_by_vertex), find_peaks_kwargs=find_peaks_kwargs, cluster_kwargs=cluster_kwargs, average_filter=average_filter)
77 t2 = time.perf_counter()
78
79 gaussian_normals_sorted = np.asarray(ico_chart.sphere_mesh.vertices)
80 # Create Open3D structures for visualization
81 if with_o3d:
82 pcd_all_peaks = get_pc_all_peaks(peaks, clusters, gaussian_normals_sorted)
83 arrow_avg_peaks = get_arrow_normals(avg_peaks, avg_weights)
84 else:
85 pcd_all_peaks = None
86 arrow_avg_peaks = None
87
88 elapsed_time = (t2 - t1) * 1000
89 timings = dict(t_fastga_peak=elapsed_time)
90
91 logging.debug("Peak Detection - Took (ms): %.2f", (t2 - t1) * 1000)
92
93 return avg_peaks, pcd_all_peaks, arrow_avg_peaks, timings
94
95
96def extract_all_dominant_planes(tri_mesh, vertices, polylidar_kwargs, config_pp, ds=50, min_samples=10000):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected