Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Belvire
otb
Commits
27644b7e
Commit
27644b7e
authored
16 years ago
by
Grégoire Mercier
Browse files
Options
Downloads
Patches
Plain Diff
BUG: A trou algorithm
parent
c5e2cf57
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Code/MultiScale/otbHaarOperator.h
+23
-19
23 additions, 19 deletions
Code/MultiScale/otbHaarOperator.h
Code/MultiScale/otbWaveletOperator.h
+147
-0
147 additions, 0 deletions
Code/MultiScale/otbWaveletOperator.h
Code/MultiScale/otb_9_7_Operator.h
+13
-12
13 additions, 12 deletions
Code/MultiScale/otb_9_7_Operator.h
with
183 additions
and
31 deletions
Code/MultiScale/otbHaarOperator.h
+
23
−
19
View file @
27644b7e
...
...
@@ -20,8 +20,7 @@
#ifndef __otbHaarOperator__h
#define __otbHaarOperator__h
#include
"itkExceptionObject.h"
#include
"itkNeighborhoodOperator.h"
#include
"otbWaveletOperator.h"
namespace
otb
{
...
...
@@ -31,11 +30,12 @@ namespace otb {
* \brief A NeighborhoodOperator for performing a Haar based filtering
* at a pixel location.
*
* LowPassHaarOperator is a NeighborhoodOperator that should be applied a
* LowPassHaarOperator is a NeighborhoodOperator that should be applied
to
a
* NeighborhoodIterator using the NeighborhoodInnerProduct method.
* The Haar Operator is defiend in 1D as \$ H(z) = ( 1 + z^{-1} ) / 2 \$.
* In N dimensions, the operator is directional
*
* \sa WaveletOperator
* \sa NeighborhoodOperator
* \sa Neighborhood
* \sa ForwardDifferenceOperator
...
...
@@ -46,23 +46,23 @@ namespace otb {
template
<
class
TPixel
,
unsigned
int
VDimension
,
class
TAllocator
=
itk
::
NeighborhoodAllocator
<
TPixel
>
>
class
ITK_EXPORT
LowPassHaarOperator
:
public
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
:
public
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
{
public:
/** Standard typedefs */
typedef
LowPassHaarOperator
Self
;
typedef
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
Superclass
;
typedef
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
Superclass
;
itkTypeMacro
(
LowPassHaarOperator
,
Neighborhood
Operator
);
itkTypeMacro
(
LowPassHaarOperator
,
Wavelet
Operator
);
LowPassHaarOperator
()
LowPassHaarOperator
()
:
WaveletOperator
()
{
this
->
SetRadius
(
1
);
this
->
CreateToRadius
(
1
);
}
LowPassHaarOperator
(
const
Self
&
other
)
:
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
(
other
)
:
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
(
other
)
{
/* ... */
}
...
...
@@ -98,11 +98,14 @@ protected:
CoefficientVector
GenerateCoefficients
()
{
CoefficientVector
coeff
;
// stands for z^{-1}
coeff
.
push_back
(
0.5
);
// stands for z^0
coeff
.
push_back
(
0.5
);
// stands for z^1
coeff
.
push_back
(
0.0
);
coeff
.
push_back
(
0.5
);
coeff
.
push_back
(
0.5
);
return
coeff
;
return
Superclass
::
UpSamplingCoefficients
(
coeff
)
;
}
/** Arranges coefficients spatially in the memory buffer. */
...
...
@@ -120,9 +123,10 @@ protected:
*
* HighPassHaarOperator is a NeighborhoodOperator that should be applied a
* NeighborhoodIterator using the NeighborhoodInnerProduct method.
* The Haar Operator is defiend in 1D as \$ G(z) = ( 1
+
z^{-1} ) / 2 \$.
* The Haar Operator is defiend in 1D as \$ G(z) = ( 1
-
z^{-1} ) / 2 \$.
* In N dimensions, the operator is directional
*
* \sa WaveletOperator
* \sa NeighborhoodOperator
* \sa Neighborhood
* \sa ForwardDifferenceOperator
...
...
@@ -133,14 +137,14 @@ protected:
template
<
class
TPixel
,
unsigned
int
VDimension
,
class
TAllocator
=
itk
::
NeighborhoodAllocator
<
TPixel
>
>
class
ITK_EXPORT
HighPassHaarOperator
:
public
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
:
public
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
{
public:
/** Standard typedefs */
typedef
HighPassHaarOperator
Self
;
typedef
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
Superclass
;
typedef
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
Superclass
;
itkTypeMacro
(
HighPassHaarOperator
,
Neighborhood
Operator
);
itkTypeMacro
(
HighPassHaarOperator
,
Wavelet
Operator
);
HighPassHaarOperator
()
{
...
...
@@ -149,7 +153,7 @@ public:
}
HighPassHaarOperator
(
const
Self
&
other
)
:
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
(
other
)
:
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
(
other
)
{
/* ... */
}
...
...
@@ -185,11 +189,11 @@ protected:
CoefficientVector
GenerateCoefficients
()
{
CoefficientVector
coeff
;
coeff
.
push_back
(
0.0
);
coeff
.
push_back
(
0.5
);
coeff
.
push_back
(
-
0.5
);
coeff
.
push_back
(
0.5
);
coeff
.
push_back
(
0.0
);
return
coeff
;
return
Superclass
::
UpSamplingCoefficients
(
coeff
)
;
}
/** Arranges coefficients spatially in the memory buffer. */
...
...
This diff is collapsed.
Click to expand it.
Code/MultiScale/otbWaveletOperator.h
0 → 100644
+
147
−
0
View file @
27644b7e
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
See ITCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbWaveletOperator__h
#define __otbWaveletOperator__h
#include
"itkExceptionObject.h"
#include
"itkNeighborhoodOperator.h"
namespace
otb
{
/**
* \class WaveletOperator
*
* \brief A NeighborhoodOperator wavelet base class
*
* This class is the mother class for any wavelet operator that requires
* "a-trou" approach for shift-invariant wavelet transform. This class has
* to be derived, it cannot be used directly.
*
* Any wavelet operator that inherits from WaveletOperator is to be used
* as a NeighborhoodOperator that should be applied to a
* NeighborhoodIterator using the NeighborhoodInnerProduct method.
*
* It is assumed that any wavelet is directional.
*
* Set the level of up-sampling though SetUpSampleFactor() before calling
* CreateDirectional(). Each class that inherits from WaveletOperator has
* to re-implement GenerateCoefficients(). It has to end by:
* return this->UpSamplingCoefficients( coeff ) to perform the up-sampling
*
* \sa LowPassHaarOperator
* \sa HighPassHaarOperator
* \sa NeighborhoodOperator
* \sa Neighborhood
*
* \ingroup Operators
*/
template
<
class
TPixel
,
unsigned
int
VDimension
,
class
TAllocator
=
itk
::
NeighborhoodAllocator
<
TPixel
>
>
class
ITK_EXPORT
WaveletOperator
:
public
itk
::
NeighborhoodOperator
<
TPixel
,
VDimension
,
TAllocator
>
{
public:
/** Standard typedefs */
typedef
WaveletOperator
Self
;
typedef
itk
::
NeighborhoodOperator
<
TPixel
,
VDimension
,
TAllocator
>
Superclass
;
itkTypeMacro
(
WaveletOperator
,
NeighborhoodOperator
);
/** Construction */
WaveletOperator
()
{
m_UpSampleFactor
=
0
;
}
/** Construction by copy */
WaveletOperator
(
const
Self
&
other
)
:
itk
::
NeighborhoodOperator
<
TPixel
,
VDimension
,
TAllocator
>
(
other
)
{
m_UpsampleFactor
=
other
.
GetUpSampleFactor
();
}
virtual
~
WaveletOperator
()
{}
/** Assignment operator */
Self
&
operator
=
(
const
Self
&
other
)
{
Superclass
::
operator
=
(
other
);
m_UpSampleFactor
=
other
.
GetUpSampleFactor
();
return
*
this
;
}
/**
* Prints some debugging information
*/
virtual
void
PrintSelf
(
std
::
ostream
&
os
,
itk
::
Indent
i
)
const
{
Superclass
::
PrintSelf
(
os
,
i
.
GetNextIndent
());
os
<<
i
<<
"Up-Sampling factor "
<<
this
->
m_UpSampleFactor
<<
"
\n
"
;
}
/**
* Set/Get the level of up sampling of the filter
*/
itkGetMacro
(
UpSampleFactor
,
unsigned
int
);
itkSetMacro
(
UpSampleFactor
,
unsigned
int
);
protected
:
/**
* Typedef support for coefficient vector type. Necessary to
* work around compiler bug on VC++.
*/
typedef
typename
Superclass
::
CoefficientVector
CoefficientVector
;
typedef
typename
Superclass
::
PixelType
PixelType
;
/**
* Perform the "a-trou" algorithm for shift-invariant transformation.
* It transforms the filter \$ H(z) \$ into \$ H(z^2) \$.
*/
CoefficientVector
UpSamplingCoefficients
(
CoefficientVector
&
coeff
)
{
if
(
m_UpsampleFactor
==
0
)
return
coeff
;
for
(
unsigned
int
up
=
0
;
up
<
m_UpsampleFactor
;
++
up
)
{
this
->
SetRadius
(
2
*
this
->
GetRadius
()
);
this
->
CreateToRadius
(
this
->
GetRadius
()
);
CoefficientVector
upSampledCoeff
;
upSampledCoeff
.
push_back
(
coeff
[
0
]
);
for
(
unsigned
int
i
=
1
;
i
<
coeff
.
size
();
++
i
)
{
upSampledCoeff
.
push_back
(
0.0
);
upSampledCoeff
.
push_back
(
coeff
[
i
]
);
}
coeff
=
upSampledCoeff
;
}
return
coeff
;
}
unsigned
int
m_UpSampleFactor
;
};
#endif
This diff is collapsed.
Click to expand it.
Code/MultiScale/otb_9_7_Operator.h
+
13
−
12
View file @
27644b7e
...
...
@@ -20,8 +20,7 @@
#ifndef __otb_9_7_Operator__h
#define __otb_9_7_Operator__h
#include
"itkExceptionObject.h"
#include
"itkNeighborhoodOperator.h"
#include
"otbWaveletOperator.h"
namespace
otb
{
...
...
@@ -40,6 +39,7 @@ namespace otb {
*
* In N dimensions, the operator is directional
*
* \sa WaveletOperator
* \sa NeighborhoodOperator
* \sa Neighborhood
* \sa ForwardDifferenceOperator
...
...
@@ -50,14 +50,14 @@ namespace otb {
template
<
class
TPixel
,
unsigned
int
VDimension
,
class
TAllocator
=
itk
::
NeighborhoodAllocator
<
TPixel
>
>
class
ITK_EXPORT
LowPass_9_7_Operator
:
public
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
:
public
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
{
public:
/** Standard typedefs */
typedef
LowPass_9_7_Operator
Self
;
typedef
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
Superclass
;
typedef
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
Superclass
;
itkTypeMacro
(
LowPass_9_7_Operator
,
Neighborhood
Operator
);
itkTypeMacro
(
LowPass_9_7_Operator
,
Wavelet
Operator
);
LowPass_9_7_Operator
()
{
...
...
@@ -66,7 +66,7 @@ public:
}
LowPass_9_7_Operator
(
const
Self
&
other
)
:
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
(
other
)
:
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
(
other
)
{
/* ... */
}
...
...
@@ -112,7 +112,7 @@ protected:
coeff
.
push_back
(
-
0.016864118443
);
coeff
.
push_back
(
0.026748757411
);
return
coeff
;
return
Superclass
::
UpSamplingCoefficients
(
coeff
)
;
}
/** Arranges coefficients spatially in the memory buffer. */
...
...
@@ -136,6 +136,7 @@ protected:
*
* In N dimensions, the operator is directional
*
* \sa WaveletOperator
* \sa NeighborhoodOperator
* \sa Neighborhood
* \sa ForwardDifferenceOperator
...
...
@@ -146,14 +147,14 @@ protected:
template
<
class
TPixel
,
unsigned
int
VDimension
,
class
TAllocator
=
itk
::
NeighborhoodAllocator
<
TPixel
>
>
class
ITK_EXPORT
HighPass_9_7_Operator
:
public
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
:
public
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
{
public:
/** Standard typedefs */
typedef
HighPass_9_7_Operator
Self
;
typedef
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
Superclass
;
typedef
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
Superclass
;
itkTypeMacro
(
HighPass_9_7_Operator
,
Neighborhood
Operator
);
itkTypeMacro
(
HighPass_9_7_Operator
,
Wavelet
Operator
);
HighPass_9_7_Operator
()
{
...
...
@@ -162,7 +163,7 @@ public:
}
HighPass_9_7_Operator
(
const
Self
&
other
)
:
itk
::
Neighborhood
Operator
<
TPixel
,
VDimension
,
TAllocator
>
(
other
)
:
Wavelet
Operator
<
TPixel
,
VDimension
,
TAllocator
>
(
other
)
{
/* ... */
}
...
...
@@ -206,7 +207,7 @@ protected:
coeff
.
push_back
(
-
0.028771763114
);
coeff
.
push_back
(
0.045635881557
);
return
coeff
;
return
Superclass
::
UpSamplingCoefficients
(
coeff
)
;
}
/** Arranges coefficients spatially in the memory buffer. */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment