OTB
9.0.0
Orfeo Toolbox
Modules
Core
ImageManipulation
include
otbMeanFunctor.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3
*
4
* This file is part of Orfeo Toolbox
5
*
6
* https://www.orfeo-toolbox.org/
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*/
20
21
#ifndef otbMeanFunctor_h
22
#define otbMeanFunctor_h
23
24
namespace
otb
25
{
26
namespace
Functor
27
{
33
template
<
class
TInput,
class
TOutputValue>
34
class
MeanFunctor
35
{
36
public
:
37
typedef
MeanFunctor<TInput, TOutputValue>
MeanFunctorType
;
38
39
MeanFunctor
()
40
{
41
}
42
43
~MeanFunctor
()
44
{
45
}
46
inline
TOutputValue
operator()
(
const
TInput& inPix)
47
{
48
double
value(0.);
49
if
(inPix.Size() <= 0)
50
return
static_cast<
TOutputValue
>
(0.);
51
for
(
unsigned
int
i = 0; i < inPix.Size(); ++i)
52
{
53
value +=
static_cast<
double
>
(inPix[i]);
54
}
55
return
static_cast<
TOutputValue
>
(value /
static_cast<
double
>
(inPix.Size()));
56
}
57
};
58
59
}
// end namespace functor
60
}
// end namespace otb
61
62
#endif
otb::Functor::MeanFunctor::MeanFunctorType
MeanFunctor< TInput, TOutputValue > MeanFunctorType
Definition:
otbMeanFunctor.h:37
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition:
otbJoinContainer.h:32
otb::Functor::MeanFunctor::~MeanFunctor
~MeanFunctor()
Definition:
otbMeanFunctor.h:43
otb::Functor::MeanFunctor
This functor generate the mean value of a component pixels.
Definition:
otbMeanFunctor.h:34
otb::Functor::MeanFunctor::operator()
TOutputValue operator()(const TInput &inPix)
Definition:
otbMeanFunctor.h:46
otb::Functor::MeanFunctor::MeanFunctor
MeanFunctor()
Definition:
otbMeanFunctor.h:39
Generated at Wed Feb 28 2024 15:23:02 for
OTB
with
1.8.17