Important: Please read the installation page for details about how to install the toolboxes. $\newcommand{\dotp}[2]{\langle #1, #2 \rangle}$ $\newcommand{\enscond}[2]{\lbrace #1, #2 \rbrace}$ $\newcommand{\pd}[2]{ \frac{ \partial #1}{\partial #2} }$ $\newcommand{\umin}[1]{\underset{#1}{\min}\;}$ $\newcommand{\umax}[1]{\underset{#1}{\max}\;}$ $\newcommand{\umin}[1]{\underset{#1}{\min}\;}$ $\newcommand{\uargmin}[1]{\underset{#1}{argmin}\;}$ $\newcommand{\norm}[1]{\|#1\|}$ $\newcommand{\abs}[1]{\left|#1\right|}$ $\newcommand{\choice}[1]{ \left\{ \begin{array}{l} #1 \end{array} \right. }$ $\newcommand{\pa}[1]{\left(#1\right)}$ $\newcommand{\diag}[1]{{diag}\left( #1 \right)}$ $\newcommand{\qandq}{\quad\text{and}\quad}$ $\newcommand{\qwhereq}{\quad\text{where}\quad}$ $\newcommand{\qifq}{ \quad \text{if} \quad }$ $\newcommand{\qarrq}{ \quad \Longrightarrow \quad }$ $\newcommand{\ZZ}{\mathbb{Z}}$ $\newcommand{\CC}{\mathbb{C}}$ $\newcommand{\RR}{\mathbb{R}}$ $\newcommand{\EE}{\mathbb{E}}$ $\newcommand{\Zz}{\mathcal{Z}}$ $\newcommand{\Ww}{\mathcal{W}}$ $\newcommand{\Vv}{\mathcal{V}}$ $\newcommand{\Nn}{\mathcal{N}}$ $\newcommand{\NN}{\mathcal{N}}$ $\newcommand{\Hh}{\mathcal{H}}$ $\newcommand{\Bb}{\mathcal{B}}$ $\newcommand{\Ee}{\mathcal{E}}$ $\newcommand{\Cc}{\mathcal{C}}$ $\newcommand{\Gg}{\mathcal{G}}$ $\newcommand{\Ss}{\mathcal{S}}$ $\newcommand{\Pp}{\mathcal{P}}$ $\newcommand{\Ff}{\mathcal{F}}$ $\newcommand{\Xx}{\mathcal{X}}$ $\newcommand{\Mm}{\mathcal{M}}$ $\newcommand{\Ii}{\mathcal{I}}$ $\newcommand{\Dd}{\mathcal{D}}$ $\newcommand{\Ll}{\mathcal{L}}$ $\newcommand{\Tt}{\mathcal{T}}$ $\newcommand{\si}{\sigma}$ $\newcommand{\al}{\alpha}$ $\newcommand{\la}{\lambda}$ $\newcommand{\ga}{\gamma}$ $\newcommand{\Ga}{\Gamma}$ $\newcommand{\La}{\Lambda}$ $\newcommand{\si}{\sigma}$ $\newcommand{\Si}{\Sigma}$ $\newcommand{\be}{\beta}$ $\newcommand{\de}{\delta}$ $\newcommand{\De}{\Delta}$ $\newcommand{\phi}{\varphi}$ $\newcommand{\th}{\theta}$ $\newcommand{\om}{\omega}$ $\newcommand{\Om}{\Omega}$
This tour explores the use of farthest point sampling to compute bending invariant with classical MDS (strain minimization).
from __future__ import division
import nt_toolbox as nt
from nt_solutions import shapes_3_bendinginv_landmarks as solutions
%matplotlib inline
%load_ext autoreload
%autoreload 2
For large mesh, computing all the pairwise distances is intractable. It is possible to speed up the computation by restricting the computation to a small subset of landmarks.
This seeding strategy was used for surface remeshing in:
Geodesic Remeshing Using Front Propagation, Gabriel Peyr and Laurent Cohen, International Journal on Computer Vision, Vol. 69(1), p.145-156, Aug. 2006.
Load a mesh.
name = 'elephant-50kv'
options.name = name
[vertex, faces] = read_mesh(name)
nverts = size(vertex, 2)
Display it.
plot_mesh(vertex, faces, options)
Compute a sparse set of landmarks to speed up the geodesic computations. The landmarks are computed using farthest point sampling.
First landmarks, at random.
landmarks = 23057
Dland = []
Perform Fast Marching to compute the geodesic distance, and record it.
[Dland(: , end + 1), S, Q] = perform_fast_marching_mesh(vertex, faces, landmarks(end))
Select farthest point. Here, |min(Dland,[],2)| is the distance to the set of seed points.
[tmp, landmarks(end + 1)] = max(min(Dland, [], 2))
Update distance function.
[Dland(: , end + 1), S, Q] = perform_fast_marching_mesh(vertex, faces, landmarks(end))
Display distances.
options.start_points = landmarks
plot_fast_marching_mesh(vertex, faces, min(Dland, [], 2) , [], options)
Exercise 1
Compute a set of |n = 300| vertex by iterating this farthest point sampling. Display the progression of the sampling.
solutions.exo1()
## Insert your code here.
Compute the distance matrix restricted to the landmarks.
D = Dland(landmarks, : )
D = (D + D')/ 2
One can compute the bending invariant of the set of landmarks, and then apply it to the whole mesh using interpolation.
Compute a centered kernel for the Landmarks, that should be approximately a matrix of inner products.
J = eye(n) - ones(n)/ n
K = -1/ 2 * J*(D.^2)*J
Perform classical MDS on the reduced set of points, to obtain new positions in 3D.
opt.disp = 0
[Xstrain, val] = eigs(K, 3, 'LR', opt)
Xstrain = Xstrain .* repmat(sqrt(diag(val))', [n 1])
Xstrain = Xstrain'
Interpolate the locations to the whole mesh by Nystrom eigen-extrapolation, as detailed in
Sparse multidimensional scaling using landmark points V. de Silva, J.B. Tenenbaum, Preprint.
vertex1 = zeros(nverts, 3)
deltan = mean(Dland.^2, 1)
for i in 1: nverts:
deltax = Dland(i, : ).^2
vertex1(i, : ) = 1/ 2 * (Xstrain * (deltan-deltax)')'
vertex1 = vertex1'
Display the bending invariant mesh.
plot_mesh(vertex1, faces, options)
The proposed interpolation method is valid only for the Strain minimizer (spectral Nistrom interpolation). One thus needs to use another interpolation method.
See for instance this work for a method to do such an interpolation:
A. M. Bronstein, M. M. Bronstein, R. Kimmel, Efficient computation of isometry-invariant distances between surfaces, SIAM J. Scientific Computing, Vol. 28/5, pp. 1812-1836, 2006.
Exercise 2
Create an interpolation scheme to interpolate the result of MDS dimensionality reduction with Stree minimization (SMACOF algorithm).
solutions.exo2()
## Insert your code here.