Segmentation_Dijkstra_litt
affichesegmlitt Link
affichesegmlitt(pcd, G, segmentdict, c)
Displays a 3D point cloud and its corresponding graph representation.
This function visualizes a 3D point cloud along with its graph structure. It creates a graph representation where nodes correspond to the points in the point cloud, and edges are defined based on the provided segment dictionary. The visualization allows the user to see the structure of the graph overlayed on the point cloud.
Parameters:
-
pcd
(PointCloud
) –The 3D point cloud to be visualized.
-
G
(Graph
) –The base graph structure associated with the point cloud.
-
segmentdict
(dict[int, list[int]]
) –A dictionary where each key is a segment index and the value is a list of point indices representing a path in the graph.
-
c
(int
) –The number of graph segments to visualize. Segments in the range [1, c-1] from the segment dictionary are visualized.
Source code in spectral_clustering/Segmentation_Dijkstra_litt.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
sortienuagelitt Link
sortienuagelitt(pcd, G, segmentdict, c)
Sorts segments and labels points based on the shortest paths in a graph.
This function processes a point cloud and a graph representing segments, calculates the shortest paths from specified segments to all other points, and labels each point in the point cloud according to the segment it is associated with or assigns a default label if no segment is reachable. It outputs a classified point cloud with these labels.
Parameters:
-
pcd
(PointCloud
) –A point cloud object representing the spatial data. It is expected to have points that need to be classified.
-
G
(MultiDiGraph
) –A graph containing nodes and edges representing segments. The nodes correspond to points or locations in the graph, and the edges have associated weights used for shortest path calculations.
-
segmentdict
(dict
) –A dictionary where keys are segment identifiers (int or str) and values are lists of points or segment nodes. These represent specific paths or segments in the graph for label assignment.
-
c
(int
) –A default label assigned to points that do not belong to any segment or do not have a reachable shortest path.
Notes
The function saves the resulting classified point cloud data as a text file named pcdclassifdijkstra2.txt
.
Raises:
-
ValueError
–If certain values could not be processed or matched during the segment identification process in the segment dictionary.
Source code in spectral_clustering/Segmentation_Dijkstra_litt.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|