SourceXtractorPlusPlus
0.11
Please provide a description of the project.
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
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
std::shared_ptr
SourceXtractor::logger
static Elements::Logging logger
Definition:
PluginManager.cpp:45
Logging.h
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition:
MoffatModelFittingTask.cpp:93
SourceXtractor::SeFloat
SeFloat32 SeFloat
Definition:
Types.h:32
Elements::Logging::debug
void debug(const std::string &logMessage)
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition:
MoffatModelFittingTask.cpp:93
BgConvolutionImageSource.h
BufferedImage.h
BgDFTConvolutionImageSource.h
Elements::Logging
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::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< T >> source, std::shared_ptr< TileManager > tile_manager=TileManager::getInstance())
Definition:
BufferedImage.cpp:34
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
SourceXtractor::BackgroundConvolution::normalize
void normalize()
Definition:
BackgroundConvolution.cpp:50
Generated by
1.8.5