SourceXtractorPlusPlus  0.14
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BFSSegmentation.h
Go to the documentation of this file.
1 
18 #ifndef _SEIMPLEMENTATION_SEGMENTATION_BFSSEGMENTATION_H_
19 #define _SEIMPLEMENTATION_SEGMENTATION_BFSSEGMENTATION_H_
20 
23 
24 namespace SourceXtractor {
25 
26 
32 public:
33 
34  virtual ~BFSSegmentation() = default;
35 
36  BFSSegmentation(std::shared_ptr<SourceFactory> source_factory, int max_delta)
37  : m_source_factory(source_factory), m_max_delta(max_delta) {
38  assert(source_factory != nullptr);
39  }
40 
42 
43 private:
44  class VisitedMap {
45  public:
46  VisitedMap(int width, int height) : m_width(width), m_height(height), m_visited(width * height, false) {}
47 
49  m_visited[pc.m_x + pc.m_y * m_width] = true;
50  }
51 
52  bool wasVisited(PixelCoordinate pc) const {
53  if (pc.m_x >= 0 && pc.m_x < m_width && pc.m_y >= 0 && pc.m_y < m_height) {
54  return m_visited[pc.m_x + pc.m_y * m_width];
55  } else {
56  return true;
57  }
58  }
59 
60  private:
63  };
64 
66  int width, height;
67  };
68 
70  DetectionImage& detection_image, VisitedMap& visited_map) const;
71 
73 
74 
77 };
78 
79 }
80 
81 #endif /* _SEIMPLEMENTATION_SEGMENTATION_BFSSEGMENTATION_H_ */
std::shared_ptr< SourceFactory > m_source_factory
virtual ~BFSSegmentation()=default
Implements a Segmentation based on the BFS algorithm.
void labelSource(PixelCoordinate pc, Segmentation::LabellingListener &listener, DetectionImage &detection_image, VisitedMap &visited_map) const
std::vector< BFSSegmentation::Tile > getTiles(const DetectionImage &image) const
void labelImage(Segmentation::LabellingListener &listener, std::shared_ptr< const DetectionImageFrame > frame) override
BFSSegmentation(std::shared_ptr< SourceFactory > source_factory, int max_delta)
A pixel coordinate made of two integers m_x and m_y.
bool wasVisited(PixelCoordinate pc) const
Interface representing an image.
Definition: Image.h:43