35 int m_width, m_height;
36 std::unique_ptr<std::vector<Node_ptr>> m_nodes;
37 std::unordered_map<int32_t, int32_t> m_node_ids;
39 void hash_node_ids(
void);
66 inline Graph(std::unique_ptr<std::vector<Node_ptr>>& nodes,
int width,
int height)
67 : m_nodes(std::move(nodes))
75 for (
auto& node : *m_nodes) {
80 bool add_edge(int32_t node_id1, int32_t node_id2);
81 bool merge_nodes(
const Node_ptr& node_to_keep,
const Node_ptr& node_to_remove);
83 void clear_unconnected_nodes();
85 inline const std::vector<Node_ptr>& get_nodes()
const {
89 inline const size_t size() {
90 return m_nodes->size();
94 const std::vector<int32_t>& region_labels,
const int32_t width,
const int32_t height
96 void merge_small_area_nodes(
const int32_t min_area,
const int32_t min_thickness = 0);
97 void compute_contours();