Skip to content
Snippets Groups Projects
Commit 522f377b authored by Marina Bertolino's avatar Marina Bertolino
Browse files

ENH: add nodatalabel parameters in ImageClassifier and KMeansClassification app

parent 8f62e454
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,11 @@ private:
SetParameterDescription("imstat", "A XML file containing mean and standard deviation to center and reduce samples before classification (produced by ComputeImagesStatistics application).");
MandatoryOff("imstat");
AddParameter(ParameterType_Int, "nodatalabel", "Label mask value");
SetParameterDescription("nodatalabel", "TODO");
SetDefaultParameterInt("nodatalabel", 0);
MandatoryOff("nodatalabel");
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription( "out", "Output image containing class labels");
SetDefaultOutputPixelType( "out", ImagePixelType_uint8);
......@@ -166,6 +171,8 @@ private:
m_ClassificationFilter = ClassificationFilterType::New();
m_ClassificationFilter->SetModel(m_Model);
m_ClassificationFilter->SetDefaultLabel(GetParameterInt("nodatalabel"));
// Normalize input image if asked
if(IsParameterEnabled("imstat") )
{
......
......@@ -65,6 +65,12 @@ void ClassKMeansBase::InitKMSampling()
SetParameterDescription("ct", "Convergence threshold for class centroid (L2 distance, by default 0.0001).");
SetDefaultParameterFloat("ct", 0.0001);
MandatoryOff("ct");
AddParameter(ParameterType_Int, "nodatalabel", "Label for the NoData class");
SetParameterDescription("nodatalabel", "TODO");
SetDefaultParameterInt("nodatalabel", 0);
MandatoryOff("nodatalabel");
/*
AddParameter(ParameterType_InputImage, "vm", "Validity Mask");
SetParameterDescription("vm", "Validity mask. Only non-zero pixels will be used to estimate KMeans modes.");
......@@ -259,6 +265,7 @@ void ClassKMeansBase::ComputeImageStatistics(std::string imageFileName,
void ClassKMeansBase::KMeansClassif()
{
GetInternalApplication("classif")->SetParameterInt("nodatalabel", GetParameterInt("nodatalabel"), false);
ExecuteInternal( "classif" );
}
......
......@@ -640,7 +640,8 @@ if(OTB_USE_SHARK)
-ct 0.0000001
-sampler periodic
-rand 121212
-out ${TEMP}/apTvClKMeansImageClassificationFilterOutput.tif
-nodatalabel 255
-out ${TEMP}/apTvClKMeansImageClassificationFilterOutput.tif uint8
-cleanup 0
VALID --compare-image ${NOTOL}
${OTBAPP_BASELINE}/apTvClKMeansImageClassificationFilterOutput.tif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment