nocs_utils.py
cpas_toolbox.datasets.nocs_utils ¶
Module for utility function related to NOCS dataset.
This module contains functions to find similarity transform from NOCS maps and evaluation function for typical metrics on the NOCS datasets.
Aligning code by Srinath Sridhar
https://raw.githubusercontent.com/hughw19/NOCS_CVPR2019/master/aligning.py
PoseEstimationError ¶
estimate_similarity_transform ¶
estimate_similarity_transform(
source: np.ndarray, target: np.ndarray, verbose: bool = False
) -> tuple
Estimate similarity transform from source to target from point correspondences.
Source and target are pairwise correponding pointsets, i.e., they include same number of points and the first point of source corresponds to the first point of target. RANSAC is used for outlier-robust estimation.
A similarity transform is estimated (i.e., isotropic scale, rotation and translation) that transforms source points onto the target points.
Note that the returned values fulfill the following equations transform @ source_points = scale * rotation_matrix @ source_points + position when ignoring homogeneous coordinate for left-hand side.
PARAMETER | DESCRIPTION |
---|---|
source |
Source points that will be transformed, shape (N,3).
TYPE:
|
target |
Target points to which source will be aligned to, shape (N,3).
TYPE:
|
verbose |
If true additional information will be printed.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
position
|
Translation to translate source to target, shape (3,).
TYPE:
|
rotation_matrix
|
Rotation to rotate source to target, shape (3,3).
TYPE:
|
scale
|
Scaling factor along each axis, to scale source to target.
TYPE:
|
transform
|
Homogeneous transformation matrix, shape (4,4).
TYPE:
|