SourceXtractorPlusPlus  0.15
Please provide a description of the project.
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 
26 
29 
32 
33 
34 namespace SourceXtractor {
35 
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 
78  *detection_frame_images.getImageChunk(LayerSubtractedImage, min.m_x, min.m_y, width, height));
80  *detection_frame_images.getImageChunk(LayerThresholdedImage, min.m_x, min.m_y, width, height));
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 
SourceXtractor::PixelBoundaries
The bounding box of all the pixels in the source. Both min and max coordinate are inclusive.
Definition: PixelBoundaries.h:37
SourceXtractor::PixelCoordinate
A pixel coordinate made of two integers m_x and m_y.
Definition: PixelCoordinate.h:37
SourceXtractor::DetectionFrameImages
Definition: DetectionFrameImages.h:30
PixelBoundaries.h
std::shared_ptr
STL class.
SourceXtractor::LayerVarianceMap
@ LayerVarianceMap
Definition: Frame.h:44
VectorImage.h
SourceXtractor
Definition: Aperture.h:30
SourceXtractor::VectorImage::create
static std::shared_ptr< VectorImage< T > > create(Args &&... args)
Definition: VectorImage.h:100
Image.h
SourceXtractor::DetectionFrameGroupStamp
Definition: DetectionFrameGroupStamp.h:33
std::min
T min(T... args)
SourceXtractor::SourceGroupInterface
Defines the interface used to group sources.
Definition: SourceGroupInterface.h:37
SourceXtractor::DetectionFrameGroupStampTask::computeProperties
virtual 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::SourceGroupInterface::cbegin
virtual const_iterator cbegin()=0
SourceXtractor::LayerSubtractedImage
@ LayerSubtractedImage
Definition: Frame.h:38
DetectionFrameGroupStampTask.h
std::max
T max(T... args)
DetectionFrameGroupStamp.h
DetectionFrameImages.h
SourceXtractor::LayerThresholdedImage
@ LayerThresholdedImage
Definition: Frame.h:40