SourceXtractorPlusPlus
1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Segmentation
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
24
#include "
SEFramework/Image/BufferedImage.h
"
25
#include "
SEImplementation/Segmentation/BgConvolutionImageSource.h
"
26
#include "
SEImplementation/Segmentation/BgDFTConvolutionImageSource.h
"
27
#include "
SEImplementation/Segmentation/BackgroundConvolution.h
"
28
#include <ElementsKernel/Logging.h>
29
30
namespace
SourceXtractor
{
31
32
Elements::Logging
logger
=
Elements::Logging::getLogger
(
"Segmentation"
);
33
34
std::shared_ptr<DetectionImage>
35
BackgroundConvolution::processImage
(
std::shared_ptr<DetectionImage>
image,
std::shared_ptr<DetectionImage>
variance,
36
SeFloat
threshold)
const
{
37
38
if
(
m_convolution_filter
->getWidth() > 5) {
39
logger
.debug() <<
"Using DFT algorithm for the image convolution"
;
40
return
BufferedImage<DetectionImage::PixelType>::create
(
41
std::make_shared<BgDFTConvolutionImageSource>
(image, variance, threshold,
m_convolution_filter
)
42
);
43
}
44
logger
.debug() <<
"Using direct algorithm for the image convolution"
;
45
return
BufferedImage<DetectionImage::PixelType>::create
(
46
std::make_shared<BgConvolutionImageSource>
(image, variance, threshold,
m_convolution_filter
)
47
);
48
}
49
50
void
BackgroundConvolution::normalize
() {
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
}
BackgroundConvolution.h
BgConvolutionImageSource.h
BgDFTConvolutionImageSource.h
BufferedImage.h
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
SourceXtractor::BackgroundConvolution::processImage
std::shared_ptr< DetectionImage > processImage(std::shared_ptr< DetectionImage > image, std::shared_ptr< DetectionImage > variance, SeFloat threshold) const
Definition
BackgroundConvolution.cpp:35
SourceXtractor::BackgroundConvolution::normalize
void normalize()
Definition
BackgroundConvolution.cpp:50
SourceXtractor::BackgroundConvolution::m_convolution_filter
std::shared_ptr< VectorImage< SeFloat > > m_convolution_filter
Definition
BackgroundConvolution.h:53
SourceXtractor::BufferedImage::create
static std::shared_ptr< BufferedImage< T > > create(std::shared_ptr< const ImageSource > source, std::shared_ptr< TileManager > tile_manager=TileManager::getInstance())
Definition
BufferedImage.cpp:32
std::make_shared
T make_shared(T... args)
Euclid::Configuration::logger
static Elements::Logging logger
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::SeFloat
SeFloat32 SeFloat
Definition
Types.h:32
std::shared_ptr
Generated by
1.14.0