SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Plugin
PixelCentroid
PixelCentroidTask.cpp
Go to the documentation of this file.
1
23
#include "
SEImplementation/Property/PixelCoordinateList.h
"
24
#include "
SEImplementation/Plugin/DetectionFramePixelValues/DetectionFramePixelValues.h
"
25
#include "
SEImplementation/Plugin/PixelCentroid/PixelCentroid.h
"
26
#include "
SEImplementation/Plugin/PixelBoundaries/PixelBoundaries.h
"
27
28
#include "
SEImplementation/Plugin/PixelCentroid/PixelCentroidTask.h
"
29
30
namespace
SourceXtractor
{
31
32
void
PixelCentroidTask::computeProperties
(
SourceInterface
&
source
)
const
{
33
const
auto
&
pixel_values
=
source
.getProperty<
DetectionFramePixelValues
>().getFilteredValues();
34
const
auto
&
min_coord
=
source
.getProperty<
PixelBoundaries
>().getMin();
35
36
double
centroid_x
= 0.0;
37
double
centroid_y
= 0.0;
38
double
total_value
= 0.0;
39
40
auto
i
=
pixel_values
.begin();
41
for
(
auto
pixel_coord
:
source
.getProperty<
PixelCoordinateList
>().getCoordinateList()) {
42
pixel_coord
-=
min_coord
;
43
SeFloat
value = *
i
++;
44
45
total_value
+= value;
46
centroid_x
+=
pixel_coord
.m_x * value;
47
centroid_y
+=
pixel_coord
.m_y * value;
48
}
49
50
centroid_x
/=
total_value
;
51
centroid_y
/=
total_value
;
52
53
source
.setProperty<
PixelCentroid
>(
centroid_x
+
min_coord
.m_x,
centroid_y
+
min_coord
.m_y);
54
}
55
56
}
57
DetectionFramePixelValues.h
PixelBoundaries.h
PixelCentroidTask.h
PixelCentroid.h
PixelCoordinateList.h
SourceXtractor::DetectionFramePixelValues
The values of a Source's pixels in the detection image. They are returned as a vector in the same ord...
Definition
DetectionFramePixelValues.h:39
SourceXtractor::PixelBoundaries
The bounding box of all the pixels in the source. Both min and max coordinate are inclusive.
Definition
PixelBoundaries.h:37
SourceXtractor::PixelCentroidTask::computeProperties
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
Definition
PixelCentroidTask.cpp:32
SourceXtractor::PixelCentroid
The centroid of all the pixels in the source, weighted by their DetectionImage pixel values.
Definition
PixelCentroid.h:37
SourceXtractor::PixelCoordinateList
Definition
PixelCoordinateList.h:33
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition
SourceInterface.h:46
std::function
SourceXtractor
Definition
Aperture.h:30
Generated by
1.10.0