SourceXtractorPlusPlus
0.11
Please provide a description of the project.
SEImplementation
src
lib
Segmentation
LutzSegmentation.cpp
Go to the documentation of this file.
1
24
#include "
SEFramework/Image/Image.h
"
25
#include "
SEFramework/Image/ProcessedImage.h
"
26
#include "
SEFramework/Source/SourceWithOnDemandProperties.h
"
27
28
#include "
SEImplementation/Measurement/MultithreadedMeasurement.h
"
29
#include "
SEImplementation/Property/PixelCoordinateList.h
"
30
#include "
SEImplementation/Property/SourceId.h
"
31
#include "
SEImplementation/Grouping/LineSelectionCriteria.h
"
32
#include "
SEImplementation/Segmentation/Lutz.h
"
33
34
#include "
SEImplementation/Segmentation/LutzSegmentation.h
"
35
36
namespace
SourceXtractor
{
37
38
class
LutzLabellingListener
:
public
Lutz::LutzListener
{
39
public
:
40
LutzLabellingListener
(
Segmentation::LabellingListener
& listener,
std::shared_ptr<SourceFactory>
source_factory,
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
) {
59
m_listener
.
requestProcessing
(
ProcessSourcesEvent
(
LineSelectionCriteria
(line -
m_window_size
)));
60
}
61
}
62
63
private
:
64
Segmentation::LabellingListener
&
m_listener
;
65
std::shared_ptr<SourceFactory>
m_source_factory
;
66
int
m_window_size
;
67
};
68
69
//
70
// class LutzSegmentation
71
//
72
73
void
LutzSegmentation::labelImage
(
Segmentation::LabellingListener
& listener,
std::shared_ptr<const DetectionImageFrame>
frame) {
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
PixelCoordinateList.h
std::shared_ptr< SourceFactory >
SourceXtractor::LutzLabellingListener::m_window_size
int m_window_size
Definition:
LutzSegmentation.cpp:66
SourceXtractor::Lutz::PixelGroup::pixel_list
std::vector< PixelCoordinate > pixel_list
Definition:
Lutz.h:44
SourceId.h
SourceXtractor::Lutz::PixelGroup
Definition:
Lutz.h:39
SourceXtractor::LutzLabellingListener::notifyProgress
void notifyProgress(int line, int total) override
Definition:
LutzSegmentation.cpp:55
SourceXtractor::LineSelectionCriteria
Definition:
LineSelectionCriteria.h:32
SourceXtractor::PixelCoordinateList
Definition:
PixelCoordinateList.h:31
SourceXtractor::Segmentation::LabellingListener
Definition:
Segmentation.h:94
SourceXtractor::ProcessSourcesEvent
Event received by SourceGrouping to request the processing of some of the Sources stored...
Definition:
SourceGrouping.h:71
Lutz.h
SourceWithOnDemandProperties.h
SourceXtractor::LutzSegmentation::m_window_size
int m_window_size
Definition:
LutzSegmentation.h:58
SourceXtractor::Lutz::LutzListener
Definition:
Lutz.h:53
SourceXtractor::Segmentation::LabellingListener::publishSource
void publishSource(std::shared_ptr< SourceInterface > source) const
Definition:
Segmentation.h:100
SourceXtractor::LutzLabellingListener
Definition:
LutzSegmentation.cpp:38
SourceXtractor::Lutz
Implements a Segmentation based on the Lutz algorithm.
Definition:
Lutz.h:37
SourceXtractor::Segmentation::LabellingListener::requestProcessing
void requestProcessing(const ProcessSourcesEvent &event)
Definition:
Segmentation.h:109
SourceXtractor::Lutz::labelImage
void labelImage(LutzListener &listener, const DetectionImage &image, PixelCoordinate offset=PixelCoordinate(0, 0))
Definition:
Lutz.cpp:59
SourceXtractor::LutzLabellingListener::m_source_factory
std::shared_ptr< SourceFactory > m_source_factory
Definition:
LutzSegmentation.cpp:65
Image.h
ProcessedImage.h
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::LutzLabellingListener::publishGroup
void publishGroup(Lutz::PixelGroup &pixel_group) override
Definition:
LutzSegmentation.cpp:48
SourceXtractor::LutzSegmentation::m_source_factory
std::shared_ptr< SourceFactory > m_source_factory
Definition:
LutzSegmentation.h:57
LineSelectionCriteria.h
SourceXtractor::Segmentation::LabellingListener::notifyProgress
void notifyProgress(int position, int total)
Definition:
Segmentation.h:105
SourceXtractor::LutzLabellingListener::m_listener
Segmentation::LabellingListener & m_listener
Definition:
LutzSegmentation.cpp:64
LutzSegmentation.h
SourceXtractor::SourceId
Definition:
SourceId.h:31
SourceXtractor::LutzLabellingListener::LutzLabellingListener
LutzLabellingListener(Segmentation::LabellingListener &listener, std::shared_ptr< SourceFactory > source_factory, int window_size)
Definition:
LutzSegmentation.cpp:40
MultithreadedMeasurement.h
SourceXtractor::LutzSegmentation::labelImage
virtual void labelImage(Segmentation::LabellingListener &listener, std::shared_ptr< const DetectionImageFrame > frame) override
Definition:
LutzSegmentation.cpp:73
SourceXtractor::LutzLabellingListener::~LutzLabellingListener
virtual ~LutzLabellingListener()=default
Generated by
1.8.14