Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
6976b5aa
Commit
6976b5aa
authored
Apr 07, 2020
by
Cédric Traizet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: use std accumulate and division operator of VLV when computing the probability mass function
parent
295e5634
Pipeline
#4140
failed with stages
in 4 minutes and 45 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
9 deletions
+3
-9
Modules/Filtering/ImageManipulation/include/otbSpectralInformationDivergenceFunctor.h
...ulation/include/otbSpectralInformationDivergenceFunctor.h
+3
-9
No files found.
Modules/Filtering/ImageManipulation/include/otbSpectralInformationDivergenceFunctor.h
View file @
6976b5aa
...
...
@@ -54,7 +54,7 @@ public:
TOutput
res
;
res
.
SetSize
(
m_ReferenceProbabilities
.
size
());
TInp
ut
inputProbability
=
ComputeProbabilityMassFunction
(
input
);
a
ut
o
inputProbability
=
ComputeProbabilityMassFunction
(
input
);
for
(
unsigned
int
i
=
0
;
i
<
m_ReferenceProbabilities
.
size
();
i
++
)
{
...
...
@@ -83,7 +83,6 @@ public:
private:
inline
TInput
ComputeProbabilityMassFunction
(
TInput
const
&
input
)
const
{
double
sum
=
0.0
;
for
(
unsigned
int
i
=
0
;
i
<
input
.
Size
();
i
++
)
{
// Input pixel should be non negative (e.g. reflectance, radiance)
...
...
@@ -91,14 +90,9 @@ private:
{
throw
std
::
runtime_error
(
"Input pixels of the spectral information divergence algorithm should be strictly positive."
);
}
sum
+=
input
[
i
];
}
TInput
res
(
input
.
Size
());
for
(
unsigned
int
i
=
0
;
i
<
input
.
Size
();
i
++
)
{
res
[
i
]
=
input
[
i
]
/
sum
;
}
return
res
;
return
input
/
std
::
accumulate
(
&
input
[
0
],
&
input
[
input
.
Size
()],
0.0
);
}
inline
OutputValueType
ComputeSpectralInformationDivergence
(
TInput
const
&
p
,
TInput
const
&
q
)
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment