SourceXtractorPlusPlus  0.15
Please provide a description of the project.
LutzSegmentation.cpp
Go to the documentation of this file.
1 
27 
33 
35 
36 namespace SourceXtractor {
37 
38 namespace {
39 
40 class LutzLabellingListener : public Lutz::LutzListener {
41 public:
42  LutzLabellingListener(Segmentation::LabellingListener& listener, std::shared_ptr<SourceFactory> source_factory,
43  int window_size) :
44  m_listener(listener),
45  m_source_factory(source_factory),
46  m_window_size(window_size) {}
47 
48  virtual ~LutzLabellingListener() = default;
49 
50  void publishGroup(Lutz::PixelGroup& pixel_group) override {
51  auto source = m_source_factory->createSource();
52  source->setProperty<PixelCoordinateList>(pixel_group.pixel_list);
53  source->setProperty<SourceId>();
54  m_listener.publishSource(source);
55  }
56 
57  void notifyProgress(int line, int total) override {
58  m_listener.notifyProgress(line, total);
59 
60  if (m_window_size > 0 && line > m_window_size) {
61  m_listener.requestProcessing(
62  ProcessSourcesEvent(std::make_shared<LineSelectionCriteria>(line - m_window_size))
63  );
64  }
65  }
66 
67 private:
68  Segmentation::LabellingListener& m_listener;
71 };
72 
73 }
74 
75 //
76 // class LutzSegmentation
77 //
78 
80  Lutz lutz;
81  LutzLabellingListener lutz_listener(listener, m_source_factory, m_window_size);
82  lutz.labelImage(lutz_listener, *frame->getThresholdedImage());
83 }
84 
85 } // Segmentation namespace
86 
PixelCoordinateList.h
SourceXtractor::Lutz::labelImage
void labelImage(LutzListener &listener, const DetectionImage &image, PixelCoordinate offset=PixelCoordinate(0, 0))
Definition: Lutz.cpp:59
LineSelectionCriteria.h
std::shared_ptr< SourceFactory >
m_window_size
int m_window_size
Definition: LutzSegmentation.cpp:70
SourceId.h
m_listener
Segmentation::LabellingListener & m_listener
Definition: LutzSegmentation.cpp:68
LutzSegmentation.h
SourceXtractor::LutzSegmentation::m_source_factory
std::shared_ptr< SourceFactory > m_source_factory
Definition: LutzSegmentation.h:56
SourceXtractor
Definition: Aperture.h:30
SourceXtractor::LutzSegmentation::labelImage
virtual void labelImage(Segmentation::LabellingListener &listener, std::shared_ptr< const DetectionImageFrame > frame) override
Definition: LutzSegmentation.cpp:79
Image.h
ProcessedImage.h
Lutz.h
SourceWithOnDemandProperties.h
SourceXtractor::Segmentation::LabellingListener
Definition: Segmentation.h:94
MultithreadedMeasurement.h
SourceXtractor::LutzSegmentation::m_window_size
int m_window_size
Definition: LutzSegmentation.h:57
m_source_factory
std::shared_ptr< SourceFactory > m_source_factory
Definition: LutzSegmentation.cpp:69
SourceXtractor::Lutz
Implements a Segmentation based on the Lutz algorithm.
Definition: Lutz.h:37