GithubHelp home page GithubHelp logo

lizeyu000-code / ecpd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from felixlaufer/ecpd

0.0 0.0 0.0 173 KB

Extended Coherent Point Drift algorithm for point set registration with optional prior point correspondences

License: MIT License

C++ 92.05% C 4.49% CMake 3.46%

ecpd's Introduction

ECPD

Extended Coherent Point Drift algorithm for point set registration with prior information.

This is an efficient C++ implementation of the ECPD algorithms for n-dimensional point set registration. The goal of point set registration algorithms in computer vision is 1) to find correspondences between two point sets X and Y and 2) to compute a transformation mapping from one to the other. Finding correspondences between points along with a suitable transformation makes this class of algorithms especially usefull. While the original CPD introduced by A. Myronenko and X. Song does not consider any prior knowledge regarding point correspondences, the extended version introduced by V. Golyanik et al. incorporates (sparse) correspondence pairs as constraints.

This implementation provides rigid, affine and non-rigid transformations T(Y) between two point sets X and Y.

  • rigid: T(Y) = sYRT +1tT, i.e. transformation can be described by rotation, translation and a scaling factor (3 rot + 3 trans + 1 scal = 7 DoF).
  • affine: T(Y) = YBT +1tT, i.e. affine matrix B is unconstrained, allowing any scalings and sheer (3 rot + 3 trans + 3 scal + 3 sheer = 12 DoF).
  • non-rigid: T(Y) = Y + GW, with G a Gaussian kernel and W a coefficient matrix depending on smootheness and regularization parameters.

Original papers

CPD: https://www.researchgate.net/publication/47544556_Point_Set_Registration_Coherent_Point_Drift

ECPD: https://www.researchgate.net/publication/297497171_Extended_Coherent_Point_Drift_Algorithm_with_Correspondence_Priors_and_Optimal_Subsampling

Rigid registration use-case

// Read test data set
const Matrix Y = parseXYZData("bunny.xyz");

// Apply some known rigid transformation
const Matrix R = AngleAxis(Pi_4, Vector3::UnitZ()).toRotationMatrix(); // rotate 45 deg around z-axis
const Vector3 t = Vector3(1, 2, 3); // shift
const ScalarType s = 4; // scale
const Matrix X = s * Y * R.transpose() + Vector::Ones(Y.rows()) * t.transpose();

// Let's see if we can find it
const auto res = ECPD<Rigid>::compute(X, Y, ECPD<Rigid>::Config()); 
std::cout << "R = \n" << res.first.R << std::endl; // found rotation matrix
std::cout << "t = " << res.first.t.transpose() << std::endl; // found translation vector
std::cout << "s = " << s << std::endl; // found scaling factor

Non-rigid registration example

// Apply some non-rigid transformation
Matrix X = Y;
const Matrix W = 0.005 * Matrix::Random(X.rows(), X.cols());
X += W + Vector::Ones(Y.rows()) * Vector3(0, 0, 0.1).transpose();
// Permutate rows, i.e. destroy correspondences, to make it a bit harder
X = permutateRows(X);

// Let's see if we can find it
const auto res = ECPD<NonRigid>::compute(X, Y, ECPD<NonRigid>::Config());
showPCs(res.second.T, Y);

non-rigid registration

Requires

  • Eigen3
  • (optional: OpenMP)

ecpd's People

Contributors

felixlaufer avatar

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.