OTB  9.0.0
Orfeo Toolbox
otbSinclairToReciprocalCovarianceMatrixImageFilter.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 otbSinclairToReciprocalCovarianceMatrixImageFilter_h
22 #define otbSinclairToReciprocalCovarianceMatrixImageFilter_h
23 
24 #include <complex>
25 #include "otbMath.h"
26 #include "vnl/vnl_matrix.h"
27 
28 #include "otbFunctorImageFilter.h"
29 #include "otbPolarimetryTags.h"
30 
31 namespace otb
32 {
33 namespace Functor
34 {
68 template <class TInput1, class TInput2, class TInput3, class TOutput>
70 {
71 public:
73  typedef typename std::complex<double> ComplexType;
74  typedef vnl_matrix<ComplexType> VNLMatrixType;
75  typedef typename TOutput::ValueType OutputValueType;
76  inline void operator()(TOutput& result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svv) const
77  {
78  const ComplexType S_hh = static_cast<ComplexType>(Shh);
79  const ComplexType S_hv = static_cast<ComplexType>(Shv);
80  const ComplexType S_vv = static_cast<ComplexType>(Svv);
82 
83  VNLMatrixType f3l(3, 1, 0.);
84  f3l[0][0] = S_hh;
85  f3l[1][0] = ComplexType(std::sqrt(2.0), 0.0) * S_hv;
86  f3l[2][0] = S_vv;
87 
88  VNLMatrixType res = f3l * f3l.conjugate_transpose();
89 
90  result[0] = static_cast<OutputValueType>(res[0][0]);
91  result[1] = static_cast<OutputValueType>(res[0][1]);
92  result[2] = static_cast<OutputValueType>(res[0][2]);
93  result[3] = static_cast<OutputValueType>(res[1][1]);
94  result[4] = static_cast<OutputValueType>(res[1][2]);
95  result[5] = static_cast<OutputValueType>(res[2][2]);
96  }
97 
98  constexpr size_t OutputSize(...) const
99  {
100  // Size of the matrix
101  return 6;
102  }
103 };
104 
105 } // namespace Functor
106 
123 template <typename TInputImage, typename TOutputImage>
125  FunctorImageFilter<Functor::SinclairToReciprocalCovarianceMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType,
126  typename TInputImage::PixelType, typename TOutputImage::PixelType>,
127  std::tuple<polarimetry_tags::hh, polarimetry_tags::hv_or_vh, polarimetry_tags::vv>>;
128 } // namespace otb
130 
131 #endif
otbFunctorImageFilter.h
otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor::ComplexType
std::complex< double > ComplexType
Definition: otbSinclairToReciprocalCovarianceMatrixImageFilter.h:73
otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor
Construct the reciprocal fully polarimetric covariance matrix with Sinclair matrix information.
Definition: otbSinclairToReciprocalCovarianceMatrixImageFilter.h:69
otbMath.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::SinclairToReciprocalCovarianceMatrixImageFilter
FunctorImageFilter< Functor::SinclairToReciprocalCovarianceMatrixFunctor< typename TInputImage::PixelType, typename TInputImage::PixelType, typename TInputImage::PixelType, typename TOutputImage::PixelType >, std::tuple< polarimetry_tags::hh, polarimetry_tags::hv_or_vh, polarimetry_tags::vv > > SinclairToReciprocalCovarianceMatrixImageFilter
Applies otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor.
Definition: otbSinclairToReciprocalCovarianceMatrixImageFilter.h:127
otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor::VNLMatrixType
vnl_matrix< ComplexType > VNLMatrixType
Definition: otbSinclairToReciprocalCovarianceMatrixImageFilter.h:74
otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor::operator()
void operator()(TOutput &result, const TInput1 &Shh, const TInput2 &Shv, const TInput3 &Svv) const
Definition: otbSinclairToReciprocalCovarianceMatrixImageFilter.h:76
otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor::OutputValueType
TOutput::ValueType OutputValueType
Definition: otbSinclairToReciprocalCovarianceMatrixImageFilter.h:75
otbPolarimetryTags.h
otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor::OutputSize
constexpr vcl_size_t OutputSize(...) const
Definition: otbSinclairToReciprocalCovarianceMatrixImageFilter.h:98