SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Plugin
DetectionFrameGroupStamp
DetectionFrameGroupStampTask.cpp
Go to the documentation of this file.
1
17
/*
18
* DetectionFrameGroupStampTask.cpp
19
*
20
* Created on: May 5, 2017
21
* Author: mschefer
22
*/
23
24
#include "
SEFramework/Image/Image.h
"
25
#include "
SEFramework/Image/VectorImage.h
"
26
27
#include "
SEImplementation/Plugin/PixelBoundaries/PixelBoundaries.h
"
28
#include "
SEImplementation/Plugin/DetectionFrameImages/DetectionFrameImages.h
"
29
30
#include "
SEImplementation/Plugin/DetectionFrameGroupStamp/DetectionFrameGroupStamp.h
"
31
#include "
SEImplementation/Plugin/DetectionFrameGroupStamp/DetectionFrameGroupStampTask.h
"
32
33
34
namespace
SourceXtractor
{
35
36
void
DetectionFrameGroupStampTask::computeProperties
(
SourceGroupInterface
&
group
)
const
{
37
// we are obviously assuming the same DetectionFrameImages for all sources
38
auto
detection_frame_images
=
group
.cbegin()->getProperty<
DetectionFrameImages
>();
39
41
int
min_x
=
INT_MAX
;
42
int
min_y
=
INT_MAX
;
43
int
max_x
=
INT_MIN
;
44
int
max_y
=
INT_MIN
;
45
46
for
(
auto
&
source
:
group
) {
47
const
auto
&
boundaries
=
source
.getProperty<
PixelBoundaries
>();
48
const
auto
&
min
=
boundaries
.getMin();
49
const
auto
&
max
=
boundaries
.getMax();
50
51
min_x
=
std::min
(
min_x
,
min
.m_x);
52
min_y
=
std::min
(
min_y
,
min
.m_y);
53
max_x
=
std::max
(
max_x
,
max
.m_x);
54
max_y
=
std::max
(
max_y
,
max
.m_y);
55
}
56
PixelCoordinate
max
(
max_x
,
max_y
);
57
PixelCoordinate
min
(
min_x
,
min_y
);
59
60
61
// FIXME temporary, for now just enlarge the area by a fixed amount of pixels
62
PixelCoordinate
border
= (
max
-
min
) * .8 +
PixelCoordinate
(2, 2);
63
64
min
-=
border
;
65
max
+=
border
;
66
67
// clip to image size
68
min
.m_x =
std::max
(
min
.m_x, 0);
69
min
.m_y =
std::max
(
min
.m_y, 0);
70
max
.m_x =
std::min
(
max
.m_x,
detection_frame_images
.getWidth() - 1);
71
max
.m_y =
std::min
(
max
.m_y,
detection_frame_images
.getHeight() - 1);
72
73
// create the image stamp
74
auto
width =
max
.m_x -
min
.m_x +1;
75
auto
height =
max
.m_y -
min
.m_y + 1;
76
77
std::shared_ptr<DetectionImage>
stamp
=
VectorImage<DetectionImage::PixelType>::create
(
78
*
detection_frame_images
.getImageChunk(
LayerSubtractedImage
,
min
.m_x,
min
.m_y, width, height));
79
std::shared_ptr<DetectionImage>
thresholded_stamp
=
VectorImage<DetectionImage::PixelType>::create
(
80
*
detection_frame_images
.getImageChunk(
LayerThresholdedImage
,
min
.m_x,
min
.m_y, width, height));
81
std::shared_ptr<WeightImage>
variance_stamp
=
VectorImage<WeightImage::PixelType>::create
(
82
*
detection_frame_images
.getImageChunk(
LayerVarianceMap
,
min
.m_x,
min
.m_y, width, height));
83
84
85
group
.setProperty<
DetectionFrameGroupStamp
>(
stamp
,
thresholded_stamp
,
min
,
variance_stamp
);
86
}
87
88
}
// SEImplementation namespace
89
DetectionFrameGroupStampTask.h
DetectionFrameGroupStamp.h
DetectionFrameImages.h
Image.h
PixelBoundaries.h
VectorImage.h
SourceXtractor::DetectionFrameGroupStampTask::computeProperties
void computeProperties(SourceGroupInterface &group) const override
Computes one or more properties for the SourceGroup and/or the Sources it contains.
Definition
DetectionFrameGroupStampTask.cpp:36
SourceXtractor::DetectionFrameGroupStamp
Definition
DetectionFrameGroupStamp.h:33
SourceXtractor::DetectionFrameImages
Definition
DetectionFrameImages.h:30
SourceXtractor::PixelBoundaries
The bounding box of all the pixels in the source. Both min and max coordinate are inclusive.
Definition
PixelBoundaries.h:37
SourceXtractor::SourceGroupInterface
Defines the interface used to group sources.
Definition
SourceGroupInterface.h:38
SourceXtractor::VectorImage::create
static std::shared_ptr< VectorImage< T > > create(Args &&... args)
Definition
VectorImage.h:100
std::function
std::max
T max(T... args)
std::min
T min(T... args)
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::LayerVarianceMap
@ LayerVarianceMap
Definition
Frame.h:45
SourceXtractor::LayerThresholdedImage
@ LayerThresholdedImage
Definition
Frame.h:41
SourceXtractor::LayerSubtractedImage
@ LayerSubtractedImage
Definition
Frame.h:39
SourceXtractor::PixelCoordinate
A pixel coordinate made of two integers m_x and m_y.
Definition
PixelCoordinate.h:37
Generated by
1.10.0