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

TEST: add non regression test for ImageFittingPolygon

parent 561d0f4b
No related branches found
No related tags found
No related merge requests found
...@@ -848,7 +848,7 @@ ADD_TEST(feTvImageFittingPolygonListFilter ${FEATUREEXTRACTION_TESTS9} ...@@ -848,7 +848,7 @@ ADD_TEST(feTvImageFittingPolygonListFilter ${FEATUREEXTRACTION_TESTS9}
--compare-ascii ${EPS} --compare-ascii ${EPS}
${BASELINE_FILES}/feTvImageFittingPolygonListFilter_Output.kml ${BASELINE_FILES}/feTvImageFittingPolygonListFilter_Output.kml
${TEMP}/feTvImageFittingPolygonListFilter_Output.kml ${TEMP}/feTvImageFittingPolygonListFilter_Output.kml
otbImageToSIFTKeyPointSetFilterOutputAscii otbImageFittingPolygonListFilter
${INPUTDATA}/polygon.png ${INPUTDATA}/polygon.png
${INPUTDATA}/polygon-start.kml ${INPUTDATA}/polygon-start.kml
${TEMP}/feTvImageFittingPolygonListFilter_Output.kml ${TEMP}/feTvImageFittingPolygonListFilter_Output.kml
......
...@@ -50,7 +50,6 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[]) ...@@ -50,7 +50,6 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[])
CannyFilterType::Pointer canny = CannyFilterType::New(); CannyFilterType::Pointer canny = CannyFilterType::New();
canny->SetInput(reader->GetOutput()); canny->SetInput(reader->GetOutput());
//Read the original polygon list (kml file) //Read the original polygon list (kml file)
typedef otb::VectorData<> VectorDataType; typedef otb::VectorData<> VectorDataType;
typedef VectorDataType::DataTreeType DataTreeType; typedef VectorDataType::DataTreeType DataTreeType;
...@@ -63,6 +62,7 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[]) ...@@ -63,6 +62,7 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[])
readerVector->SetFileName(polyFileName); readerVector->SetFileName(polyFileName);
readerVector->Update(); readerVector->Update();
//Copy the polygons of the data tree in a polygon list
typedef otb::ObjectList<PolygonType> PolygonListType; typedef otb::ObjectList<PolygonType> PolygonListType;
PolygonListType::Pointer polygonList = PolygonListType::New(); PolygonListType::Pointer polygonList = PolygonListType::New();
...@@ -76,6 +76,7 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[]) ...@@ -76,6 +76,7 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[])
{ {
polygonList->PushBack(dataNode->GetPolygonExteriorRing()); polygonList->PushBack(dataNode->GetPolygonExteriorRing());
} }
++it;
} }
//Fit the polygons on the image //Fit the polygons on the image
...@@ -89,21 +90,17 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[]) ...@@ -89,21 +90,17 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[])
fittingPolygon->Update(); fittingPolygon->Update();
//Read the improved polygon list (kml file) //Write the improved polygon list (kml file)
VectorDataType::Pointer data = VectorDataType::New(); VectorDataType::Pointer data = VectorDataType::New();
DataNodeType::Pointer document = DataNodeType::New(); DataNodeType::Pointer document = DataNodeType::New();
DataNodeType::Pointer folder = DataNodeType::New(); DataNodeType::Pointer folder = DataNodeType::New();
DataNodeType::Pointer polygon = DataNodeType::New();
document->SetNodeType(otb::DOCUMENT); document->SetNodeType(otb::DOCUMENT);
folder->SetNodeType(otb::FOLDER); folder->SetNodeType(otb::FOLDER);
polygon->SetNodeType(otb::FEATURE_POLYGON);
document->SetNodeId("DOCUMENT"); document->SetNodeId("DOCUMENT");
folder->SetNodeId("FOLDER"); folder->SetNodeId("FOLDER");
polygon->SetNodeId("FEATURE_POLYGON");
DataNodeType::Pointer root = data->GetDataTree()->GetRoot()->Get(); DataNodeType::Pointer root = data->GetDataTree()->GetRoot()->Get();
...@@ -114,8 +111,12 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[]) ...@@ -114,8 +111,12 @@ int otbImageFittingPolygonListFilter(int argc, char * argv[])
ListIteratorType listIt = fittingPolygon->GetOutput()->Begin(); ListIteratorType listIt = fittingPolygon->GetOutput()->Begin();
while(listIt != fittingPolygon->GetOutput()->End()) while(listIt != fittingPolygon->GetOutput()->End())
{ {
DataNodeType::Pointer polygon = DataNodeType::New();
polygon->SetNodeType(otb::FEATURE_POLYGON);
polygon->SetNodeId("FEATURE_POLYGON");
polygon->SetPolygonExteriorRing(listIt.Get()); polygon->SetPolygonExteriorRing(listIt.Get());
data->GetDataTree()->Add(polygon,folder); data->GetDataTree()->Add(polygon,folder);
++listIt;
} }
typedef otb::VectorDataFileWriter<VectorDataType> WriterType; typedef otb::VectorDataFileWriter<VectorDataType> WriterType;
......
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