OTB  9.0.0
Orfeo Toolbox
otbProjectiveProjectionImageFilter.hxx
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 otbProjectiveProjectionImageFilter_hxx
22 #define otbProjectiveProjectionImageFilter_hxx
23 
25 
26 namespace otb
27 {
28 namespace Functor
29 {
30 
31 template <class TInput, class TOutput, class TPrecision>
33 {
34  return m_OutputSize;
35 }
36 
37 template <class TInput, class TOutput, class TPrecision>
40 {
41  return m_ProjectionDirection;
42 }
43 
44 template <class TInput, class TOutput, class TPrecision>
46 {
47  m_ProjectionDirection = p;
48  m_OutputSize = m_ProjectionDirection.Size();
49 }
50 
51 template <class TInput, class TOutput, class TPrecision>
54 {
55  PrecisionType dotProduct = 0;
56  for (unsigned int i = 0; i < in.Size(); ++i)
57  {
58  dotProduct += in[i] * m_ProjectionDirection[i];
59  }
60 
61  OutputType projected(in.Size());
62  for (unsigned int j = 0; j < in.Size(); ++j)
63  {
64  projected[j] = in[j] / dotProduct;
65  }
66 
67  return projected;
68 }
69 
70 } // end namespace Functor
71 } // end namespace otb
72 
73 #endif
otb::Functor::ProjectiveProjectionFunctor::PrecisionType
TPrecision PrecisionType
Definition: otbProjectiveProjectionImageFilter.h:47
otb::Functor::ProjectiveProjectionFunctor::SetProjectionDirection
void SetProjectionDirection(const InputType &p)
Definition: otbProjectiveProjectionImageFilter.hxx:45
otb::Functor::ProjectiveProjectionFunctor::operator()
OutputType operator()(const InputType &in)
Definition: otbProjectiveProjectionImageFilter.hxx:53
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbProjectiveProjectionImageFilter.h
otb::Functor::ProjectiveProjectionFunctor::OutputType
TOutput OutputType
Definition: otbProjectiveProjectionImageFilter.h:46
otb::Functor::ProjectiveProjectionFunctor::GetProjectionDirection
const InputType & GetProjectionDirection()
Definition: otbProjectiveProjectionImageFilter.hxx:39
otb::Functor::ProjectiveProjectionFunctor::InputType
TInput InputType
Definition: otbProjectiveProjectionImageFilter.h:45
otb::Functor::ProjectiveProjectionFunctor::OutputSize
vcl_size_t OutputSize(const std::array< vcl_size_t, 1 > &nbBands) const
Definition: otbProjectiveProjectionImageFilter.hxx:32