gtsam_points
Loading...
Searching...
No Matches
min_cut.hpp
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2025 Kenji Koide (k.koide@aist.go.jp)
3
4#pragma once
5
6#include <deque>
7#include <vector>
8#include <cstdint>
9#include <Eigen/Core>
10#include <gtsam_points/types/point_cloud.hpp>
11#include <gtsam_points/ann/nearest_neighbor_search.hpp>
12
13namespace gtsam_points {
14
17 double distance_sigma = 0.25;
18 double angle_sigma = 10.0 * M_PI / 180.0;
19
22 double foreground_weight = 0.2;
23 double background_weight = 0.2;
24
25 int k_neighbors = 20;
26 int num_threads = 1;
27};
28
31 MinCutResult() : source_index(-1), sink_index(-1), max_flow(0.0) {}
32
33 size_t source_index;
34 size_t sink_index;
35 double max_flow;
36 std::vector<size_t> cluster_indices;
37};
38
45template <typename PointCloud>
46MinCutResult min_cut_(const PointCloud& points, const NearestNeighborSearch& search, size_t source_pt_index, const MinCutParams& params);
47
54template <typename PointCloud>
55MinCutResult min_cut_(const PointCloud& points, const NearestNeighborSearch& search, const Eigen::Vector4d& source_pt, const MinCutParams& params);
56
57MinCutResult min_cut(const PointCloud& points, const NearestNeighborSearch& search, size_t source_pt_index, const MinCutParams& params);
58
59MinCutResult min_cut(const PointCloud& points, const NearestNeighborSearch& search, const Eigen::Vector4d& source_pt, const MinCutParams& params);
60
61} // namespace gtsam_points
Parameters for min-cut segmentation.
Definition min_cut.hpp:16
double foreground_weight
Weight for the foreground points.
Definition min_cut.hpp:22
double distance_sigma
Distance sigma.
Definition min_cut.hpp:17
double background_mask_radius
All points out of this radius from the source point are considered as background.
Definition min_cut.hpp:21
double foreground_mask_radius
All points within this radius from the source point are considered as foreground.
Definition min_cut.hpp:20
double angle_sigma
Angle sigma.
Definition min_cut.hpp:18
int k_neighbors
Number of neighbors.
Definition min_cut.hpp:25
double background_weight
Weight for the background points.
Definition min_cut.hpp:23
int num_threads
Number of threads.
Definition min_cut.hpp:26
Result of min-cut segmentation.
Definition min_cut.hpp:30
double max_flow
Maximum flow.
Definition min_cut.hpp:35
size_t source_index
Source point index.
Definition min_cut.hpp:33
std::vector< size_t > cluster_indices
Indices of foreground points.
Definition min_cut.hpp:36
size_t sink_index
Sink point index.
Definition min_cut.hpp:34
Nearest neighbor search interface.
Definition nearest_neighbor_search.hpp:16
Standard point cloud class that holds only pointers to point attributes.
Definition point_cloud.hpp:19