SourceXtractorPlusPlus  0.11
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BackgroundConvolution.cpp
Go to the documentation of this file.
1 
17 /*
18  * BackgroundConvolution.cpp
19  *
20  * Created on: Oct 12, 2016
21  * Author: mschefer
22  */
23 
28 #include <ElementsKernel/Logging.h>
29 
30 namespace SourceXtractor {
31 
33 
36  SeFloat threshold) const {
37 
38  if (m_convolution_filter->getWidth() > 5) {
39  logger.debug() << "Using DFT algorithm for the image convolution";
41  std::make_shared<BgDFTConvolutionImageSource>(image, variance, threshold, m_convolution_filter)
42  );
43  }
44  logger.debug() << "Using direct algorithm for the image convolution";
46  std::make_shared<BgConvolutionImageSource>(image, variance, threshold, m_convolution_filter)
47  );
48 }
49 
51  double total = 0;
52 
53  for (int y = 0; y < m_convolution_filter->getHeight(); y++) {
54  for (int x = 0; x < m_convolution_filter->getWidth(); x++) {
55  total += m_convolution_filter->getValue(x, y);
56  }
57  }
58 
59  for (int y = 0; y < m_convolution_filter->getHeight(); y++) {
60  for (int x = 0; x < m_convolution_filter->getWidth(); x++) {
61  m_convolution_filter->setValue(x, y, m_convolution_filter->getValue(x, y) / total);
62  }
63  }
64 
65 }
66 
67 
68 }
static Elements::Logging logger
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
SeFloat32 SeFloat
Definition: Types.h:32
void debug(const std::string &logMessage)
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
std::shared_ptr< DetectionImage > processImage(std::shared_ptr< DetectionImage > image, std::shared_ptr< DetectionImage > variance, SeFloat threshold) const
std::shared_ptr< VectorImage< SeFloat > > m_convolution_filter
static std::shared_ptr< BufferedImage< T > > create(std::shared_ptr< const ImageSource< T >> source, std::shared_ptr< TileManager > tile_manager=TileManager::getInstance())
static Logging getLogger(const std::string &name="")