GithubHelp home page GithubHelp logo

tps-deformation's Introduction

Thin Plate Spline Interpolation and Deformation

Compute thin plate spline interpolation and deformation on a 3D surface.

Interpolation

  • Control points: points on the surface to perform the interpolation (blue points on Figure 1 and 2).
  • Displacements: displacements of the interpolated control points (red edges on Figure 1 and 2).
  • Lambda: regularization parameter. See page 4 of http://cseweb.ucsd.edu/~sjb/pami_tps.pdf

Usage: [mapping_coeffs, poly_coeffs] = find_tps_coefficients(control_points, displacemets, lambda)

Figure 1: Input data

Deformation

This basically is a 3D version of the function y(x) on this page: https://en.wikipedia.org/wiki/Polyharmonic_spline

  • Mapping coefficients: weights of the basis function. Same as vector w.
  • Polynomial coefficients: weights v of the polynomial. Example: in 3D, v1 + v2 * x + v3 * y + v4 * z.
  • Control points: same as above.

Usage: [fX, fY, fZ] = deform_surface_tps(X, Y, Z, control_points, mapping_coeffs, poly_coeffs)

Figure 2: Result

Output of demos/tps_interp_demo.m using 20 randomly chosen control points and displacements.

Exact interpolation (lambda = 0)

Regularized interpolation (lambda = 0.2)

Documentation

find_tps_coefficients.m

% FIND_TPS_COEFFICIENTS - Given a set of control points and their
% displacements, compute the coefficients of the TPS interpolant f(S)
% deforming surface S.
%
% Usage:    [mapping_coeffs, poly_coeffs] = ...
%               find_tps_coefficients(control_points, displacemets);
%
% Arguments:
%           control_points - p by d vector of control points.
%           displacemets   - p by d vector of displacements of
%                            corresponding control points in the mapping
%                            function f(S).
%
% Returns:
%           mapping_coeffs - p by d vector of TPS mapping coefficients.
%           poly_coeffs    - d+1 by d vector of TPS polynomial weights.
%
% References:
%           1. http://en.wikipedia.org/wiki/Polyharmonic_spline
%           2. http://en.wikipedia.org/wiki/Thin_plate_spline

deform_surface_tps.m

% DEFORM_SURFACE_TPS - Given a set of control points and mapping
% coefficients, compute a deformed surface f(S) using a thin plate spline
% radial basis function phi(r) as shown in [1].
%
% Usage:    [fX, fY, fZ] = deform_surface_tps(X, Y, Z, control_points, ...
%               mapping_coeffs, poly_coeffs)
%
% Arguments:
%           X, Y, Z        - h by w matrices of X, Y, Z components of the
%                            surface.
%           control_points - p by 3 vector of control points. Same as
%                            vector c in [1].
%           mapping_coeffs - p by 3 vector of weights of the basis
%                            functions. Same as vector w in [1].
%           poly_coeffs    - 4 by 3 vector of weights of the polynomial.
%                            Same as vector v in [1].
%
% Returns:
%           fX, fY, fZ     - h by w vectors of X, Y, Z compoments of the
%                            deformed surface.
%
% References:
%           1. http://en.wikipedia.org/wiki/Polyharmonic_spline

tps-deformation's People

Contributors

daeyun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tps-deformation's Issues

Implementation of the code for a different approach

Hello,

Is there any way in "tps_interp_demo.m" file to change the random displacements to displacements in y-direction? When I try to move the two corners at the top of the geometry to y-direction, I face a problem with the X,Y,Z matrices' size.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.