11 #ifndef INCLUDE_SUBSAMPLING_INTERFACE_H_
12 #define INCLUDE_SUBSAMPLING_INTERFACE_H_
15 #include <gudhi/choose_n_farthest_points.h>
16 #include <gudhi/pick_n_random_points.h>
17 #include <gudhi/sparsify_point_set.h>
18 #include <gudhi/Points_off_io.h>
19 #include <CGAL/Epick_d.h>
27 namespace subsampling {
29 using Subsampling_dynamic_kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >;
30 using Subsampling_point_d = Subsampling_dynamic_kernel::Point_d;
33 std::vector<std::vector<double>> subsampling_n_farthest_points(
const std::vector<std::vector<double>>& points,
35 std::vector<std::vector<double>> landmarks;
42 std::vector<std::vector<double>> subsampling_n_farthest_points(
const std::vector<std::vector<double>>& points,
43 unsigned nb_points,
unsigned starting_point) {
44 std::vector<std::vector<double>> landmarks;
46 starting_point, std::back_inserter(landmarks));
51 std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(
const std::string& off_file,
54 std::vector<std::vector<double>> points = off_reader.get_point_cloud();
55 return subsampling_n_farthest_points(points, nb_points);
58 std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(
const std::string& off_file,
59 unsigned nb_points,
unsigned starting_point) {
61 std::vector<std::vector<double>> points = off_reader.get_point_cloud();
62 return subsampling_n_farthest_points(points, nb_points, starting_point);
66 std::vector<std::vector<double>> subsampling_n_random_points(
const std::vector<std::vector<double>>& points,
68 std::vector<std::vector<double>> landmarks;
74 std::vector<std::vector<double>> subsampling_n_random_points_from_file(
const std::string& off_file,
77 std::vector<std::vector<double>> points = off_reader.get_point_cloud();
78 return subsampling_n_random_points(points, nb_points);
82 std::vector<std::vector<double>> subsampling_sparsify_points(
const std::vector<std::vector<double>>& points,
83 double min_squared_dist) {
84 std::vector<Subsampling_point_d> input, output;
85 for (
auto point : points)
86 input.push_back(Subsampling_point_d(point.size(), point.begin(), point.end()));
87 Subsampling_dynamic_kernel k;
90 std::vector<std::vector<double>> landmarks;
91 for (
auto point : output)
92 landmarks.push_back(std::vector<double>(point.cartesian_begin(), point.cartesian_end()));
96 std::vector<std::vector<double>> subsampling_sparsify_points_from_file(
const std::string& off_file,
97 double min_squared_dist) {
99 std::vector<std::vector<double>> points = off_reader.get_point_cloud();
100 return subsampling_sparsify_points(points, min_squared_dist);
Compute the Euclidean distance between two Points given by a range of coordinates....
Definition: distance_functions.h:34
OFF file reader implementation in order to read points from an OFF file.
Definition: Points_off_io.h:122
Global distance functions.
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:55
void choose_n_farthest_points(Distance dist, 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:69
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:42
@ random_starting_point
Definition: choose_n_farthest_points.h:34