23 #ifndef INCLUDE_SUBSAMPLING_INTERFACE_H_ 24 #define INCLUDE_SUBSAMPLING_INTERFACE_H_ 26 #include <gudhi/choose_n_farthest_points.h> 27 #include <gudhi/pick_n_random_points.h> 28 #include <gudhi/sparsify_point_set.h> 29 #include <gudhi/Points_off_io.h> 30 #include <CGAL/Epick_d.h> 38 namespace subsampling {
40 using Subsampling_dynamic_kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >;
41 using Subsampling_point_d = Subsampling_dynamic_kernel::Point_d;
42 using Subsampling_ft = Subsampling_dynamic_kernel::FT;
45 std::vector<std::vector<double>> subsampling_n_farthest_points(
const std::vector<std::vector<double>>& points,
47 std::vector<std::vector<double>> landmarks;
48 Subsampling_dynamic_kernel k;
54 std::vector<std::vector<double>> subsampling_n_farthest_points(
const std::vector<std::vector<double>>& points,
55 unsigned nb_points,
unsigned starting_point) {
56 std::vector<std::vector<double>> landmarks;
57 Subsampling_dynamic_kernel k;
63 std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(
const std::string& off_file,
66 std::vector<std::vector<double>> points = off_reader.get_point_cloud();
67 return subsampling_n_farthest_points(points, nb_points);
70 std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(
const std::string& off_file,
71 unsigned nb_points,
unsigned starting_point) {
73 std::vector<std::vector<double>> points = off_reader.get_point_cloud();
74 return subsampling_n_farthest_points(points, nb_points, starting_point);
78 std::vector<std::vector<double>> subsampling_n_random_points(
const std::vector<std::vector<double>>& points,
80 std::vector<std::vector<double>> landmarks;
86 std::vector<std::vector<double>> subsampling_n_random_points_from_file(
const std::string& off_file,
89 std::vector<std::vector<double>> points = off_reader.get_point_cloud();
90 return subsampling_n_random_points(points, nb_points);
94 std::vector<std::vector<double>> subsampling_sparsify_points(
const std::vector<std::vector<double>>& points,
95 double min_squared_dist) {
96 std::vector<Subsampling_point_d> input, output;
97 for (
auto point : points)
98 input.push_back(Subsampling_point_d(point.size(), point.begin(), point.end()));
99 Subsampling_dynamic_kernel k;
102 std::vector<std::vector<double>> landmarks;
103 for (
auto point : output)
104 landmarks.push_back(std::vector<double>(point.cartesian_begin(), point.cartesian_end()));
108 std::vector<std::vector<double>> subsampling_sparsify_points_from_file(
const std::string& off_file,
109 double min_squared_dist) {
111 std::vector<std::vector<double>> points = off_reader.get_point_cloud();
112 return subsampling_sparsify_points(points, min_squared_dist);
119 #endif // INCLUDE_SUBSAMPLING_INTERFACE_H_ OFF file reader implementation in order to read points from an OFF file.
Definition: Points_off_io.h:134
void choose_n_farthest_points(Kernel const &k, Point_range const &input_pts, std::size_t final_size, std::size_t starting_point, PointOutputIterator output_it, DistanceOutputIterator dist_it={})
Subsample by a greedy strategy of iteratively adding the farthest point from the current chosen point...
Definition: choose_n_farthest_points.h:78
void sparsify_point_set(const Kernel &k, Point_range const &input_pts, typename Kernel::FT min_squared_dist, OutputIterator output_it)
Outputs a subset of the input points so that the squared distance between any two points is greater t...
Definition: sparsify_point_set.h:60
void pick_n_random_points(Point_container const &points, std::size_t final_size, OutputIterator output_it)
Subsample a point set by picking random vertices.
Definition: pick_n_random_points.h:52
Definition: SimplicialComplexForAlpha.h:26
Definition: choose_n_farthest_points.h:46