Skip to content
Snippets Groups Projects
Commit c428fd26 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

WRG

parent 17fcf0f0
Branches
Tags
No related merge requests found
...@@ -48,8 +48,8 @@ int otbConfusionMatrixCalculatorSetListSamples(int argc, char* argv[]) ...@@ -48,8 +48,8 @@ int otbConfusionMatrixCalculatorSetListSamples(int argc, char* argv[])
ListLabelType::Pointer refLabels = ListLabelType::New(); ListLabelType::Pointer refLabels = ListLabelType::New();
ListLabelType::Pointer prodLabels = ListLabelType::New(); ListLabelType::Pointer prodLabels = ListLabelType::New();
unsigned int nbSamples = atoi(argv[1]); int nbSamples = atoi(argv[1]);
unsigned int nbClasses = atoi(argv[2]); int nbClasses = atoi(argv[2]);
for(int i=0; i<nbSamples; i++) for(int i=0; i<nbSamples; i++)
...@@ -82,8 +82,8 @@ int otbConfusionMatrixCalculatorWrongSize(int argc, char* argv[]) ...@@ -82,8 +82,8 @@ int otbConfusionMatrixCalculatorWrongSize(int argc, char* argv[])
ListLabelType::Pointer refLabels = ListLabelType::New(); ListLabelType::Pointer refLabels = ListLabelType::New();
ListLabelType::Pointer prodLabels = ListLabelType::New(); ListLabelType::Pointer prodLabels = ListLabelType::New();
unsigned int nbSamples = atoi(argv[1]); int nbSamples = atoi(argv[1]);
unsigned int nbClasses = atoi(argv[2]); int nbClasses = atoi(argv[2]);
for(int i=0; i<nbSamples; i++) for(int i=0; i<nbSamples; i++)
{ {
...@@ -97,10 +97,11 @@ int otbConfusionMatrixCalculatorWrongSize(int argc, char* argv[]) ...@@ -97,10 +97,11 @@ int otbConfusionMatrixCalculatorWrongSize(int argc, char* argv[])
calculator->SetReferenceLabels( refLabels ); calculator->SetReferenceLabels( refLabels );
calculator->SetProducedLabels( prodLabels ); calculator->SetProducedLabels( prodLabels );
try{ try
calculator->Update(); {
} calculator->Update();
catch(itk::ExceptionObject) }
catch (itk::ExceptionObject)
{ {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
...@@ -126,8 +127,8 @@ int otbConfusionMatrixCalculatorUpdate(int argc, char* argv[]) ...@@ -126,8 +127,8 @@ int otbConfusionMatrixCalculatorUpdate(int argc, char* argv[])
ListLabelType::Pointer refLabels = ListLabelType::New(); ListLabelType::Pointer refLabels = ListLabelType::New();
ListLabelType::Pointer prodLabels = ListLabelType::New(); ListLabelType::Pointer prodLabels = ListLabelType::New();
unsigned int nbSamples = atoi(argv[1]); int nbSamples = atoi(argv[1]);
unsigned int nbClasses = atoi(argv[2]); int nbClasses = atoi(argv[2]);
for(int i=0; i<nbSamples; i++) for(int i=0; i<nbSamples; i++)
...@@ -153,15 +154,13 @@ int otbConfusionMatrixCalculatorUpdate(int argc, char* argv[]) ...@@ -153,15 +154,13 @@ int otbConfusionMatrixCalculatorUpdate(int argc, char* argv[])
double totalError = 0.0; double totalError = 0.0;
for(int i=0; i<nbClasses; i++) for (int i = 0; i < nbClasses; i++)
for(int j=0; j<nbClasses; j++) for (int j = 0; j < nbClasses; j++)
{ {
double goodValue = 0.0; double goodValue = 0.0;
if(i==j) if (i == j) goodValue = nbSamples / nbClasses;
goodValue = nbSamples/nbClasses; if (confmat(i, j) != goodValue) totalError += confmat(i, j);
if( confmat( i,j )!= goodValue ) }
totalError+=confmat( i,j );
}
if( totalError > 0.001 ) if( totalError > 0.001 )
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment