OTB  9.0.0
Orfeo Toolbox
otbHarrisImageFilter.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 otbHarrisImageFilter_hxx
22 #define otbHarrisImageFilter_hxx
23 
24 #include "otbHarrisImageFilter.h"
25 
26 namespace otb
27 {
28 
32 template <class TInputImage, class TOutputImage>
34 {
35  m_SigmaD = 1.0;
36  m_SigmaI = 1.0;
37  m_Alpha = 1.0;
38 
39  m_HessianFilter = HessianFilterType::New();
40  m_GaussianFilter0 = GaussianFilterType::New();
41  m_GaussianFilter1 = GaussianFilterType::New();
42  m_HessianToScalarFilter = HessianToScalarFilterType::New();
43  m_MultiplyScalarFilter = MultiplyScalarFilterType::New();
44 }
45 
46 template <class TInputImage, class TOutputImage>
48 {
49  m_HessianFilter->SetInput(this->GetInput());
50  m_HessianFilter->SetSigma(this->m_SigmaD);
51  m_HessianFilter->SetNormalizeAcrossScale(false);
52 
53  m_GaussianFilter0->SetInput(m_HessianFilter->GetOutput());
54  m_GaussianFilter0->SetSigma(this->m_SigmaI);
55  m_GaussianFilter0->SetOrder(GaussianFilterType::ZeroOrder);
56  m_GaussianFilter0->SetNormalizeAcrossScale(false);
57 
58  m_GaussianFilter1->SetInput(m_GaussianFilter0->GetOutput());
59  m_GaussianFilter1->SetSigma(this->m_SigmaI);
60  m_GaussianFilter1->SetOrder(GaussianFilterType::ZeroOrder);
61  m_GaussianFilter1->SetNormalizeAcrossScale(false);
62  m_GaussianFilter1->SetDirection(1);
63 
64  m_HessianToScalarFilter->SetInput(m_GaussianFilter1->GetOutput());
65  m_HessianToScalarFilter->SetAlpha(this->m_Alpha);
66 
67  m_MultiplyScalarFilter->SetInput(m_HessianToScalarFilter->GetOutput());
68  m_MultiplyScalarFilter->SetCoef(std::pow(m_SigmaD, 4.0));
69 
70  m_MultiplyScalarFilter->GraftOutput(this->GetOutput());
71  m_MultiplyScalarFilter->Update();
72  this->GraftOutput(m_MultiplyScalarFilter->GetOutput());
73 }
74 
78 template <class TInputImage, class TOutput>
79 void HarrisImageFilter<TInputImage, TOutput>::PrintSelf(std::ostream& os, itk::Indent indent) const
80 {
81  Superclass::PrintSelf(os, indent);
82  os << indent << "Sigma_D : " << this->m_SigmaD << std::endl;
83  os << indent << "Sigma_I : " << this->m_SigmaI << std::endl;
84  os << indent << "Alpha : " << this->m_Alpha << std::endl;
85 }
87 
88 } // end namespace otb
89 
90 #endif
otb::HarrisImageFilter::GenerateData
void GenerateData() override
Definition: otbHarrisImageFilter.hxx:47
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::HarrisImageFilter::HarrisImageFilter
HarrisImageFilter()
Definition: otbHarrisImageFilter.hxx:33
otb::HarrisImageFilter::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbHarrisImageFilter.hxx:79
otbHarrisImageFilter.h