pcAlign: align two 3D-pointclouds/meshes by their principal axes

View source: R/pcAlign.r

pcAlignR Documentation

align two 3D-pointclouds/meshes by their principal axes

Description

align two 3D-pointclouds/meshes by their principal axes

Usage

pcAlign(x, y, optim = TRUE, subsample = NULL, iterations = 10, mc.cores = 2)

## S3 method for class 'matrix'
pcAlign(x, y, optim = TRUE, subsample = NULL, iterations = 10, mc.cores = 2)

## S3 method for class 'mesh3d'
pcAlign(x, y, optim = TRUE, subsample = NULL, iterations = 10, mc.cores = 2)

Arguments

x

matrix or mesh3d

y

matrix or mesh3d, if missing, x will be centered by its centroid and aligned by its princial axis.

optim

logical if TRUE, the RMSE between reference and target will be minimized testing all possible axes alignments and (if iterations > 0) followed by a rigid ICP procedure.

subsample

integer: use subsampled points to decrease computation time of optimization.

iterations

integer: number of iterations for optimization (the higher the more accurate but also more time consuming).

mc.cores

use parallel processing to find best alignment to original shape.

Details

x and y will first be centered and aligned by their PC-axes. If optim=TRUE,all possible 8 ordinations of PC-axes will be tested and the one with the smallest RMSE between the transformed version of x and the closest points on y will be used. Then the rotated version of x is translated to the original center of mass of y.

Value

rotated and translated version of x to the center and principal axes of y.

Examples

data(boneData)
blm1 <- pcAlign(boneLM[,,1],boneLM[,,2])
## Not run: 
require(rgl)
spheres3d(boneLM[,,1])#original position
spheres3d(blm1,col=2)#aligned configuration
spheres3d(boneLM[,,2],col=3)#target

## End(Not run)

Morpho documentation built on Feb. 16, 2023, 10:51 p.m.