stochastic_registration
This code implements the basic structure of for performing the stochastic optimization algorithm. Given two set of discrete points, this code returns the transformed point set.
knn_mst(skeleton_points, n_neighbors=5, knn_algorithm='kd_tree', mst_algorithm='kruskal')
Link
Update the skeleton structure with minimum spanning tree on knn-graph with Euclidean distances.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
skeleton_points |
ndarray
|
The skeleton coordinates of shape |
required |
n_neighbors |
int
|
The number of neighbors to search for in |
5
|
knn_algorithm |
str
|
The algorithm to use for computing the kNN distance.
Must be one of 'auto', 'ball_tree', 'kd_tree' or 'brute'.
Defaults to |
'kd_tree'
|
mst_algorithm |
str
|
The algorithm to use for computing the minimum spanning tree.
Must be one of 'kruskal', 'prim' or 'boruvka'.
Defaults to |
'kruskal'
|
See Also
sklearn.neighbors.NearestNeighbors networkx.minimum_spanning_tree
Returns:
Type | Description |
---|---|
Graph
|
The skeleton structure with minimum spanning tree from knn-graph. |
Examples:
>>> from skeleton_refinement.stochastic_registration import perform_registration
>>> from skeleton_refinement.stochastic_registration import knn_mst
>>> from skeleton_refinement.io import load_ply, load_json
>>> pcd = load_ply("real_plant_analyzed/PointCloud_1_0_1_0_10_0_7ee836e5a9/PointCloud.ply")
>>> skel = load_json("real_plant_analyzed/CurveSkeleton__TriangleMesh_0393cb5708/CurveSkeleton.json", "points")
>>> # Perform stochastic optimization
>>> refined_skel = perform_registration(pcd, skel, alpha=5, beta=5)
>>> # Compute skeleton tree structure using mst on knn-graph:
>>> skel_tree = knn_mst(refined_skel)
Source code in skeleton_refinement/stochastic_registration.py
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 125 126 127 128 129 130 131 |
|
perform_registration(X, Y, **kwargs)
Link
Performs the skeleton optimization using stochastic deformation registration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
ndarray
|
The input reference point cloud coordinates of shape |
required |
Y |
ndarray
|
The input reference skeleton coordinates of shape |
required |
Other Parameters:
Name | Type | Description |
---|---|---|
alpha |
float
|
???. |
beta |
float
|
???. |
sigma2 |
ndarray
|
???
Defaults to |
max_iterations |
int
|
The maximum number of iterations before stopping the iterative registration.
Defaults to |
tolerance |
float
|
??? Tolerance for registration.
Defaults to |
w |
int
|
???
Defaults to |
Returns:
Type | Description |
---|---|
ndarray
|
The transformed skeleton coordinates of shape |
Examples:
>>> from skeleton_refinement.stochastic_registration import perform_registration
>>> from skeleton_refinement.io import load_ply, load_json
>>> pcd = load_ply("real_plant_analyzed/PointCloud_1_0_1_0_10_0_7ee836e5a9/PointCloud.ply")
>>> skel = load_json("real_plant_analyzed/CurveSkeleton__TriangleMesh_0393cb5708/CurveSkeleton.json", "points")
>>> # Perform stochastic optimization
>>> refined_skel = perform_registration(pcd, skel, alpha=5, beta=5)
>>> print(refined_skel.shape)
Source code in skeleton_refinement/stochastic_registration.py
17 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|