OTB  9.0.0
Orfeo Toolbox
otbSinclairToCircularCovarianceMatrixImageFilter.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 otbSinclairToCircularCovarianceMatrixImageFilter_h
22 #define otbSinclairToCircularCovarianceMatrixImageFilter_h
23 
24 #include <complex>
25 
27 #include "otbFunctorImageFilter.h"
28 #include "otbPolarimetryTags.h"
29 
30 namespace otb
31 {
32 namespace Functor
33 {
77 template <class TInput1, class TInput2, class TInput3, class TInput4, class TOutput>
79 {
80 public:
82  typedef double RealType;
83  typedef std::complex<RealType> ComplexType;
84  typedef typename TOutput::ValueType OutputValueType;
86  inline void operator()(TOutput& result, const TInput1& Shh, const TInput2& Shv, const TInput3& Svh, const TInput4& Svv) const
87  {
88  const ComplexType S_hh = static_cast<ComplexType>(Shh);
89  const ComplexType S_hv = static_cast<ComplexType>(Shv);
90  const ComplexType S_vh = static_cast<ComplexType>(Svh);
91  const ComplexType S_vv = static_cast<ComplexType>(Svv);
93 
94  const ComplexType jS_hv = S_hv * ComplexType(0., 1.);
95  const ComplexType jS_vh = S_vh * ComplexType(0., 1.);
96  const ComplexType jS_hh = S_hh * ComplexType(0., 1.);
97  const ComplexType jS_vv = S_vv * ComplexType(0., 1.);
98 
99  const ComplexType coef(0.5);
100 
101  const ComplexType Sll = coef * (S_hh + jS_hv + jS_vh - S_vv);
102  const ComplexType Slr = coef * (jS_hh + S_hv - S_vh + jS_vv);
103  const ComplexType Srl = coef * (jS_hh - S_hv + S_vh + jS_vv);
104  const ComplexType Srr = coef * (-S_hh + jS_hv + jS_vh + S_vv);
105 
107  funct(result, Sll, Slr, Srl, Srr);
108  }
109 
110  constexpr size_t OutputSize(...) const
111  {
112  // Size of circular covariance matrix
113  return 10;
114  }
115 
118  {
119  }
120 
123  {
124  }
125 };
126 
127 } // namespace Functor
128 
146 template <typename TInputImage, typename TOutputImage>
147 using SinclairToCircularCovarianceMatrixImageFilter = FunctorImageFilter<
148  Functor::SinclairToCircularCovarianceMatrixFunctor<typename TInputImage::PixelType, typename TInputImage::PixelType, typename TInputImage::PixelType,
149  typename TInputImage::PixelType, typename TOutputImage::PixelType>,
150  std::tuple<polarimetry_tags::hh, polarimetry_tags::hv, polarimetry_tags::vh, polarimetry_tags::vv>>;
151 } // namespace otb
153 
154 #endif
otb::Functor::SinclairToCircularCovarianceMatrixFunctor::~SinclairToCircularCovarianceMatrixFunctor
virtual ~SinclairToCircularCovarianceMatrixFunctor()
Definition: otbSinclairToCircularCovarianceMatrixImageFilter.h:122
otbFunctorImageFilter.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Functor::SinclairToCircularCovarianceMatrixFunctor::operator()
void operator()(TOutput &result, const TInput1 &Shh, const TInput2 &Shv, const TInput3 &Svh, const TInput4 &Svv) const
Definition: otbSinclairToCircularCovarianceMatrixImageFilter.h:86
otb::Functor::SinclairToCircularCovarianceMatrixFunctor::SinclairToCircularCovarianceMatrixFunctor
SinclairToCircularCovarianceMatrixFunctor()
Definition: otbSinclairToCircularCovarianceMatrixImageFilter.h:117
otb::Functor::SinclairToCircularCovarianceMatrixFunctor::RealType
double RealType
Definition: otbSinclairToCircularCovarianceMatrixImageFilter.h:82
otb::Functor::SinclairToCircularCovarianceMatrixFunctor
Construct the fully polarimetric circular covariance matrix with Sinclair matrix information.
Definition: otbSinclairToCircularCovarianceMatrixImageFilter.h:78
otb::Functor::SinclairToCircularCovarianceMatrixFunctor::OutputSize
constexpr vcl_size_t OutputSize(...) const
Definition: otbSinclairToCircularCovarianceMatrixImageFilter.h:110
otb::Functor::SinclairToCircularCovarianceMatrixFunctor::SinclairToCovarianceFunctorType
SinclairToCovarianceMatrixFunctor< ComplexType, ComplexType, ComplexType, ComplexType, TOutput > SinclairToCovarianceFunctorType
Definition: otbSinclairToCircularCovarianceMatrixImageFilter.h:85
otb::Functor::SinclairToCovarianceMatrixFunctor
Construct the fully polarimetric covariance matrix with Sinclair matrix information.
Definition: otbSinclairToCovarianceMatrixImageFilter.h:68
otbSinclairToCovarianceMatrixImageFilter.h
otb::SinclairToCircularCovarianceMatrixImageFilter
FunctorImageFilter< Functor::SinclairToCircularCovarianceMatrixFunctor< typename TInputImage::PixelType, typename TInputImage::PixelType, typename TInputImage::PixelType, typename TInputImage::PixelType, typename TOutputImage::PixelType >, std::tuple< polarimetry_tags::hh, polarimetry_tags::hv, polarimetry_tags::vh, polarimetry_tags::vv > > SinclairToCircularCovarianceMatrixImageFilter
Applies otb::Functor::SinclairToCircularCovarianceMatrixFunctor.
Definition: otbSinclairToCircularCovarianceMatrixImageFilter.h:150
otbPolarimetryTags.h
otb::Functor::SinclairToCircularCovarianceMatrixFunctor::ComplexType
std::complex< RealType > ComplexType
Definition: otbSinclairToCircularCovarianceMatrixImageFilter.h:83
otb::Functor::SinclairToCircularCovarianceMatrixFunctor::OutputValueType
TOutput::ValueType OutputValueType
Definition: otbSinclairToCircularCovarianceMatrixImageFilter.h:84