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

ENH: Adding polygons simplification and stitching

parent 6e2145b6
Branches
Tags
No related merge requests found
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
#include "otbStreamingVectorizedSegmentationOGR.h" #include "otbStreamingVectorizedSegmentationOGR.h"
#include "otbOGRDataSourceWrapper.h" #include "otbOGRDataSourceWrapper.h"
// Fusion filter
#include "otbFusionOGRTileFilter.h"
namespace otb namespace otb
{ {
namespace Wrapper namespace Wrapper
...@@ -84,6 +87,10 @@ public: ...@@ -84,6 +87,10 @@ public:
ConnectedComponentSegmentationFilterType> ConnectedComponentSegmentationFilterType>
ConnectedComponentStreamingVectorizedSegmentationOGRType; ConnectedComponentStreamingVectorizedSegmentationOGRType;
typedef otb::FusionOGRTileFilter
<FloatVectorImageType> FusionFilterType;
/** Standard macro */ /** Standard macro */
itkNewMacro(Self); itkNewMacro(Self);
itkTypeMacro(LargeScaleSegmentation, otb::Application); itkTypeMacro(LargeScaleSegmentation, otb::Application);
...@@ -139,6 +146,9 @@ private: ...@@ -139,6 +146,9 @@ private:
SetDefaultParameterInt("filter.meanshiftedison.minsize", 100); SetDefaultParameterInt("filter.meanshiftedison.minsize", 100);
SetDefaultParameterFloat("filter.meanshiftedison.scale", 100000.); SetDefaultParameterFloat("filter.meanshiftedison.scale", 100000.);
AddParameter(ParameterType_Empty,"stitch","Stich polygons at tiles borders");
MandatoryOff("stitch");
// AddChoice("filter.meanshift", "MeanShift"); // AddChoice("filter.meanshift", "MeanShift");
// SetParameterDescription( // SetParameterDescription(
// "filter.meanshift", // "filter.meanshift",
...@@ -377,6 +387,20 @@ private: ...@@ -377,6 +387,20 @@ private:
ogrDS->SyncToDisk(); ogrDS->SyncToDisk();
SetParameterOutputImage<LabelImageType> ("lout", m_LabelImage); SetParameterOutputImage<LabelImageType> ("lout", m_LabelImage);
// Stitching mode
if(IsParameterEnabled("stitch"))
{
otbAppLogINFO(<<"Segmentation done, stiching polygons ...");
FusionFilterType::Pointer fusionFilter = FusionFilterType::New();
fusionFilter->SetInput(GetParameterFloatVectorImage("in"));
fusionFilter->SetOGRDataSource(ogrDS);
FloatVectorImageType::SizeType streamSize;
streamSize.Fill(tileSize);
std::cout<<"Stream size: "<<streamSize<<std::endl;
fusionFilter->SetStreamSize(streamSize);
fusionFilter->SetLayerName(layerName);
fusionFilter->GenerateData();
}
} }
LabelImageType::Pointer m_LabelImage; LabelImageType::Pointer m_LabelImage;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment