A python implementation of rigid and affine alignment using the coherent point drift algorithm. Includes brute-force search for rigid alignment in global rotation space.
Installing the package via setup.py
is the recommended usage. This provides
the executable cpd
. Detailed instructions can be found in
the official documentation. It can also be run from the source
directory with python3 -m coherent_point_drift.main
.
Python 3 and Numpy. Numpy is available from PyPI and can be installed as described in the pip documentation. To support plotting, matplotlib is required. To support MATLAB compatible output, scipy is required. These are all available from PyPI.
Detailed instructions and lists of supported formats are available with the
--help
option, but general use is as follows:
cpd align reference.csv points.csv
This will produce a transform to align the points in points.csv
to the points
in reference.csv
(other input formats are supported).
To save the resulting transform (e.g. for plotting), specify the --format
argument. Then, redirect the output into your target file:
cpd align reference.csv points.csv --format pickle > xform.pickle
The alignment can be visualized with the plot
command:
cpd plot reference.csv points.csv xform.pickle
Or, it can be applied to an arbitrary set of points with the xform
command:
cpd xform points.csv xform --format txt
Note --format
specifies the format of the output, the input format is guessed
from the file extension.
Some sample points and a transform can be found in the tests/fixtures
directory, as ref.pickle
, deg.pickle
and xform.pickle
respectively.