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

TEST: add non regression test for ImageFittingPolygon (WIP)

parent 269ff6cd
No related branches found
No related tags found
No related merge requests found
......@@ -26,32 +26,41 @@
int otbImageFittingPolygonListFilter(int argc, char * argv[])
{
const char * imageFileName = argv[1];
const char * outfname = argv[1];
const double threshold = atof(argv[2]);
const char * polyFileName = argv[2];
const char * outFileName = argv[3];
const int fittingRadius = ato(argv[4]);
const int fittingIters = ato(argv[5]);
const unsigned int Dimension =2;
typedef otb::Polygon<double> PolygonType;
typedef otb::Image<double,Dimension> ImageType;
//Read the reference image and extract its contours
typedef otb::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(imageFileName);
typedef itk::CannyEdgeDetectionImageFilter<ImageType,ImageType> CannyFilterType;
CannyFilterType::Pointer canny = CannyFilterType::New();
canny->SetInput(reader->GetOutput());
//Read the original polygon list (kml file)
//Fit the polygons on the image
typedef otb::ImageFittingPolygonListFilter<PolygonType,ImageType> FittingPolygonType;
FittingPolygonType::Pointer fittingPolygon = FittingPolygonType::New();
fittingPolygon->SetInput(simplifyPolygonFilter->GetOutput());
fittingPolygon->SetInput(polygonList);
fittingPolygon->SetInputImage(canny->GetOutput());
fittingPolygon->SetRadius(fittingRadius);
fittingPolygon->SetNumberOfIterations(fittingIters);
fittingPolygon->Update();
// fittingPolygon->Update();
//Read the improved polygon list (kml file)
return EXIT_SUCCESS;
}
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