Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Main Repositories
otb
Commits
dc19d1cb
Commit
dc19d1cb
authored
Jul 13, 2017
by
Cédric Traizet
Browse files
vec app problem solved
parent
80f9d699
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/cbDimensionalityReductionTrainer.cxx
View file @
dc19d1cb
...
...
@@ -81,8 +81,6 @@ private:
void
DoExecute
()
{
std
::
cout
<<
"Appli Training!"
<<
std
::
endl
;
std
::
string
shapefile
=
GetParameterString
(
"io.vd"
);
otb
::
ogr
::
DataSource
::
Pointer
source
=
otb
::
ogr
::
DataSource
::
New
(
shapefile
,
otb
::
ogr
::
DataSource
::
Modes
::
Read
);
...
...
@@ -103,9 +101,7 @@ private:
}
input
->
PushBack
(
mv
);
}
std
::
cout
<<
GetParameterStringList
(
"feat"
)[
0
]
<<
std
::
endl
;
std
::
cout
<<
input
->
GetMeasurementVector
(
0
)
<<
std
::
endl
;
MeasurementType
meanMeasurementVector
;
MeasurementType
stddevMeasurementVector
;
...
...
app/cbDimensionalityReductionVector.cxx
View file @
dc19d1cb
...
...
@@ -151,14 +151,18 @@ class CbDimensionalityReductionVector : public Application
{
std
::
string
item
=
layerDefn
.
GetFieldDefn
(
iField
)
->
GetNameRef
();
std
::
string
key
(
item
);
std
::
string
::
iterator
end
=
std
::
remove_if
(
key
.
begin
(),
key
.
end
(),
IsNotAlphaNum
);
std
::
transform
(
key
.
begin
(),
end
,
key
.
begin
(),
tolower
);
/*
key.erase( std::remove_if(key.begin(),key.end(),IsNotAlphaNum), key.end());
std
::
transform
(
key
.
begin
(),
key
.
end
(),
key
.
begin
(),
tolower
);
std::transform(key.begin(), key.end(), key.begin(), tolower);
*/
OGRFieldType
fieldType
=
layerDefn
.
GetFieldDefn
(
iField
)
->
GetType
();
/*if(fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType) || fieldType == OFTReal)
/*
if(fieldType == OFTInteger || ogr::version_proxy::IsOFTInteger64(fieldType) || fieldType == OFTReal)
{*/
std
::
string
tmpKey
=
"feat."
+
key
;
//std::string tmpKey="feat."+key;
std
::
string
tmpKey
=
"feat."
+
key
.
substr
(
0
,
static_cast
<
unsigned
long
>
(
end
-
key
.
begin
()
)
);
AddChoice
(
tmpKey
,
item
);
//}
//}
// this is the same as in otbVectorClassifier, but it doesnt work
}
}
...
...
@@ -170,16 +174,6 @@ class CbDimensionalityReductionVector : public Application
clock_t
tic
=
clock
();
std
::
cout
<<
GetChoiceKeys
(
"feat"
)[
0
]
<<
std
::
endl
;
std
::
cout
<<
GetChoiceKeys
(
"feat"
)[
1
]
<<
std
::
endl
;
std
::
cout
<<
GetChoiceKeys
(
"feat"
)[
2
]
<<
std
::
endl
;
std
::
cout
<<
GetChoiceKeys
(
"feat"
)[
3
]
<<
std
::
endl
;
std
::
cout
<<
GetChoiceKeys
(
"feat"
)[
4
]
<<
std
::
endl
;
std
::
cout
<<
GetChoiceKeys
(
"feat"
)[
5
]
<<
std
::
endl
;
std
::
cout
<<
GetChoiceKeys
(
"feat"
)[
6
]
<<
std
::
endl
;
std
::
cout
<<
GetChoiceKeys
(
"feat"
)[
7
]
<<
std
::
endl
;
std
::
cout
<<
GetChoiceKeys
(
"feat"
)[
8
]
<<
std
::
endl
;
std
::
string
shapefile
=
GetParameterString
(
"in"
);
otb
::
ogr
::
DataSource
::
Pointer
source
=
otb
::
ogr
::
DataSource
::
New
(
shapefile
,
otb
::
ogr
::
DataSource
::
Modes
::
Read
);
otb
::
ogr
::
Layer
layer
=
source
->
GetLayer
(
0
);
...
...
@@ -189,7 +183,7 @@ class CbDimensionalityReductionVector : public Application
input
->
SetMeasurementVectorSize
(
nbFeatures
);
otb
::
ogr
::
Layer
::
const_iterator
it
=
layer
.
cbegin
();
otb
::
ogr
::
Layer
::
const_iterator
itEnd
=
layer
.
cend
();
std
::
cout
<<
(
*
it
)[
GetSelectedItems
(
"feat"
)[
0
]].
GetValue
<
double
>
()
<<
std
::
endl
;
for
(
;
it
!=
itEnd
;
++
it
)
{
MeasurementType
mv
;
...
...
@@ -203,17 +197,8 @@ class CbDimensionalityReductionVector : public Application
input
->
PushBack
(
mv
);
}
std
::
cout
<<
GetSelectedItems
(
"feat"
)[
0
]
<<
std
::
endl
;
std
::
cout
<<
input
->
GetMeasurementVector
(
0
)
<<
std
::
endl
;
/** Statistics for shift/scale */
MeasurementType
meanMeasurementVector
;
...
...
@@ -267,9 +252,7 @@ class CbDimensionalityReductionVector : public Application
ListSampleType
::
Pointer
listSample
=
trainingShiftScaleFilter
->
GetOutput
();
ListSampleType
::
Pointer
target
=
m_Model
->
PredictBatch
(
listSample
);
target
=
input
;
std
::
cout
<<
target
->
GetMeasurementVector
(
0
)
<<
std
::
endl
;
std
::
cout
<<
input
->
GetMeasurementVector
(
0
)
<<
std
::
endl
;
/** Create/Update Output Shape file */
std
::
cout
<<
GetParameterStringList
(
"featout"
).
size
()
<<
std
::
endl
;
...
...
include/ImageDimensionalityReductionFilter.txx
View file @
dc19d1cb
...
...
@@ -189,7 +189,7 @@ ImageDimensionalityReductionFilter<TInputImage, TOutputImage, TMaskImage>
// This call is threadsafe
labels = m_Model->PredictBatch(samples);
labels = samples;
// Set the output values
typename TargetListSampleType::ConstIterator labIt = labels->Begin();
...
...
Write
Preview
Supports
Markdown
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