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
87b0c511
Commit
87b0c511
authored
Apr 02, 2020
by
Cédric Traizet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: add functor to compute spectral angle on a vector of reference pixel
parent
c93be2c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
1 deletion
+44
-1
Modules/Filtering/ImageManipulation/include/otbSpectralAngleFunctor.h
...ering/ImageManipulation/include/otbSpectralAngleFunctor.h
+44
-1
No files found.
Modules/Filtering/ImageManipulation/include/otbSpectralAngleFunctor.h
View file @
87b0c511
...
...
@@ -96,9 +96,52 @@ private :
double
m_RefNorm
;
};
template
<
class
TInput
,
class
TReference
,
class
TOutput
>
class
SpectralAngleMapperFunctor
{
public:
SpectralAngleMapperFunctor
()
=
default
;
virtual
~
SpectralAngleMapperFunctor
()
=
default
;
// Binary operator
inline
TOutput
operator
()(
const
TInput
&
inPix
)
const
{
TOutput
res
;
res
.
SetSize
(
m_ReferencePixels
.
size
());
for
(
unsigned
int
i
=
0
;
i
<
m_ReferencePixels
.
size
();
i
++
)
{
res
[
i
]
=
SpectralAngleDetails
::
ComputeSpectralAngle
<
TInput
,
TInput
,
typename
TOutput
::
ValueType
>
(
inPix
,
m_ReferencePixels
[
i
],
m_ReferenceNorm
[
i
]);
}
return
res
;
}
size_t
OutputSize
(...)
const
{
return
m_ReferencePixels
.
size
();
}
void
SetReferencePixels
(
std
::
vector
<
TReference
>
const
&
ref
)
{
m_ReferencePixels
=
ref
;
// Precompute the norm of reference pixels
for
(
auto
const
&
pix
:
ref
)
{
m_ReferenceNorm
.
push_back
(
pix
.
GetNorm
());
}
}
std
::
vector
<
TReference
>
GetReferencePixels
()
const
{
return
m_ReferencePixels
;
}
private:
std
::
vector
<
TReference
>
m_ReferencePixels
;
std
::
vector
<
double
>
m_ReferenceNorm
;
};
}
// end namespace functor
}
// end namespace otb
...
...
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