SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
PixelCentroidTask.cpp
Go to the documentation of this file.
1
27
29
30namespace SourceXtractor {
31
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()) {
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
52
54}
55
56}
57
The values of a Source's pixels in the detection image. They are returned as a vector in the same ord...
The bounding box of all the pixels in the source. Both min and max coordinate are inclusive.
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
The centroid of all the pixels in the source, weighted by their DetectionImage pixel values.
The SourceInterface is an abstract "source" that has properties attached to it.