OTB  9.0.0
Orfeo Toolbox
otbReciprocalHuynenDecompImageFilter.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 otbReciprocalHuynenDecompImageFilter_h
22 #define otbReciprocalHuynenDecompImageFilter_h
23 
24 #include "otbFunctorImageFilter.h"
25 
26 namespace otb
27 {
28 
29 namespace Functor
30 {
31 
40 template <class TInput, class TOutput>
42 {
43 public:
44  typedef typename TOutput::ValueType OutputValueType;
45 
46  inline void operator()(TOutput& result, const TInput& Covariance) const
47  {
48  OutputValueType A0 = static_cast<OutputValueType>(Covariance[0].real() / 2.0);
49  OutputValueType B0 = static_cast<OutputValueType>((Covariance[3] + Covariance[5]).real() / 2.0);
50  OutputValueType B = static_cast<OutputValueType>(Covariance[3].real() - B0);
51  OutputValueType C = static_cast<OutputValueType>(Covariance[1].real());
52  OutputValueType D = static_cast<OutputValueType>(-Covariance[1].imag());
53  OutputValueType E = static_cast<OutputValueType>(Covariance[4].real());
54  OutputValueType F = static_cast<OutputValueType>(Covariance[4].imag());
55  OutputValueType G = static_cast<OutputValueType>(Covariance[2].imag());
56  OutputValueType H = static_cast<OutputValueType>(Covariance[2].real());
57 
58  result[0] = A0;
59  result[1] = B0;
60  result[2] = B;
61  result[3] = C;
62  result[4] = D;
63  result[5] = E;
64  result[6] = F;
65  result[7] = G;
66  result[8] = H;
67  }
68 
69  constexpr size_t OutputSize(...) const
70  {
71  // Size of the result
72  return 9;
73  }
74 
75 private:
76  static constexpr double m_Epsilon = 1e-6;
77 };
78 } // namespace Functor
79 
92 template <typename TInputImage, typename TOutputImage>
95 } // end namespace otb
96 
97 #endif
otb::Functor::ReciprocalHuynenDecompFunctor::operator()
void operator()(TOutput &result, const TInput &Covariance) const
Definition: otbReciprocalHuynenDecompImageFilter.h:46
otbFunctorImageFilter.h
otb::FunctorImageFilter
A generic functor filter templated by its functor.
Definition: otbFunctorImageFilter.h:322
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Functor::ReciprocalHuynenDecompFunctor::OutputValueType
TOutput::ValueType OutputValueType
Definition: otbReciprocalHuynenDecompImageFilter.h:44
otb::Functor::ReciprocalHuynenDecompFunctor
Evaluate the Huynen decomposition from the reciprocal Sinclair matrix image.
Definition: otbReciprocalHuynenDecompImageFilter.h:41
otb::Functor::ReciprocalHuynenDecompFunctor::OutputSize
constexpr vcl_size_t OutputSize(...) const
Definition: otbReciprocalHuynenDecompImageFilter.h:69
otb::Functor::ReciprocalHuynenDecompFunctor::m_Epsilon
static constexpr double m_Epsilon
Definition: otbReciprocalHuynenDecompImageFilter.h:76