src.utils.ptransf.simple_structure_smootherpp
Classes
|
- class src.utils.ptransf.simple_structure_smootherpp.SimpleStructureSmootherPP(**kwargs)
- Author:
Alberto M. Esmoris Pena
Class for smoothing the structure space of a point cloud. The smoothing consists in replacing each point \(\pmb{x}_{i*} \in \mathbb{R}^{3}\) in the point cloud by a smoothed version considering its neighborhood \(\mathcal{N}(\pmb{x}_{i*}) \subset \mathbb{R}^{3}\). Supported neighborhood definitions are 2D and 3D k-nearest neighbors, spheres, and unbounded cylinders of a given radius. The smoothed version of the point is:
– Mean strategy
\[\pmb{x}^{'}_{i*} = \lvert\mathcal{N}(\pmb{x}_{i*})\rvert^{-1} \sum_{\pmb{x}_{j*} \in \mathcal{N}(\pmb{x}_{i*})}{\pmb{x}_{j*}}\]– Inverse Distance Weighting (IDW) strategy
\[\pmb{x}^{'}_{i*} = \left[ \sum_{\pmb{x}_{j* \in \mathcal{N}(\pmb{x}_{i*})}}{ \left(\max\left\{ \epsilon, \lVert\pmb{x}_{j*} - \pmb{x}_{i*}\rVert \right\}\right)^{-p} } \right]^{-1} \left[ \sum_{\pmb{x}_{j* \in \mathcal{N}(\pmb{x}_{i*})}}{ \left(\max\left\{ \epsilon, \lVert\pmb{x}_{j*} - \pmb{x}_{i*}\rVert \right\}\right)^{-p} \pmb{x}_{j*} } \right]\]– Radial Basis Function (RBF) strategy (with Gaussian Kernel)
\[\pmb{x}^{'}_{i*} = \left( \sum_{\pmb{x}_{j*} \in \mathcal{N}(\pmb{x}_{i*})}{ \exp\left(-\dfrac{ \lVert\pmb{x}_{j*}-\pmb{x}_{i*}\rVert^{2} }{ p^2 }\right) } \right)^{-1} \left( \sum_{\pmb{x}_{j*} \in \mathcal{N}(\pmb{x}_{i*})}{ \exp\left(-\dfrac{ \lVert\pmb{x}_{j*}-\pmb{x}_{i*}\rVert^{2} }{ p^2 }\right) \pmb{x}_{j*} } \right)\]- Variables:
neighborhood (dict) – A dictionary specifying the neighborhood definition for the smoothing algorithm. See
SimpleStructureSmootherPP.__init__()for specification details.strategy (dict) – A dictionary specifying the smoothing strategy. See
SimpleStructureSmootherPP.__init__()for specification details.nthreads (int) – The number of threads to be used for parallel computations. Note that -1 means using as many threads as available cores.
- static extract_ptransf_args(spec)
Extract the arguments to initialize/instantiate a SimpleStructureSmootherPP.
- Parameters:
spec – The key-word specification containing the arguments.
- Returns:
The arguments to initialize/instantiate a SimpleStructureSmootherPP.
- Return type:
dict
- __init__(**kwargs)
Initialize/instantiate a simple structure smoother++ object.
- Parameters:
kwargs – The key-word specification to instantiate the SimpleStructureSmootherPP.
- Keyword Arguments:
neighborhood (
dict) – Dictionary with the neighborhood specification.- –
type The type of neighborhood. Either
"knn","knn2d","sphere", or"cylinder".- –
radius The radius for the
"sphere"and"cylinder"neighborhoods.- –
k The number of neighbors in k-nearest neighbors neighborhoods.
- –
strategy (
dict) – Dictionary with the smoothing strategy specification.- –
type The strategy for the smoothing. Either
"mean","idw", or"rbf".- –
parameter The power parameter \(p \in \mathbb{Z}_{\geq 1}\) for the
"idw"strategy or the bandwith parameter \(p \in \mathbb{R}\) for the"rbf"strategy.- –
min_distance The min allowed distance \(\epsilon \in \mathbb{R}_{>0}\) to avoid division by zero when using the
"idw"strategy.
- –
correction (
dict) – Dictionary with the Fibonacci orthodromic correction specification. See the C++ documentation for further details about the maths.- –
K How many points consider for the Fibonacci support.
- –
sigma The hard cut threshold for the weighting function:
\[\omega(\pmb{x}_{j*}, \pmb{q}_{k*}) = \max \;\left\{ 0, \sigma - \arccos\left(\dfrac{ \langle\pmb{x}_{j*}, \pmb{q}_{k*}\rangle }{ \lVert\pmb{x}_{j*}\rVert } \right) \right\}\]
- –
- nthreads (
int) – The number of threads to be used in parallel computations. Note that -1 means as many threads as available cores.
- nthreads (
- transform(X=None, F=None, y=None, yhat=None, out_prefix=None, **kwargs)
The fundamental point transform logic defining the simple structure smoother++.
- transform_pcloud(pcloud, out_prefix=None, **kwargs)
Update the input point cloud in place.
See
SimpleStructureSmootherPP.transform()andPointTransformer.transform_pcloud().