21 #ifndef __otbWaveletOperatorBase_txx
22 #define __otbWaveletOperatorBase_txx
31 class TPixel,
unsigned int VDimension,
class TAllocator>
36 os << i <<
"Wavelet kind : " << GetWaveletName() <<
"\n";
37 os << i <<
"Up-Sampling factor " << GetUpSampleFactor() <<
"\n";
39 os << i <<
"Wavelet coeff: [ ";
41 iter != Superclass::End();
50 class TPixel,
unsigned int VDimension,
class TAllocator>
55 if (m_UpSampleFactor <= 1)
return;
57 unsigned long radius =
static_cast<unsigned long>(coeff.size()) >> 1;
58 unsigned long upSampleRadius = radius * m_UpSampleFactor;
61 upSampledCoeff.assign(2 * upSampleRadius + 1, 0.);
62 upSampledCoeff[upSampleRadius] = coeff[radius];
64 for (
unsigned int i = 1; i <= radius; ++i)
66 upSampledCoeff[upSampleRadius + m_UpSampleFactor * i] = coeff[radius + i];
67 upSampledCoeff[upSampleRadius - m_UpSampleFactor * i] = coeff[radius - i];
69 coeff = upSampledCoeff;
73 class TPixel,
unsigned int VDimension,
class TAllocator>
78 const unsigned int length = coeff.size();
79 const unsigned int medianPosition = length / 2;
82 newCoeff[medianPosition] = coeff[medianPosition];
83 for (
unsigned int i = 1; i <= medianPosition; ++i)
85 newCoeff[medianPosition + i] = coeff[medianPosition - i];
86 newCoeff[medianPosition - i] = coeff[medianPosition + i];
93 class TPixel,
unsigned int VDimension,
class TAllocator>
98 const unsigned int length = coeff.size();
103 for (
unsigned int i = 0; i < length; ++i)
105 highPassCoeff[i] = sign * coeff[i];
108 highPassCoeff[length] = 0.;
109 highPassCoeff[length + 1] = 0.;
111 coeff = highPassCoeff;
115 while ((coeff[0] == coeff[coeff.size() - 1]) && (coeff[0] == 0.0))
117 ReduceFilterLength(coeff);
122 class TPixel,
unsigned int VDimension,
class TAllocator>
127 const unsigned int length = coeff.size();
132 for (
unsigned int i = 0; i < length; ++i)
134 highPassCoeff[i] = sign * coeff[i];
137 highPassCoeff[length] = 0.;
138 highPassCoeff[length + 1] = 0.;
140 coeff = highPassCoeff;
144 while ((coeff[0] == coeff[coeff.size() - 1]) && (coeff[0] == 0.0))
146 assert(coeff.size() > 1);
147 ReduceFilterLength(coeff);
152 class TPixel,
unsigned int VDimension,
class TAllocator>
157 const unsigned int length = coeff.size();
160 for (
unsigned int i = 0; i < newFilter.size(); ++i)
162 newFilter[i] = coeff[i + 1];