Skip to content
Snippets Groups Projects
Commit 48de51e6 authored by Jonathan Guinet's avatar Jonathan Guinet
Browse files

TEST: useoptimization option in MeanShiftFilter tests.

parent 590d8b85
No related branches found
No related tags found
No related merge requests found
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
int otbMeanShiftImageFilter2(int argc, char * argv[]) int otbMeanShiftImageFilter2(int argc, char * argv[])
{ {
if (argc != 11) if (argc != 11 && argc != 12)
{ {
std::cerr << "Usage: " << argv[0] << std::cerr << "Usage: " << argv[0] <<
" infname spatialfname spectralfname metricfname iterationfname labelfname spatialBandwidth rangeBandwidth threshold maxiterationnumber" " infname spatialfname spectralfname metricfname iterationfname labelfname spatialBandwidth rangeBandwidth threshold maxiterationnumber (useoptimization)"
<< std::endl; << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
...@@ -42,6 +42,12 @@ int otbMeanShiftImageFilter2(int argc, char * argv[]) ...@@ -42,6 +42,12 @@ int otbMeanShiftImageFilter2(int argc, char * argv[])
const double rangeBandwidth = atof(argv[8]); const double rangeBandwidth = atof(argv[8]);
const double threshold = atof(argv[9]); const double threshold = atof(argv[9]);
const unsigned int maxiterationnumber = atoi(argv[10]); const unsigned int maxiterationnumber = atoi(argv[10]);
bool useoptimization = true;
if(argc==12)
{
useoptimization = atoi(argv[11])!=0;
}
/* maxit - threshold */ /* maxit - threshold */
const unsigned int Dimension = 2; const unsigned int Dimension = 2;
...@@ -70,6 +76,8 @@ int otbMeanShiftImageFilter2(int argc, char * argv[]) ...@@ -70,6 +76,8 @@ int otbMeanShiftImageFilter2(int argc, char * argv[])
filter->SetThreshold(threshold); filter->SetThreshold(threshold);
filter->SetMaxIterationNumber(maxiterationnumber); filter->SetMaxIterationNumber(maxiterationnumber);
filter->SetInput(reader->GetOutput()); filter->SetInput(reader->GetOutput());
filter->SetModeSearchOptimization(useoptimization);
//filter->SetNumberOfThreads(1); //filter->SetNumberOfThreads(1);
SpatialWriterType::Pointer writer1 = SpatialWriterType::New(); SpatialWriterType::Pointer writer1 = SpatialWriterType::New();
WriterType::Pointer writer2 = WriterType::New(); WriterType::Pointer writer2 = WriterType::New();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment