Commit c2538939 authored by Marina Bertolino's avatar Marina Bertolino

ENH: change the output mode in the internal app SampleExtraction

parent 72473412
......@@ -55,7 +55,7 @@ private:
"2) PolygonClassStatistics : compute the statistics,\n"
"3) SampleSelection : select the samples by constant strategy in the shapefile "
"(1000000 samples max),\n"
"4) SamplesExtraction : extract the samples descriptors,\n"
"4) SamplesExtraction : extract the samples descriptors (update of SampleSelection output file),\n"
"5) TrainVectorClassifier : train the SharkKMeans model,\n"
"6) ComputeImagesStatistics : compute images second order statistics,\n"
"7) ImageClassifier : performs the classification of the input image "
......@@ -126,15 +126,14 @@ private:
// Compute SampleSelection and SampleExtraction app
SelectAndExtractSamples(fileNames.polyStatOutput, fieldName,
fileNames.sampleSelectOutput,
fileNames.sampleExtractOutput,
fileNames.sampleOutput,
actualNBSamplesForKMeans);
// Compute Images second order statistics
ComputeImageStatistics(GetParameterString("in"), fileNames.imgStatOutput);
// Compute a train model with TrainVectorClassifier app
TrainKMModel(GetParameterImage("in"), fileNames.sampleExtractOutput,
TrainKMModel(GetParameterImage("in"), fileNames.sampleOutput,
fileNames.modelFile);
// Compute a classification of the input image according to a model file
......
......@@ -103,7 +103,6 @@ public:
void SelectAndExtractSamples(std::string statisticsFileName,
std::string fieldName,
std::string sampleFileName,
std::string sampleExtractFileName,
int NBSamples);
/**
......@@ -142,8 +141,7 @@ public:
{
tmpVectorFile = outPath + "_imgEnvelope.shp";
polyStatOutput = outPath + "_polyStats.xml";
sampleSelectOutput = outPath + "_sampleSelect.shp";
sampleExtractOutput = outPath + "_sampleExtract.shp";
sampleOutput = outPath + "_sampleSelect.shp";
modelFile = outPath + "_model.txt";
imgStatOutput = outPath + "_imgstats.xml";
}
......@@ -152,16 +150,14 @@ public:
{
RemoveFile(tmpVectorFile);
RemoveFile(polyStatOutput);
RemoveFile(sampleSelectOutput);
RemoveFile(sampleExtractOutput);
RemoveFile(sampleOutput);
RemoveFile(modelFile);
RemoveFile(imgStatOutput);
}
std::string tmpVectorFile;
std::string polyStatOutput;
std::string sampleSelectOutput;
std::string sampleExtractOutput;
std::string sampleOutput;
std::string modelFile;
std::string imgStatOutput;
......
......@@ -181,7 +181,6 @@ void ClassKMeansBase::ComputePolygonStatistics(const std::string &statisticsFile
void ClassKMeansBase::SelectAndExtractSamples(std::string statisticsFileName,
std::string fieldName,
std::string sampleFileName,
std::string sampleExtractFileName,
int NBSamples)
{
/* SampleSelection */
......@@ -206,9 +205,6 @@ void ClassKMeansBase::SelectAndExtractSamples(std::string statisticsFileName,
GetInternalApplication("extraction")->SetParameterString("outfield", "prefix", false);
GetInternalApplication("extraction")->SetParameterString("outfield.prefix.name", "value_", false);
GetInternalApplication("extraction")->SetParameterString("out", sampleExtractFileName, false);
otbAppLogINFO("Sample extraction file name : " << sampleExtractFileName);
// extract sample descriptors
GetInternalApplication("extraction")->ExecuteAndWriteOutput();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment