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
e683b56b
Commit
e683b56b
authored
14 years ago
by
Julien Malik
Browse files
Options
Downloads
Patches
Plain Diff
BUG: fix memory error with vnl
parent
b3fc4f34
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Hyperspectral/otbISRAUnmixingImageFilter.txx
+12
-3
12 additions, 3 deletions
Code/Hyperspectral/otbISRAUnmixingImageFilter.txx
Code/Hyperspectral/otbUnConstrainedLeastSquareImageFilter.h
+19
-4
19 additions, 4 deletions
Code/Hyperspectral/otbUnConstrainedLeastSquareImageFilter.h
with
31 additions
and
7 deletions
Code/Hyperspectral/otbISRAUnmixingImageFilter.txx
+
12
−
3
View file @
e683b56b
...
...
@@ -31,7 +31,7 @@ template <class TInput, class TOutput, class TPrecision>
ISRAUnmixingFunctor<TInput, TOutput, TPrecision>
::ISRAUnmixingFunctor()
: m_OutputSize(0),
m_MaxIteration(10)
m_MaxIteration(10
0
)
{
}
...
...
@@ -90,7 +90,11 @@ ISRAUnmixingFunctor<TInput, TOutput, TPrecision>
::operator ()(const InputType& in) const
{
// TODO : support different types between input and output ?
VectorType inVector(in.GetDataPointer(), in.Size());
VectorType inVector(in.Size());
for (int i = 0; i < in.GetSize(); i++ )
{
inVector[i] = in[i];
}
// Initialize with Unconstrained Least Square solution
VectorType outVector = m_Svd->solve(inVector);
...
...
@@ -130,7 +134,12 @@ ISRAUnmixingFunctor<TInput, TOutput, TPrecision>
outVector = outVectorNew;
}
return OutputType(outVector.data_block(), outVector.size());
OutputType out(outVector.size());
for (int i = 0; i < out.GetSize(); i++ )
{
out[i] = outVector[i];
}
return out;
}
}
...
...
This diff is collapsed.
Click to expand it.
Code/Hyperspectral/otbUnConstrainedLeastSquareImageFilter.h
+
19
−
4
View file @
e683b56b
...
...
@@ -54,7 +54,7 @@ public:
bool
operator
!=
(
const
UnConstrainedLeastSquareFunctor
&
other
)
const
{
return
fals
e
;
return
tru
e
;
}
bool
operator
==
(
const
UnConstrainedLeastSquareFunctor
&
other
)
const
...
...
@@ -64,16 +64,30 @@ public:
void
SetMatrix
(
const
MatrixType
&
m
)
{
std
::
cout
<<
"m : "
<<
m
.
rows
()
<<
" "
<<
m
.
cols
()
<<
std
::
endl
;
m_Svd
.
reset
(
new
SVDType
(
m
)
);
m_Inv
=
m_Svd
->
inverse
();
m_OutputSize
=
m
.
cols
();
}
OutputType
operator
()(
const
InputType
&
in
)
{
// TODO : support different types between input and output ?
VectorType
inVector
(
in
.
GetDataPointer
(),
in
.
Size
());
VectorType
outVector
=
m_Svd
->
solve
(
inVector
);
return
OutputType
(
outVector
.
data_block
(),
outVector
.
size
());
VectorType
inVector
(
in
.
Size
());
for
(
int
i
=
0
;
i
<
in
.
GetSize
();
i
++
)
{
inVector
[
i
]
=
in
[
i
];
}
VectorType
outVector
=
m_Inv
*
inVector
;
OutputType
out
(
outVector
.
size
());
for
(
int
i
=
0
;
i
<
out
.
GetSize
();
i
++
)
{
out
[
i
]
=
outVector
[
i
];
}
return
out
;
}
private
:
...
...
@@ -83,6 +97,7 @@ private:
unsigned
int
m_OutputSize
;
SVDPointerType
m_Svd
;
MatrixType
m_Inv
;
};
}
...
...
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