SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
BFSSegmentation.h
Go to the documentation of this file.
1
18#ifndef _SEIMPLEMENTATION_SEGMENTATION_BFSSEGMENTATION_H_
19#define _SEIMPLEMENTATION_SEGMENTATION_BFSSEGMENTATION_H_
20
23
24namespace SourceXtractor {
25
26
32public:
33
34 virtual ~BFSSegmentation() = default;
35
37 : m_source_factory(source_factory), m_max_delta(max_delta) {
38 assert(source_factory != nullptr);
39 }
40
42
43private:
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
67 };
68
71
73
74
77};
78
79}
80
81#endif /* _SEIMPLEMENTATION_SEGMENTATION_BFSSEGMENTATION_H_ */
bool wasVisited(PixelCoordinate pc) const
Implements a Segmentation based on the BFS algorithm.
std::vector< BFSSegmentation::Tile > getTiles(const DetectionImage &image) const
void labelSource(PixelCoordinate pc, Segmentation::LabellingListener &listener, DetectionImage &detection_image, VisitedMap &visited_map) const
BFSSegmentation(std::shared_ptr< SourceFactory > source_factory, int max_delta)
void labelImage(Segmentation::LabellingListener &listener, std::shared_ptr< const DetectionImageFrame > frame) override
virtual ~BFSSegmentation()=default
std::shared_ptr< SourceFactory > m_source_factory
A pixel coordinate made of two integers m_x and m_y.