probreg package modules¶
callbacks¶
- class probreg.callbacks.Plot2DCallback(source: ndarray, target: ndarray, save: bool = False, keep_window: bool = True)[source]¶
Bases:
object
Display the 2D registration result of each iteration.
- Parameters
source (numpy.ndarray) – Source point cloud data.
target (numpy.ndarray) – Target point cloud data.
save (bool, optional) – If this flag is True, each iteration image is saved in a sequential number.
- class probreg.callbacks.Open3dVisualizerCallback(source: ndarray, target: ndarray, save: bool = False, keep_window: bool = True, fov: Optional[Any] = None)[source]¶
Bases:
object
Display the 3D registration result of each iteration.
- Parameters
source (numpy.ndarray) – Source point cloud data.
target (numpy.ndarray) – Target point cloud data.
save (bool, optional) – If this flag is True, each iteration image is saved in a sequential number.
keep_window (bool, optional) – If this flag is True, the drawing window blocks after registration is finished.
fov – Field of view (degree).
cost_functions¶
- class probreg.cost_functions.CostFunction(tf_type: Type[Transformation])[source]¶
Bases:
object
- probreg.cost_functions.compute_l2_dist(mu_source: ndarray, phi_source: ndarray, mu_target: ndarray, phi_target: ndarray, sigma: float)[source]¶
- class probreg.cost_functions.RigidCostFunction[source]¶
Bases:
CostFunction
- to_transformation(theta: ndarray) Transformation [source]¶
- class probreg.cost_functions.TPSCostFunction(control_pts: ndarray, alpha: float = 1.0, beta: float = 0.1)[source]¶
Bases:
CostFunction
- to_transformation(theta: ndarray) Transformation [source]¶
cpd¶
- class probreg.cpd.EstepResult(pt1, p1, px, n_p)¶
Bases:
tuple
- property n_p¶
Alias for field number 3
- property p1¶
Alias for field number 1
- property pt1¶
Alias for field number 0
- property px¶
Alias for field number 2
- class probreg.cpd.MstepResult(transformation, sigma2, q)¶
Bases:
tuple
Result of Maximization step.
- transformation¶
Transformation from source to target.
- Type
tf.Transformation
- sigma2¶
Variance of Gaussian distribution.
- Type
float
- q¶
Result of likelihood.
- Type
float
- property q¶
Alias for field number 2
- property sigma2¶
Alias for field number 1
- property transformation¶
Alias for field number 0
- class probreg.cpd.CoherentPointDrift(source: Optional[ndarray] = None, use_cuda: bool = False)[source]¶
Bases:
object
Coherent Point Drift algorithm. This is an abstract class. Based on this class, it is inherited by rigid, affine, nonrigid classes according to the type of transformation. In this class, Estimation step in EM algorithm is implemented and Maximazation step is implemented in the inherited classes.
- Parameters
source (numpy.ndarray, optional) – Source point cloud data.
use_cuda (bool, optional) – Use CUDA.
- expectation_step(t_source: ndarray, target: ndarray, sigma2: float, w: float = 0.0) EstepResult [source]¶
Expectation step for CPD
- maximization_step(target: ndarray, estep_res: EstepResult, sigma2_p: Optional[float] = None) Optional[MstepResult] [source]¶
- registration(target: ndarray, w: float = 0.0, maxiter: int = 50, tol: float = 0.001) MstepResult [source]¶
- class probreg.cpd.RigidCPD(source: Optional[ndarray] = None, update_scale: bool = True, tf_init_params: Dict = {}, use_cuda: bool = False)[source]¶
Bases:
CoherentPointDrift
Coherent Point Drift for rigid transformation.
- Parameters
source (numpy.ndarray, optional) – Source point cloud data.
update_scale (bool, optional) – If this flag is True, compute the scale parameter.
tf_init_params (dict, optional) – Parameters to initialize transformation.
use_cuda (bool, optional) – Use CUDA.
- maximization_step(target: ndarray, estep_res: EstepResult, sigma2_p: Optional[float] = None) MstepResult [source]¶
- class probreg.cpd.AffineCPD(source: Optional[ndarray] = None, tf_init_params: Dict = {}, use_cuda: bool = False)[source]¶
Bases:
CoherentPointDrift
Coherent Point Drift for affine transformation.
- Parameters
source (numpy.ndarray, optional) – Source point cloud data.
tf_init_params (dict, optional) – Parameters to initialize transformation.
use_cuda (bool, optional) – Use CUDA.
- class probreg.cpd.NonRigidCPD(source: Optional[ndarray] = None, beta: float = 2.0, lmd: float = 2.0, use_cuda: bool = False)[source]¶
Bases:
CoherentPointDrift
Coherent Point Drift for nonrigid transformation.
- Parameters
source (numpy.ndarray, optional) – Source point cloud data.
beta (float, optional) – Parameter of RBF kernel.
lmd (float, optional) – Parameter for regularization term.
use_cuda (bool, optional) – Use CUDA.
- maximization_step(target: ndarray, estep_res: EstepResult, sigma2_p: Optional[float] = None) MstepResult [source]¶
- class probreg.cpd.ConstrainedNonRigidCPD(source: Optional[ndarray] = None, beta: float = 2.0, lmd: float = 2.0, alpha: float = 1e-08, use_cuda: bool = False, idx_source: Optional[ndarray] = None, idx_target: Optional[ndarray] = None)[source]¶
Bases:
CoherentPointDrift
Extended Coherent Point Drift for nonrigid transformation. Like CoherentPointDrift, but allows to add point correspondance constraints See: https://people.mpi-inf.mpg.de/~golyanik/04_DRAFTS/ECPD2016.pdf
- Parameters
source (numpy.ndarray, optional) – Source point cloud data.
beta (float, optional) – Parameter of RBF kernel.
lmd (float, optional) – Parameter for regularization term.
alpha (float) – Degree of reliability of priors. Approximately between 1e-8 (highly reliable) and 1 (highly unreliable)
use_cuda (bool, optional) – Use CUDA.
idx_source (numpy.ndarray of ints, optional) – Indices in source matrix for which a correspondance is known
idx_target (numpy.ndarray of ints, optional) – Indices in target matrix for which a correspondance is known
- maximization_step(target: ndarray, estep_res: EstepResult, sigma2_p: Optional[float] = None) MstepResult [source]¶
- probreg.cpd.registration_cpd(source: Union[ndarray, PointCloud], target: Union[ndarray, PointCloud], tf_type_name: str = 'rigid', w: float = 0.0, maxiter: int = 50, tol: float = 0.001, callbacks: List[Callable] = [], use_cuda: bool = False, **kwargs: Any) MstepResult [source]¶
CPD Registraion.
- Parameters
source (numpy.ndarray) – Source point cloud data.
target (numpy.ndarray) – Target point cloud data.
tf_type_name (str, optional) – Transformation type(‘rigid’, ‘affine’, ‘nonrigid’, ‘nonrigid_constrained’)
w (float, optional) – Weight of the uniform distribution, 0 < w < 1.
maxitr (int, optional) – Maximum number of iterations to EM algorithm.
tol (float, optional) – Tolerance for termination.
callback (
list
offunction
, optional) – Called after each iteration. callback(probreg.Transformation)use_cuda (bool, optional) – Use CUDA.
- Keyword Arguments
update_scale (bool, optional) – If this flag is true and tf_type is rigid transformation, then the scale is treated. The default is true.
tf_init_params (dict, optional) – Parameters to initialize transformation (for rigid or affine).
- Returns
Result of the registration (transformation, sigma2, q)
- Return type
features¶
- class probreg.features.FPFH(radius_normal: float = 0.1, radius_feature: float = 0.5)[source]¶
Bases:
Feature
Fast Point Feature Histograms
- Parameters
radius_normal (float) – Radius search parameter for computing normal vectors
radius_feature (float) – Radius search parameter for computing FPFH.
- class probreg.features.GMM(n_gmm_components: int = 800)[source]¶
Bases:
Feature
Feature points extraction using Gaussian mixture model
- Parameters
n_gmm_components (int) – The number of mixture components.
- class probreg.features.OneClassSVM(dim: int, sigma: float, gamma: float = 0.5, nu: float = 0.05, delta: float = 10.0)[source]¶
Bases:
Feature
Feature points extraction using One class SVM
- Parameters
dim (int) – The dimension of samples.
sigma (float) – Veriance of the gaussian distribution made from parameters of SVM.
gamma (float, optional) – Coefficient for RBF kernel.
nu (float, optional) – An upper bound on the fraction of training errors and a lower bound of the fraction of support vectors.
delta (float, optional) – Anealing parameter for optimization.
filterreg¶
- class probreg.filterreg.EstepResult(m0, m1, m2, nx)¶
Bases:
tuple
- property m0¶
Alias for field number 0
- property m1¶
Alias for field number 1
- property m2¶
Alias for field number 2
- property nx¶
Alias for field number 3
- class probreg.filterreg.MstepResult(transformation, sigma2, q)¶
Bases:
tuple
Result of Maximization step.
- transformation¶
Transformation from source to target.
- Type
tf.Transformation
- sigma2¶
Variance of Gaussian distribution.
- Type
float
- q¶
Result of likelihood.
- Type
float
- property q¶
Alias for field number 2
- property sigma2¶
Alias for field number 1
- property transformation¶
Alias for field number 0
- class probreg.filterreg.FilterReg(source=None, target_normals=None, sigma2=None, update_sigma2=False)[source]¶
Bases:
object
FilterReg is similar to CPD, and the speed performance is improved. In this algorithm, not only point-to-point alignment but also point-to-plane alignment are implemented.
- Parameters
source (numpy.ndarray, optional) – Source point cloud data.
target_normals (numpy.ndarray, optional) – Normals of target points.
sigma2 (Float, optional) – Variance parameter. If this variable is None, the variance is updated in Mstep.
update_sigma2 (bool, optional) – If this variable is True, Update sigma2 in the registration iteration.
- class probreg.filterreg.RigidFilterReg(source=None, target_normals=None, sigma2=None, update_sigma2=False, tf_init_params={})[source]¶
Bases:
FilterReg
- class probreg.filterreg.DeformableKinematicFilterReg(source=None, skinning_weight=None, sigma2=None)[source]¶
Bases:
FilterReg
- probreg.filterreg.registration_filterreg(source: ~typing.Union[~numpy.ndarray, ~open3d.cpu.pybind.geometry.PointCloud], target: ~typing.Union[~numpy.ndarray, ~open3d.cpu.pybind.geometry.PointCloud], target_normals: ~typing.Optional[~numpy.ndarray] = None, sigma2: ~typing.Optional[float] = None, update_sigma2: bool = False, w: float = 0, objective_type: str = 'pt2pt', maxiter: int = 50, tol: float = 0.001, min_sigma2: float = 0.0001, feature_fn: ~typing.Callable = <function <lambda>>, callbacks: ~typing.List[~typing.Callable] = [], **kwargs: ~typing.Any)[source]¶
FilterReg registration
- Parameters
source (numpy.ndarray) – Source point cloud data.
target (numpy.ndarray) – Target point cloud data.
target_normals (numpy.ndarray, optional) – Normal vectors of target point cloud.
sigma2 (float, optional) – Variance of GMM. If sigma2 is None, sigma2 is automatically updated.
w (float, optional) – Weight of the uniform distribution, 0 < w < 1.
objective_type (str, optional) – The type of objective function selected by ‘pt2pt’ or ‘pt2pl’.
maxitr (int, optional) – Maximum number of iterations to EM algorithm.
tol (float, optional) – Tolerance for termination.
min_sigma2 (float, optional) – Minimum variance of GMM.
feature_fn (function, optional) – Feature function. If you use FPFH feature, set feature_fn=probreg.feature.FPFH().
callback (
list
offunction
, optional) – Called after each iteration. callback(probreg.Transformation)
- Keyword Arguments
tf_init_params (dict, optional) – Parameters to initialize transformation (for rigid).
- Returns
Result of the registration (transformation, sigma2, q)
- Return type
gauss_transform¶
- class probreg.gauss_transform.GaussTransform(source: ndarray, h: float, eps: float = 0.0001, sw_h: float = 0.01)[source]¶
Bases:
object
Calculate Gauss Transform
- Parameters
source (numpy.ndarray) – Source data.
h (float) – Bandwidth parameter of the Gaussian.
eps (float) – Small floating point used in Gauss Transform.
sw_h (float) – Value of the bandwidth parameter to switch between direct method and IFGT.
gaussian_filtering¶
gmmtree¶
- class probreg.gmmtree.MstepResult(transformation, q)¶
Bases:
tuple
Result of Maximization step.
- transformation¶
Transformation from source to target.
- Type
tf.Transformation
- q¶
Result of likelihood.
- Type
float
- property q¶
Alias for field number 1
- property transformation¶
Alias for field number 0
- class probreg.gmmtree.GMMTree(source: Optional[ndarray] = None, tree_level: int = 2, lambda_c: float = 0.01, lambda_s: float = 0.001, tf_init_params: Dict = {})[source]¶
Bases:
object
GMM Tree
- Parameters
source (numpy.ndarray, optional) – Source point cloud data.
tree_level (int, optional) – Maximum depth level of GMM tree.
lambda_c (float, optional) – Parameter that determine the pruning of GMM tree.
lambda_s (float, optional) – Parameter that tolerance for building GMM tree.
tf_init_params (dict, optional) – Parameters to initialize transformation.
- expectation_step(target: ndarray) EstepResult [source]¶
- maximization_step(estep_res: EstepResult, trans_p: Transformation) MstepResult [source]¶
- registration(target: ndarray, maxiter: int = 20, tol: float = 0.0001) MstepResult [source]¶
- probreg.gmmtree.registration_gmmtree(source: Union[ndarray, PointCloud], target: Union[ndarray, PointCloud], maxiter: int = 20, tol: float = 0.0001, callbacks: List[Callable] = [], **kwargs: Any) MstepResult [source]¶
GMMTree registration
- Parameters
source (numpy.ndarray) – Source point cloud data.
target (numpy.ndarray) – Target point cloud data.
maxitr (int, optional) – Maximum number of iterations to EM algorithm.
tol (float, optional) – Tolerance for termination.
callback (
list
offunction
, optional) – Called after each iteration. callback(probreg.Transformation)
- Keyword Arguments
tree_level (int, optional) – Maximum depth level of GMM tree.
lambda_c (float, optional) – Parameter that determine the pruning of GMM tree.
lambda_s (float, optional) – Parameter that tolerance for building GMM tree.
tf_init_params (dict, optional) – Parameters to initialize transformation.
- Returns
Result of the registration (transformation, q)
- Return type
l2dist_regs¶
- class probreg.l2dist_regs.L2DistRegistration(source: ndarray, feature_gen: Feature, cost_fn: CostFunction, sigma: float = 1.0, delta: float = 0.9, use_estimated_sigma: bool = True)[source]¶
Bases:
object
L2 distance registration class This algorithm expresses point clouds as mixture gaussian distributions and performs registration by minimizing the distance between two distributions.
- Parameters
source (numpy.ndarray) – Source point cloud data.
feature_gen (probreg.features.Feature) – Generator of mixture gaussian distribution.
cost_fn (probreg.cost_functions.CostFunction) – Cost function to caliculate L2 distance.
sigma (float, optional) – Scaling parameter for L2 distance.
delta (float, optional) – Annealing parameter for optimization.
use_estimated_sigma (float, optional) – If this flag is True, sigma estimates from the source point cloud.
- registration(target: ndarray, maxiter: int = 1, tol: float = 0.001, opt_maxiter: int = 50, opt_tol: float = 0.001) Transformation [source]¶
- class probreg.l2dist_regs.RigidGMMReg(source, sigma=1.0, delta=0.9, n_gmm_components=800, use_estimated_sigma=True)[source]¶
Bases:
L2DistRegistration
- class probreg.l2dist_regs.TPSGMMReg(source, sigma=1.0, delta=0.9, n_gmm_components=800, alpha=1.0, beta=0.1, use_estimated_sigma=True)[source]¶
Bases:
L2DistRegistration
- class probreg.l2dist_regs.RigidSVR(source, sigma=1.0, delta=0.9, gamma=0.5, nu=0.1, use_estimated_sigma=True)[source]¶
Bases:
L2DistRegistration
- class probreg.l2dist_regs.TPSSVR(source, sigma=1.0, delta=0.9, gamma=0.5, nu=0.1, alpha=1.0, beta=0.1, use_estimated_sigma=True)[source]¶
Bases:
L2DistRegistration
- probreg.l2dist_regs.registration_gmmreg(source: ndarray, target: ndarray, tf_type_name: str = 'rigid', callbacks: List = [], **kargs)[source]¶
GMMReg.
- Parameters
source (numpy.ndarray) – Source point cloud data.
target (numpy.ndarray) – Target point cloud data.
tf_type_name (str, optional) – Transformation type(‘rigid’, ‘nonrigid’)
callback (
list
offunction
, optional) – Called after each iteration. callback(probreg.Transformation)
- Returns
Transformation from source to target.
- Return type
probreg.Transformation
- probreg.l2dist_regs.registration_svr(source: Union[ndarray, PointCloud], target: Union[ndarray, PointCloud], tf_type_name: str = 'rigid', maxiter: int = 1, tol: float = 0.001, opt_maxiter: int = 50, opt_tol: float = 0.001, callbacks: List[Callable] = [], **kwargs: Any)[source]¶
Support Vector Registration.
- Parameters
source (numpy.ndarray) – Source point cloud data.
target (numpy.ndarray) – Target point cloud data.
tf_type_name (str, optional) – Transformation type(‘rigid’, ‘nonrigid’)
maxitr (int, optional) – Maximum number of iterations for outer loop.
tol (float, optional) – Tolerance for termination of outer loop.
opt_maxitr (int, optional) – Maximum number of iterations for inner loop.
opt_tol (float, optional) – Tolerance for termination of inner loop.
callback (
list
offunction
, optional) – Called after each iteration. callback(probreg.Transformation)
- Returns
Transformation from source to target.
- Return type
probreg.Transformation
math_utils¶
se3_op¶
- probreg.se3_op.skew(x: ndarray) ndarray [source]¶
skew-symmetric matrix, that represent cross products as matrix multiplications.
- Parameters
x (numpy.ndarray) – 3D vector.
- Returns
3x3 skew-symmetric matrix.
- probreg.se3_op.twist_trans(tw: np.ndarray, linear: bool = False) tuple[np.ndarray, np.ndarray] [source]¶
Convert from twist representation to transformation matrix.
- Parameters
tw (numpy.ndarray) – Twist vector.
linear (bool, optional) – Linear approximation.
- probreg.se3_op.twist_mul(tw: np.ndarray, rot: np.ndarray, t: np.ndarray, linear: bool = False) tuple[np.ndarray, np.ndarray] [source]¶
Multiply twist vector and transformation matrix.
- Parameters
tw (numpy.ndarray) – Twist vector.
rot (numpy.ndarray) – Rotation matrix.
t (numpy.ndarray) – Translation vector.
linear (bool, optional) – Linear approximation.
transformation¶
- class probreg.transformation.Transformation(xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/probreg/envs/latest/lib/python3.7/site-packages/numpy/__init__.py'>)[source]¶
Bases:
object
- class probreg.transformation.RigidTransformation(rot=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), t=array([0., 0., 0.]), scale=1.0, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/probreg/envs/latest/lib/python3.7/site-packages/numpy/__init__.py'>)[source]¶
Bases:
Transformation
Rigid Transformation
- Parameters
rot (numpy.ndarray, optional) – Rotation matrix.
t (numpy.ndarray, optional) – Translation vector.
scale (Float, optional) – Scale factor.
xp (module, optional) – Numpy or Cupy.
- class probreg.transformation.AffineTransformation(b=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), t=array([0., 0., 0.]), xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/probreg/envs/latest/lib/python3.7/site-packages/numpy/__init__.py'>)[source]¶
Bases:
Transformation
Affine Transformation
- Parameters
b (numpy.ndarray, optional) – Affine matrix.
t (numpy.ndarray, optional) – Translation vector.
xp (module, optional) – Numpy or Cupy.
- class probreg.transformation.NonRigidTransformation(w, points, beta=2.0, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/probreg/envs/latest/lib/python3.7/site-packages/numpy/__init__.py'>)[source]¶
Bases:
Transformation
Nonrigid Transformation
- Parameters
w (numpy.array) – Weights for kernel.
points (numpy.array) – Source point cloud data.
beta (float, optional) – Parameter for gaussian kernel.
xp (module) – Numpy or Cupy.
- class probreg.transformation.CombinedTransformation(rot=array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]), t=array([0.0, 0.0, 0.0]), scale=1.0, v=0.0)[source]¶
Bases:
Transformation
Combined Transformation
- Parameters
rot (numpy.array, optional) – Rotation matrix.
t (numpy.array, optional) – Translation vector.
scale (float, optional) – Scale factor.
v (numpy.array, optional) – Nonrigid term.
- class probreg.transformation.TPSTransformation(a, v, control_pts, kernel=<function tps_kernel>)[source]¶
Bases:
Transformation
Thin Plate Spline transformaion.
- Parameters
a (numpy.array) – Affine matrix.
v (numpy.array) – Translation vector.
control_pts (numpy.array) – Control points.
kernel (function, optional) – Kernel function.
- class probreg.transformation.DeformableKinematicModel(dualquats, weights)[source]¶
Bases:
Transformation
Deformable Kinematic Transformation
- Parameters
dualquats (
list
ofdq3d.dualquat
) – Transformations for each link.weights (DeformableKinematicModel.SkinningWeight) – Skinning weight.