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
d405ccb9
Commit
d405ccb9
authored
Apr 03, 2020
by
Cédric Traizet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: add theshold and bv parameters to SpectralAngleClassification
parent
69ef64ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
Modules/Applications/AppHyperspectral/app/otbSpectralAngleClassification.cxx
...s/AppHyperspectral/app/otbSpectralAngleClassification.cxx
+23
-4
No files found.
Modules/Applications/AppHyperspectral/app/otbSpectralAngleClassification.cxx
View file @
d405ccb9
...
...
@@ -97,6 +97,20 @@ private:
AddChoice
(
"mode.sid"
,
"Spectral information divergence"
);
SetParameterDescription
(
"mode.sid"
,
"Spectral information divergence (SID) measure."
);
AddParameter
(
ParameterType_Float
,
"threshold"
,
"Classification threshold"
);
SetParameterDescription
(
"threshold"
,
"Pixel with a measurement greater than this threshold relatively to "
"a reference pixel are not classified. The same threshold is used for all classes."
);
MandatoryOff
(
"threshold"
);
AddParameter
(
ParameterType_Int
,
"bv"
,
"Background value"
);
SetParameterDescription
(
"bv"
,
"Value of unclassified pixels in the classification image "
"(this parameter is only used if threshold is set)."
);
MandatoryOff
(
"bv"
);
SetDefaultParameterInt
(
"bv"
,
-
1
);
AddRAMParameter
();
SetMultiWriting
(
true
);
...
...
@@ -158,11 +172,16 @@ private:
if
(
HasValue
(
"out"
))
{
// This lambda return the index of the minimum value in a pixel
auto
minIndexLambda
=
[](
PixelType
const
&
pixel
)
auto
threshold
=
HasValue
(
"threshold"
)
?
GetParameterFloat
(
"threshold"
)
:
std
::
numeric_limits
<
ValueType
>::
max
();
auto
bv
=
GetParameterInt
(
"bv"
);
// This lambda return the index of the minimum value in a pixel, values above threshold are not classified.
auto
minIndexLambda
=
[
threshold
,
bv
](
PixelType
const
&
pixel
)
{
auto
min
=
std
::
numeric_limits
<
ValueType
>::
max
();
unsigned
int
res
=
0
;
auto
min
=
threshold
;
int
res
=
bv
;
for
(
unsigned
int
i
=
0
;
i
<
pixel
.
Size
();
i
++
)
{
if
(
pixel
[
i
]
<
min
)
...
...
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