Skip to content

RobinMagnet/pyFM

Repository files navigation

pyFM - Python bindings for functional maps

NEW API Documentation is available here

pyFM is a pure python implementation of multiple tools used for Functional Maps computations. Namely, it implements shape signatures, functional map optimization and refinement algorithm, and above all an easy-to-use interface for using functional maps.

The package is now in v1.0.0 as it has been stable for quite a long time. It had been released on PyPI.

It can be unstalled using

pip install pyfmaps

Features

  • A TriMesh class incuding many standard geometric measures with python code, including geodesic distances (using the heat method), normals, projection on the LBO basis, export of .off or .obj files with textures.
  • A pure Python (fast) implementation of Laplace-Beltrami Operator.
  • Implementation of HKS and WKS (and their version for landmarks) with multiple level of automation for parameters selection (from full automatic to total control)
  • Implementation of icp and ZoomOut on Python
  • Fast conversion from Functional Map to vertex to vertex map or precise map using p-dimensional vertex to mesh projection
  • A FunctionalMapping class for straightforward computation of Functional Maps mixing all the previous features
  • Functions for evaluating functional maps.
  • Support for Functional Map Networks : Consistent Latent Basis, Canonical Consistent Latent Basis, consistency weights, Consistent ZoomOut

In particular this codebade contains python implementations of the following papers :

Incoming features

Python code for Discrete Optimization and Reversible Harmonic Map should be released soon. Don't hesitate to reach out at <rmagnet@> <lix.polytechnique.fr> for requests.

Dependencies

Hard dependencies are numpy, scipy, tqdm, scikit-learn for its KDTree implementation.

The main non-standard (optional) dependencies are potpourri3d for its robust geodesic distance computation and robust_laplacian which provide an implementation of both intrinsic delaunay and tufted Laplacian. If these functionalities are not needed one can remove the imports here and here.

I did not build on the trimesh package which has some strange behaviour with vertex reordering.

Remark on Code notations

In the whole codebase, we consider pairs of meshes mesh1 and mesh2. Functional maps always go from mesh1 to mesh2 (denoted FM_12) and pointwise maps always from mesh2 to mesh1 (denoted p2p_21)

Example Code

Running the example notebook gives you an overview of the package functions. Note that this notebook requires the meshplot package, which is an easy to use interface for pythreejs, which allows to display mesh in an easy fashion on notebooks.

All functions in the package are documented, with a descriptions of parameters and output.

Example Code for shape matching

See the Example Notebook for example of code.