{"id":17296967,"url":"https://github.com/gadomski/cpd","last_synced_at":"2025-04-04T11:13:53.180Z","repository":{"id":21682006,"uuid":"25003224","full_name":"gadomski/cpd","owner":"gadomski","description":"C++ implementation of the Coherent Point Drift point set registration algorithm.","archived":false,"fork":false,"pushed_at":"2024-04-23T15:01:41.000Z","size":6763,"stargazers_count":418,"open_issues_count":14,"forks_count":124,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-03-28T10:08:08.176Z","etag":null,"topics":["c-plus-plus","cpd","pointcloud","registration"],"latest_commit_sha":null,"homepage":"http://www.gadom.ski/cpd","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gadomski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-09T18:38:29.000Z","updated_at":"2025-03-20T03:31:45.000Z","dependencies_parsed_at":"2022-08-18T06:21:54.613Z","dependency_job_id":"893f38d3-5331-4183-a7b0-227d27cb9e1e","html_url":"https://github.com/gadomski/cpd","commit_stats":{"total_commits":407,"total_committers":9,"mean_commits":45.22222222222222,"dds":"0.10810810810810811","last_synced_commit":"6baff760caff16b3823cf18f1466c2b781f11309"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadomski%2Fcpd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadomski%2Fcpd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadomski%2Fcpd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadomski%2Fcpd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gadomski","download_url":"https://codeload.github.com/gadomski/cpd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166168,"owners_count":20894654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","cpd","pointcloud","registration"],"created_at":"2024-10-15T11:14:20.037Z","updated_at":"2025-04-04T11:13:53.158Z","avatar_url":"https://github.com/gadomski.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# cpd\n\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/gadomski/cpd/build.yml?style=for-the-badge)](https://github.com/gadomski/cpd/actions/workflows/build.yml)\n\n**Coherent Point Drift (CPD)** is a point-set registration algorithm, originally developed by [Andriy Myronenko](https://sites.google.com/site/myronenko/research/cpd) et al.\nThis is a C++ library that runs CPD.\n\nCPD can be compared to [Iterative Closest Point](https://en.wikipedia.org/wiki/Iterative_closest_point), another point-set registration algorithm that is widely used.\nWhile ICP minimizes point-to-point distances, CPD uses a [Gaussian Mixture Model](https://en.wikipedia.org/wiki/Mixture_model) to minimize the error between a point and *all other points*.\nIf you're thinking that this is very computationally intensive, you're right — both the CPD algorithm and the underlying error calculations take a lot of time, which is why we've created [fgt](https://github.com/gadomski/fgt) to speed up those Gauss transforms.\nWe hope this library provides a freer and more performant alternative to the original reference Matlab implementation.\n\nThis library supports three variants of CPD:\n\n- **rigid**: Uses a rigid transformation (i.e. rotation and translation, with an optional scaling) to align the two datasets.\n- **affine**: Uses an affine transformation, with a translation, to align the two datasets.\n- **nonrigid**: Uses a two-parameter non-rigid transformation function to align the two datasets.\n\nAndriy's reference implementation comes with one other type of registration, **nonrigid_lowrank**, which is not implemented in the latest version of this library (yet) (see [History](#history) for information on how to find and use a previous version of this library that has **nonrigid_lowrank**).\n\nThis code lives [on Github](https://github.com/gadomski/cpd).\nIt has some [Doxygen documentation](http://gadomski.github.io/cpd).\n\n## Usage\n\nBasic, default usage can be accomplished via some namespace-level methods:\n\n```cpp\n#include \u003ccpd/rigid.hpp\u003e\n\nint main(int argc, char** argv) {\n    cpd::Matrix fixed = load_points_from_somewhere();\n    cpd::Matrix moving = load_points_from_somewhere();\n    cpd::RigidResult result = cpd::rigid(fixed, moving);\n    return 0;\n}\n```\n\nConfiguration is possible via `Rigid`, `Nonrigid`, and `Affine`:\n\n```cpp\n#include \u003ccpd/rigid.hpp\u003e\n\nint main(int argc, char** argv) {\n    cpd::Matrix fixed = load_points_from_somewhere();\n    cpd::Matrix moving = load_points_from_somewhere();\n    cpd::Rigid rigid;\n    rigid.correspondence(true).outliers(0.2);\n    cpd::RigidResult result = rigid.run(fixed, moving);\n    return 0;\n}\n```\n\nIf cpd is built with the `jsoncpp` component (see `examples/` for a demonstration of the CMake configuration), the results of the cpd run can be converted to json:\n\n```cpp\n#include \u003ciostream\u003e\n#include \u003ccpd/jsoncpp.hpp\u003e\n#include \u003ccpd/rigid.hpp\u003e\n\nint main(int argc, char** argv) {\n    cpd::Matrix fixed = load_points_from_somewhere();\n    cpd::Matrix moving = load_points_from_somewhere();\n    cpd::RigidResult result = cpd::rigid(fixed, moving);\n    std::cout \u003c\u003c cpd::to_json(result) \u003c\u003c std::endl;\n    return 0;\n}\n```\n\nSee the code and the [documentation](http://gadomski.github.io/cpd) to discover all possible options, transformation methods, and probability calculation methods.\n\n## Examples\n\nSee `examples/` in this code repository for some basic usage examples, including examples of how to set up a downstream CMake project that depends on cpd.\n\n## Installation\n\n**cpd** depends on and [CMake](https://cmake.org/) and [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page) at build time only — no runtime dependencies.\nFor additional speed, it can also built with [fgt](https://github.com/gadomski/fgt).\nFor json output of results, it can be built with [jsoncpp](https://github.com/open-source-parsers/jsoncpp).\n\n### On OSX\n\nIf you're on a Mac, use [homebrew](http://brew.sh/) and [my tap](https://github.com/gadomski/homebrew-gadomski) to install:\n\n```bash\nbrew tap gadomski/gadomski\nbrew install cpd\n```\n\n### From source\n\nUse the usual CMake build incantation:\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake\n```\n\nIf you're using a home-built version of jsoncpp, make sure you set the following options when building and installing jsoncpp (this allows cpd to find jsoncpp):\n\n- `JSONCPP_WITH_CMAKE_PACKAGE=ON`\n- `BUILD_SHARED_LIBS=ON`\n\n### Using downstream\n\n**cpd** provides CMake export targets that you can import and use in your own project:\n\n```cmake\nfind_package(Cpd REQUIRED)\nadd_library(my-great-library\n    the_code.cpp\n    )\ntarget_link_libraries(my-great-library\n    PUBLIC\n    Cpd::Library-C++\n    )\n```\n\nThe `Cpd::Library-C++` target includes all the interface settings you need, so you shouldn't need any other calls to get set up.\n\nIf you'd like to enable json support, use the jsoncpp component:\n\n```cmake\nfind_package(Cpd COMPONENTS jsoncpp REQUIRED)\nadd_library(my-great-library the_code.cpp)\ntarget_link_libraries(my-great-library PUBLIC Cpd::Library-C++ Cpd::Jsoncpp)\n```\n\n## OpenMP\n\nBoth fgt and Eigen support OpenMP for some operations.\nAs of yet, the interaction between the two is untested, so our official recommendation is to only use OpenMP with one of the projects, not both.\nIf you do some work with OpenMP we'd love to hear how it goes.\n\n## Contributing\n\nGithub [issues](https://github.com/gadomski/cpd/issues) and [pull requests](https://github.com/gadomski/cpd/pulls), per usual.\n\n## History\n\nThe [v0.1](https://github.com/gadomski/cpd/tree/v0.1) and [v0.2](https://github.com/gadomski/cpd/tree/v0.2) lineages of **cpd** used [armadillo](http://arma.sourceforge.net/) for linear arithmetic instead of Eigen.\nArmadillo is a bit smoother for doing advanced eigenvalue decompositions and other operations, which made it a bit easier at first to directly port the Matlab reference implementation.\nFor a couple of reasons, we decided to switch to Eigen for v0.3.\n\nFirst, the Armadillo project had the bad habit of removing old versions from their download site, making it hard to maintain working code as their codebase developed.\nSecond, many downstream applications use Eigen themselves, making Eigen a lower-friction choice for those users.\n\nAs of this writing, the Eigen implementation is less feature-full than the old Armadillo implementation, particularly with respect to the nonrigid_lowrank version.\nIf you require some of that old functionality, use the [v0.2](https://github.com/gadomski/cpd/tree/v0.2) branch.\nIf you need armadillo-5.x, which is required for the old **cpd** but is no longer available from the armadillo website, you can use [my mirror](https://github.com/gadomski/armadillo).\nThanks for your understanding during this switch.\n\n## Publications\n\nThis library has been used in the following publications:\n\n- Gadomski, P.J. (December 2016). *Measuring Glacier Surface Velocities With LiDAR: A Comparison of Three-Dimensional Change Detection Methods*. Master's thesis, University of Houston, Geosensing Systems Engineering and Sciences.\n\n## License\n\nThis library is GPL2, copyright 2017 Peter J. Gadomski.\nSee LICENSE.txt for the full license text.\n\nThis work is directly inspired by Andriy Myronenko's reference implementation, and we owe him many thanks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgadomski%2Fcpd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgadomski%2Fcpd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgadomski%2Fcpd/lists"}