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
Julien Cabieces
otb
Commits
43ca2649
Commit
43ca2649
authored
5 years ago
by
Cédric Traizet
Browse files
Options
Downloads
Patches
Plain Diff
ENH: added polygon class statistics
parent
88682f1f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/Applications/AppClassification/app/otbTrainImagesRegression.cxx
+35
-9
35 additions, 9 deletions
...ations/AppClassification/app/otbTrainImagesRegression.cxx
with
35 additions
and
9 deletions
Modules/Applications/AppClassification/app/otbTrainImagesRegression.cxx
+
35
−
9
View file @
43ca2649
...
...
@@ -52,16 +52,33 @@ protected:
const
std
::
string
&
fieldName
)
{
auto
setFieldAppli
=
GetInternalApplication
(
"setfield"
);
setFieldAppli
->
SetParameterString
(
"in"
,
inVectorFileName
);
setFieldAppli
->
SetParameterString
(
"out"
,
outVectorFileName
);
setFieldAppli
->
SetParameterString
(
"fn"
,
fieldName
);
setFieldAppli
->
SetParameterString
(
"fv"
,
"0"
);
setFieldAppli
->
ExecuteAndWriteOutput
();
ExecuteInternal
(
"setfield"
);
}
void
ComputePolygonStatistics
(
const
std
::
string
&
inVectorFileName
,
FloatVectorImageType
*
inputImage
,
const
std
::
string
&
statisticFileName
,
const
std
::
string
&
fieldName
)
{
auto
polygonClassAppli
=
GetInternalApplication
(
"polystat"
);
polygonClassAppli
->
SetParameterInputImage
(
"in"
,
inputImage
);
polygonClassAppli
->
SetParameterString
(
"vec"
,
inVectorFileName
);
polygonClassAppli
->
SetParameterString
(
"out"
,
statisticFileName
);
polygonClassAppli
->
UpdateParameters
();
polygonClassAppli
->
SetParameterString
(
"field"
,
fieldName
);
ExecuteInternal
(
"polystat"
);
}
void
InitIO
()
{
AddParameter
(
ParameterType_Group
,
"io"
,
"Input and output data"
);
...
...
@@ -79,7 +96,7 @@ protected:
void
InitSampling
()
{
AddApplication
(
"VectorDataSetField"
,
"setfield"
,
"Set additional vector field"
);
//
AddApplication( "PolygonClassStatistics", "polystat", "Polygon analysis" );
AddApplication
(
"PolygonClassStatistics"
,
"polystat"
,
"Polygon analysis"
);
//AddApplication( "MultiImageSamplingRate", "rates", "Sampling rates" );
//AddApplication( "SampleSelection", "select", "Sample selection" );
//AddApplication( "SampleExtraction", "extraction", "Sample extraction" );
...
...
@@ -119,13 +136,22 @@ private:
void
DoExecute
()
override
{
std
::
string
predictorFieldName
=
"predict"
;
std
::
string
predictorFieldName
=
"regclass"
;
auto
vectorFileNames
=
GetParameterStringList
(
"io.vd"
);
FloatVectorImageListType
*
inputImageList
=
GetParameterImageList
(
"io.il"
);
auto
fileNames
=
GetParameterStringList
(
"io.vd"
);
for
(
auto
file
:
fileNames
)
for
(
unsigned
int
i
=
0
;
i
<
vectorFileNames
.
size
();
i
++
)
{
std
::
string
outfile
=
"tmp.shp"
;
AddRegressionField
(
file
,
outfile
,
predictorFieldName
);
std
::
string
outfile
=
"setfield"
+
std
::
to_string
(
i
)
+
".shp"
;
// TODO io file handler
AddRegressionField
(
vectorFileNames
[
i
],
outfile
,
predictorFieldName
);
std
::
cout
<<
"Regression field added"
<<
std
::
endl
;
std
::
string
statfile
=
"polygonstat"
+
std
::
to_string
(
i
)
+
".xml"
;
// TODO io file handler
ComputePolygonStatistics
(
outfile
,
inputImageList
->
GetNthElement
(
i
),
statfile
,
predictorFieldName
);
std
::
cout
<<
"Polygon class statistic done"
<<
std
::
endl
;
}
}
};
...
...
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