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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
David Youssefi
otb
Commits
7ec6cb85
Commit
7ec6cb85
authored
12 years ago
by
Angelos Tzotsos
Browse files
Options
Downloads
Patches
Plain Diff
BUG: Split Ternary Filter to 2 parts
parent
a85e7ac3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Fusion/otbLmvmPanSharpeningFusionImageFilter.h
+43
-15
43 additions, 15 deletions
Code/Fusion/otbLmvmPanSharpeningFusionImageFilter.h
Code/Fusion/otbLmvmPanSharpeningFusionImageFilter.txx
+14
-11
14 additions, 11 deletions
Code/Fusion/otbLmvmPanSharpeningFusionImageFilter.txx
with
57 additions
and
26 deletions
Code/Fusion/otbLmvmPanSharpeningFusionImageFilter.h
+
43
−
15
View file @
7ec6cb85
...
...
@@ -67,7 +67,8 @@ public:
TPanImageType
::
ImageDimension
>
InternalImageType
;
/** Single band Xs image type */
typedef
otb
::
Image
<
TXsImageType
::
PixelType
,
typedef
typename
TXsImageType
::
PixelType
XsPixelType
;
typedef
otb
::
Image
<
XsPixelType
,
TXsImageType
::
ImageDimension
>
XsBandImageType
;
/** Internal image type used as Xs smoothing and local standard deviation filter output */
...
...
@@ -122,19 +123,38 @@ private:
* This functor applies the LMVM
* operation. It is intended for internal use only.
*/
class
FusionFunctor
class
FusionFunctor
1
{
public:
// Implement the fusion as a six arguments operator
typename
TOutputImageType
::
PixelType
operator
()(
const
typename
TXsImageType
::
PixelType
&
xsPixel
,
const
TInternalPrecision
&
smoothPanchroPixel
,
const
typename
InternalVectorImageType
::
PixelType
&
smoothXsPixel
,
typename
TOutputImageType
::
PixelType
operator
()(
const
TInternalPrecision
&
smoothPanchroPixel
,
const
typename
InternalVectorImageType
::
PixelType
&
stdXsPixel
,
const
TInternalPrecision
&
stdPanchroPixel
,
const
typename
TPanImageType
::
PixelType
&
sharpPanchroPixel
)
const
{
// Build output pixel
typename
TOutputImageType
::
PixelType
output
(
xsPixel
.
Size
());
typename
TOutputImageType
::
PixelType
output
(
stdXsPixel
.
Size
());
// Perform fusion for each band with appropriate casting
for
(
unsigned
int
i
=
0
;
i
<
stdXsPixel
.
Size
();
++
i
)
{
output
[
i
]
=
static_cast
<
typename
TOutputImageType
::
InternalPixelType
>
(
(
sharpPanchroPixel
-
(
smoothPanchroPixel
*
stdXsPixel
[
i
])));
}
// Returns the output pixel
return
output
;
}
};
class
FusionFunctor2
{
public:
// Implement the fusion as a six arguments operator
typename
TOutputImageType
::
PixelType
operator
()(
const
typename
TOutputImageType
::
PixelType
&
functor1Pixel
,
const
typename
InternalVectorImageType
::
PixelType
&
smoothXsPixel
,
const
TInternalPrecision
&
stdPanchroPixel
)
const
{
// Build output pixel
typename
TOutputImageType
::
PixelType
output
(
smoothXsPixel
.
Size
());
TInternalPrecision
scale
=
1.
;
...
...
@@ -144,10 +164,10 @@ private:
}
// Perform fusion for each band with appropriate casting
for
(
unsigned
int
i
=
0
;
i
<
x
sPixel
.
Size
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
smoothX
sPixel
.
Size
();
++
i
)
{
output
[
i
]
=
static_cast
<
typename
TOutputImageType
::
InternalPixelType
>
(
((
(
sharpPanchroPixel
-
(
smoothPanchroPixel
*
stdXs
Pixel
[
i
]
))
*
scale
)
+
smoothXsPixel
[
i
]));
((
functor1
Pixel
[
i
]
*
scale
)
+
smoothXsPixel
[
i
]));
}
// Returns the output pixel
return
output
;
...
...
@@ -158,17 +178,25 @@ private:
* Typedef of the TernaryFunctorImageFilter applying the fusion functor to
* p, p_smooth, p_std, xs_smooth, xs_std and xs.
*/
typedef
itk
::
TernaryFunctorImageFilter
<
TXsImageType
,
InternalImageType
,
InternalVectorImageType
,
typedef
itk
::
TernaryFunctorImageFilter
<
InternalImageType
,
InternalVectorImageType
,
InternalImageType
,
TPanImageType
,
TOutputImageType
,
FusionFunctor
>
FusionFilterType
;
FusionFunctor
1
>
Fusion
Step1
FilterType
;
/** Pointer to the fusion filter */
typename
FusionFilterType
::
Pointer
m_FusionFilter
;
typename
FusionStep1FilterType
::
Pointer
m_FusionStep1Filter
;
typedef
itk
::
TernaryFunctorImageFilter
<
TOutputImageType
,
InternalVectorImageType
,
InternalImageType
,
TOutputImageType
,
FusionFunctor2
>
FusionStep2FilterType
;
/** Pointer to the fusion filter */
typename
FusionStep1FilterType
::
Pointer
m_FusionStep2Filter
;
/** Typedef of the convolution filter performing Pan smoothing */
typedef
otb
::
ConvolutionImageFilter
...
...
This diff is collapsed.
Click to expand it.
Code/Fusion/otbLmvmPanSharpeningFusionImageFilter.txx
+
14
−
11
View file @
7ec6cb85
...
...
@@ -50,7 +50,8 @@ LmvmPanSharpeningFusionImageFilter
m_Filter.Fill(1);
// Instantiate fusion filter
m_FusionFilter = FusionFilterType::New();
m_FusionStep1Filter = FusionStep1FilterType::New();
m_FusionStep2Filter = FusionStep2FilterType::New();
// Set-up progress reporting
m_ProgressAccumulator = itk::ProgressAccumulator::New();
...
...
@@ -59,7 +60,8 @@ LmvmPanSharpeningFusionImageFilter
m_ProgressAccumulator->RegisterInternalFilter(m_PanNoiseFilter, 0.2);
m_ProgressAccumulator->RegisterInternalFilter(m_XsVectorConvolutionFilter, 0.2);
m_ProgressAccumulator->RegisterInternalFilter(m_XsVectorNoiseFilter, 0.2);
m_ProgressAccumulator->RegisterInternalFilter(m_FusionFilter, 0.2);
m_ProgressAccumulator->RegisterInternalFilter(m_FusionStep1Filter, 0.1);
m_ProgressAccumulator->RegisterInternalFilter(m_FusionStep2Filter, 0.1);
}
template <class TPanImageType, class TXsImageType, class TOutputImageType, class TInternalPrecision>
...
...
@@ -151,17 +153,18 @@ LmvmPanSharpeningFusionImageFilter
m_XsVectorNoiseFilter->SetFilter(m_XsNoiseFilter);
m_FusionFilter->SetInput1(this->GetXsInput());
m_FusionFilter->SetInput2(m_PanConvolutionFilter->GetOutput());
m_FusionFilter->SetInput3(m_XsVectorConvolutionFilter->GetOutput());
m_FusionFilter->SetInput4(m_XsVectorNoiseFilter->GetOutput());
m_FusionFilter->SetInput5(m_PanNoiseFilter->GetOutput());
m_FusionFilter->SetInput6(this->GetPanInput());
m_FusionStep1Filter->SetInput2(m_XsVectorNoiseFilter->GetOutput());
m_FusionStep1Filter->SetInput1(m_PanConvolutionFilter->GetOutput());
m_FusionStep1Filter->SetInput3(this->GetPanInput());
m_FusionStep2Filter->SetInput1(m_FusionStep1Filter->GetOutput());
m_FusionStep2Filter->SetInput3(m_PanNoiseFilter->GetOutput());
m_FusionStep2Filter->SetInput2(m_XsVectorConvolutionFilter->GetOutput());
// Wire composite filter
m_FusionFilter->GraftOutput(this->GetOutput());
m_FusionFilter->Update();
this->GraftOutput(m_FusionFilter->GetOutput());
m_Fusion
Step2
Filter->GraftOutput(this->GetOutput());
m_Fusion
Step2
Filter->Update();
this->GraftOutput(m_Fusion
Step2
Filter->GetOutput());
}
template <class TPanImageType, class TXsImageType, class TOutputImageType, class TInternalPrecision>
...
...
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