segmentalLeastSquare#
- pyCGM2.Model.motion.segmentalLeastSquare(A: ndarray, B: ndarray) Tuple[ndarray, ndarray, float, ndarray, ndarray]#
Compute the transformation between two sets of coordinates using Singular Value Decomposition (SVD).
This function calculates the rotation matrix, translation vector, root mean square error (RMSE), and the centroids of both sets of coordinates. It uses SVD to optimize the least square problem for the transformation.
- Parameters:
A (numpy.ndarray) – An array of shape (n, 3) representing coordinates [x,y,z] of at least three markers.
B (numpy.ndarray) – An array of shape (n, 3) representing coordinates [x,y,z] of at least three markers.
- Returns:
tuple – A tuple containing: - R (numpy.ndarray): The rotation matrix. - L (numpy.ndarray): The translation vector. - RMSE (float): The root mean square error. - Am (numpy.ndarray): The centroid of the first set of coordinates. - Bm (numpy.ndarray): The centroid of the second set of coordinates.