SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
LutzSegmentation.cpp
Go to the documentation of this file.
1
27
33
35
36namespace SourceXtractor {
37
38namespace {
39
40class LutzLabellingListener : public Lutz::LutzListener {
41public:
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(std::move(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
67private:
68 Segmentation::LabellingListener& m_listener;
71};
72
73}
74
75//
76// class LutzSegmentation
77//
78
84
85} // Segmentation namespace
86
Segmentation::LabellingListener & m_listener
int m_window_size
std::shared_ptr< SourceFactory > m_source_factory
void labelImage(Segmentation::LabellingListener &listener, std::shared_ptr< const DetectionImageFrame > frame) override
std::shared_ptr< SourceFactory > m_source_factory
Implements a Segmentation based on the Lutz algorithm.
Definition Lutz.h:37
T move(T... args)