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

TEST: add non regression test for ImageFittingPolygon

parent 8eeed272
No related branches found
No related tags found
No related merge requests found
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "itkExceptionObject.h"
#include "otbImageFittingPolygonListFilter.h"
#include "otbPolygon.h"
#include "otbImage.h"
#include <fstream>
#include <cstdlib>
int otbImageFittingPolygonListFilter(int argc, char * argv[])
{
const char * imageFileName = argv[1];
const char * outfname = argv[1];
const double threshold = atof(argv[2]);
const unsigned int Dimension =2;
typedef otb::Polygon<double> PolygonType;
typedef otb::Image<double,Dimension> ImageType;
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());
typedef otb::ImageFittingPolygonListFilter<PolygonType,ImageType> FittingPolygonType;
FittingPolygonType::Pointer fittingPolygon = FittingPolygonType::New();
fittingPolygon->SetInput(simplifyPolygonFilter->GetOutput());
fittingPolygon->SetInputImage(canny->GetOutput());
fittingPolygon->SetRadius(fittingRadius);
fittingPolygon->SetNumberOfIterations(fittingIters);
fittingPolygon->Update();
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