Skip to content
Snippets Groups Projects
Commit fd1b56a7 authored by Julien Michel's avatar Julien Michel
Browse files

Code Formation

parent ed64f52b
Branches
Tags
No related merge requests found
......@@ -147,7 +147,6 @@ KMeansImageClassificationFilter<TInputImage,TOutputImage,VMaxSampleDimension,TMa
current_distance = tmp_dist;
}
}
std::cout<<"Pixel: "<<pixel<<" label: "<<current_label<<" centroid: "<<m_CentroidsMap[current_label]<<std::endl;
outIt.Set(current_label);
}
++outIt;
......
......@@ -46,15 +46,19 @@ int otbKMeansImageClassificationFilter(int argc, char * argv[])
reader->SetFileName(infname);
reader->GenerateOutputInformation();
unsigned int parameterSize = nbClasses * reader->GetOutput()->GetNumberOfComponentsPerPixel();
const unsigned int sampleSize = ClassificationFilterType::MaxSampleDimension;
const unsigned int parameterSize = nbClasses * sampleSize;
KMeansParametersType parameters;
parameters.SetSize(parameterSize);
parameters.Fill(0);
for(unsigned int i = 0; i < parameterSize;++i)
for(unsigned int i = 0; i<nbClasses;++i)
{
parameters[i]=atof(argv[4+i]);
for(unsigned int j = 0; j < reader->GetOutput()->GetNumberOfComponentsPerPixel();++j)
{
parameters[i*sampleSize+j]=atof(argv[4+i*reader->GetOutput()->GetNumberOfComponentsPerPixel()+j]);
}
}
std::cout<<"Parameters: "<<parameters<<std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment