SourceXtractorPlusPlus  0.10
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LutzSegmentation.cpp
Go to the documentation of this file.
1 
27 
33 
35 
36 namespace SourceXtractor {
37 
39 public:
41  int window_size) :
42  m_listener(listener),
43  m_source_factory(source_factory),
44  m_window_size(window_size) {}
45 
46  virtual ~LutzLabellingListener() = default;
47 
48  void publishGroup(Lutz::PixelGroup& pixel_group) override {
49  auto source = m_source_factory->createSource();
50  source->setProperty<PixelCoordinateList>(pixel_group.pixel_list);
51  source->setProperty<SourceId>();
52  m_listener.publishSource(source);
53  }
54 
55  void notifyProgress(int line, int total) override {
56  m_listener.notifyProgress(line, total);
57 
58  if (m_window_size > 0 && line > m_window_size) {
60  }
61  }
62 
63 private:
67 };
68 
69 //
70 // class LutzSegmentation
71 //
72 
74  Lutz lutz;
75  LutzLabellingListener lutz_listener(listener, m_source_factory, m_window_size);
76  lutz.labelImage(lutz_listener, *frame->getThresholdedImage());
77 }
78 
79 } // Segmentation namespace
80 
std::vector< PixelCoordinate > pixel_list
Definition: Lutz.h:44
void notifyProgress(int line, int total) override
Event received by SourceGrouping to request the processing of some of the Sources stored...
Implements a Segmentation based on the Lutz algorithm.
Definition: Lutz.h:37
void requestProcessing(const ProcessSourcesEvent &event)
Definition: Segmentation.h:109
void labelImage(LutzListener &listener, const DetectionImage &image, PixelCoordinate offset=PixelCoordinate(0, 0))
Definition: Lutz.cpp:59
std::shared_ptr< SourceFactory > m_source_factory
void publishGroup(Lutz::PixelGroup &pixel_group) override
std::shared_ptr< SourceFactory > m_source_factory
void notifyProgress(int position, int total)
Definition: Segmentation.h:105
Segmentation::LabellingListener & m_listener
LutzLabellingListener(Segmentation::LabellingListener &listener, std::shared_ptr< SourceFactory > source_factory, int window_size)
virtual void labelImage(Segmentation::LabellingListener &listener, std::shared_ptr< const DetectionImageFrame > frame) override
void publishSource(std::shared_ptr< SourceInterface > source) const
Definition: Segmentation.h:100