21 #ifndef otbFourierMellinDescriptorsImageFunction_hxx
22 #define otbFourierMellinDescriptorsImageFunction_hxx
25 #include "itkConstNeighborhoodIterator.h"
26 #include "itkNumericTraits.h"
34 template <
class TInputImage,
class TCoordRep>
37 m_NeighborhoodRadius = 1;
43 template <
class TInputImage,
class TCoordRep>
46 this->Superclass::PrintSelf(os, indent);
47 os << indent <<
" p indice maximum value : " << m_Pmax << std::endl;
48 os << indent <<
" q indice maximum value : " << m_Qmax << std::endl;
49 os << indent <<
" Neighborhood radius value : " << m_NeighborhoodRadius << std::endl;
52 template <
class TInputImage,
class TCoordRep>
58 coefs.resize(m_Pmax + 1);
60 descriptors.resize(m_Pmax + 1);
63 for (
unsigned int p = 0; p <= m_Pmax; p++)
65 coefs.at(p).resize(m_Qmax + 1);
66 descriptors.at(p).resize(m_Qmax + 1);
67 for (
unsigned int q = 0; q <= m_Qmax; q++)
69 coefs.at(p).at(q) = itk::NumericTraits<ScalarComplexType>::Zero;
70 descriptors.at(p).at(q) = itk::NumericTraits<ScalarRealType>::Zero;
75 if (!this->GetInputImage())
81 if (!this->IsInsideBuffer(index))
87 typename InputImageType::SizeType kernelSize;
88 kernelSize.Fill(m_NeighborhoodRadius);
90 itk::ConstNeighborhoodIterator<InputImageType> it(kernelSize, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion());
93 it.SetLocation(index);
96 const unsigned int size = it.Size();
97 for (
unsigned int i = 0; i < size; ++i)
108 for (
unsigned int p = 0; p <= m_Pmax; p++)
110 for (
unsigned int q = 0; q <= m_Qmax; q++)
114 if (x != 0 || y != 0)
116 coefs.at(p).at(q) += std::pow(xplusiy, -
static_cast<double>(p)) * std::pow(x2plusy2, power) * value;
124 for (
int p = m_Pmax; p >= 0; p--)
126 for (
int q = m_Qmax; q >= 0; q--)
128 coefs.at(p).at(q) /= 2 *
CONST_PI * coefs.at(0).at(0);
130 descriptors.at(p).at(q) = std::sqrt((coefs.at(p).at(q).real() * coefs.at(p).at(q).real() + coefs.at(p).at(q).imag() * coefs.at(p).at(q).imag()));