SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
ThresholdedImage.h
Go to the documentation of this file.
1
17/*
18 * ThresholdedImage.h
19 *
20 * Created on: Jan 10, 2018
21 * Author: mschefer
22 */
23
24#ifndef _SEFRAMEWORK_IMAGE_THRESHOLDEDIMAGE_H_
25#define _SEFRAMEWORK_IMAGE_THRESHOLDEDIMAGE_H_
26
27#include <memory>
28
32
33namespace SourceXtractor {
34
40template <typename T>
41class ThresholdedImage : public Image<T> {
42
43protected:
44
50
51public:
52
56 virtual ~ThresholdedImage() = default;
57
62
63 std::string getRepr() const override {
64 return "ThresholdedImage(" + m_image->getRepr() + ")";
65 }
66
67 int getWidth() const override {
68 return m_image->getWidth();
69 }
70
71 int getHeight() const override {
72 return m_image->getHeight();
73 }
74
75 std::shared_ptr<ImageChunk<T>> getChunk(int x, int y, int width, int height) const override{
76 auto img_chunk = m_image->getChunk(x, y, width, height);
77 auto var_chunk = m_variance_map->getChunk(x, y, width, height);
79 for (int iy = 0; iy < height; ++iy) {
80 for (int ix = 0; ix < width; ++ix) {
81 chunk->at(ix, iy) -= sqrt(var_chunk->getValue(ix, iy)) * m_threshold_multiplier;
82 }
83 }
84 return chunk;
85 }
86
87private:
90
91}; /* End of ThresholdedImage class */
92
93} /* namespace SourceXtractor */
94
95#endif /* _SEFRAMEWORK_IMAGE_THRESHOLDEDIMAGE_H_ */
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Interface representing an image.
Definition Image.h:44
Used to subtract a constant value from an Image.
std::shared_ptr< ImageChunk< T > > getChunk(int x, int y, int width, int height) const override
static std::shared_ptr< ThresholdedImage< T > > create(std::shared_ptr< const Image< T > > image, std::shared_ptr< const Image< T > > variance_map, T threshold_multiplier)
std::shared_ptr< const Image< T > > m_variance_map
std::shared_ptr< const Image< T > > m_image
int getHeight() const override
Returns the height of the image in pixels.
int getWidth() const override
Returns the width of the image in pixels.
ThresholdedImage(std::shared_ptr< const Image< T > > image, std::shared_ptr< const Image< T > > variance_map, T threshold_multiplier)
std::string getRepr() const override
Get a string identifying this image in a human readable manner.
virtual ~ThresholdedImage()=default
Destructor.
static std::shared_ptr< UniversalImageChunk< T > > create(Args &&... args)
Definition ImageChunk.h:144
T move(T... args)
T sqrt(T... args)