Giter VIP home page Giter VIP logo

thinplatesplines's Introduction

ThinPlateSpline

n-dimensional thin plate splines in c and matlab.

At present, this computes the full interpolation kernel; it's not sparse and updating the kernel can be expensive. However, for many applications, the kernel only needs to be computed once and can then be resused many times. That's the approach used here.

Example

In Matlab

  t=ThinPlateSpline;  
  [yy,xx]=meshgrid(linspace(1,512,5),linspace(1,512,5));
  t.SourceSpaceKnots=[xx(:) yy(:)]; % leads to kernel computation
  [yy,xx]=meshgrid(1:512,1:512);
  t.SourceSpaceQuery=[xx(:) yy(:)]; % leads to kernel computation

  % might repeat this many times
  t.DestSpaceKnots=perturb(s); % a fast update
  r=map(t);

In C

  #include "tps.h"
  ...
  tps_t ctx=make_tps(stiffness,src_knots,nknots,ndims);
  tps_fit(ctx,dst_knots,src_knots,stiffness);
  tps_eval(ctx,npoints,dst_query,src_query); // dst_query is the output

  { // might repeat this many times 
    tps_update(ctx,perturb(dst_knots),tps_stiffness(ctx)); 
    tps_eval(ctx,npoints,dst_query,0);  // will re-use last src_query
  }
  free_tps(ctx); // cleanup at the end

Building

Requires CMake.

You also need a C++ compiler and, optionally, Matlab.

Building may require an internet connection. The build process may attempt to download Eigen, which is the linear algebra library used under the hood.

After installing CMake, and making sure it's on your path. The first steps look the same for most operating systems. Open a terminal, change directory to where you cloned this repository, and then type:

Configure

Everywhere

  mkdir build
  cd build
  cmake ..

Note that configuring as a Release build results in much faster (~10X) code than a Debug build. To make sure you have a release build use:

  cmake -DCMAKE_BUILD_TYPE=Release ..

Build

On OS X and *nix:

  make package

This will build a .tgz file you can unpack somewhere. All the matlab stuff will be assembled in a matlab subdirectory in that package.

On Windows

with Microsoft Visual Studio:

  1. Open the tps.sln file that has been created in the build directory.

  2. Build the PACKAGE target in the solution that opens up. This should[1] build an executable installer in the build directory. It will install to something like: "C:\Program Files\tps". You can also configure the build to produce a .zip file archive if you don't want the installer.

[1]: My CMakeLists.txt might be missing some stuff required for the NSIS installer. This is untested at the moment.

thinplatesplines's People

Contributors

nclack avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

tonsty

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.