项目作者: Q-Minh

项目描述 :
Toolkit for Point Cloud Processing
高级语言: C++
项目地址: git://github.com/Q-Minh/point-cloud-processing.git
创建时间: 2020-09-10T21:11:13Z
项目社区:https://github.com/Q-Minh/point-cloud-processing

开源协议:Boost Software License 1.0

下载


Point Cloud Processing Toolkit

MSVC GCC AppleClang Clang
Build status Build status Build status It builds, believe me.

codecov
License

Overview

pcp is a toolkit of common point cloud processing algorithms using C++17.

Tangent Plane Surface Reconstruction Example

Prerequisites

Usage

  1. #include <execution>
  2. #include <filesystem>
  3. #include <pcp/pcp.hpp>
  4. #include <range/v3/view.hpp>
  5. int main(int argc, char** argv)
  6. {
  7. using point_type = pcp::point_t;
  8. using point_view_type = pcp::point_view_t;
  9. using normal_type = pcp::normal_t;
  10. std::filesystem::path input_ply{argv[1]};
  11. auto [points, normals] = pcp::io::read_ply<point_type, normal_type>(input_ply);
  12. auto point_views =
  13. points | ranges::views::transform([](auto& point) { return point_view_type{&point}; });
  14. using octree_type = pcp::basic_linked_octree_t<point_view_type>;
  15. octree_type octree{point_views.begin(), point_views.end()};
  16. std::vector<float> density(points.size(), 0.f);
  17. std::transform(
  18. std::execution::par,
  19. point_views.begin(),
  20. point_views.end(),
  21. density.begin(),
  22. [&](auto const& p) {
  23. pcp::sphere_t<pcp::point_t> sphere{};
  24. sphere.radius = 0.01f;
  25. sphere.position = point_type{p};
  26. auto const points_in_range = octree.range_search(sphere);
  27. auto const pi = 3.14159f;
  28. auto const r3 = sphere.radius * sphere.radius * sphere.radius;
  29. auto const volume = 4.f / 3.f * pi * r3;
  30. return static_cast<float>(points_in_range.size()) / volume;
  31. });
  32. normals.resize(points.size());
  33. auto const knn = [&octree](auto const& p) {
  34. return octree.nearest_neighbours(p, 15u);
  35. };
  36. pcp::algorithm::estimate_normals(
  37. std::execution::par,
  38. point_views.begin(),
  39. point_views.end(),
  40. normals.begin(),
  41. knn,
  42. pcp::algorithm::default_normal_transform<point_view_type, normal_type>);
  43. pcp::io::write_ply(
  44. std::filesystem::path{argv[2]},
  45. points,
  46. normals,
  47. pcp::io::ply_format_t::binary_little_endian);
  48. return 0;
  49. }

Documentation

Documentation is generated using Doxygen, Sphinx and Breathe.
To generate documentation, you will need to install them.

  1. Then, using CMake, to generate the documentation only, run:

    1. $ cmake -S . -B build -DPCP_BUILD_DOC=ON -DPCP_BUILD_TESTS=OFF -DPCP_BUILD_BENCHMARKS=OFF -DPCP_BUILD_EXAMPLES=OFF
    2. $ cmake --build build --target pcp-sphinx
  2. Browse our readthedocs style documentation by opening ./build/doc/sphinx/index.html in your
    browser of choice.

Credits go to https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/. If you encounter any problems, try reading this long form blog.

Examples

You can find detailed usage examples of pcp here.

Tests

Explore pcp‘s tests here for even more usage examples. The tests use Catch2.