Skip to content

Instantly share code, notes, and snippets.

@gadomski
Created March 28, 2017 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gadomski/a777aff8b6ef1af757f3635835ff0a5b to your computer and use it in GitHub Desktop.
Save gadomski/a777aff8b6ef1af757f3635835ff0a5b to your computer and use it in GitHub Desktop.
CPD rigid with scaling
#include <cpd/jsoncpp.hpp>
#include <cpd/rigid.hpp>
#include <fstream>
#include <iostream>
int main(int argc, char** argv) {
if (argc != 4) {
std::cout << "ERROR: invalid usage" << std::endl;
std::cout << "USAGE: cpd-rigid <fixed> <moving> <outfile>" << std::endl;
return 1;
}
cpd::Matrix fixed = cpd::matrix_from_path(argv[1]);
cpd::Matrix moving = cpd::matrix_from_path(argv[2]);
std::string outfile = argv[3];
cpd::Rigid rigid;
rigid.scale(true);
cpd::RigidResult result = rigid.run(fixed, moving);
std::ofstream out(outfile);
out << result.points;
out.close();
std::cout << cpd::to_json(result) << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment