Commit c580136b authored by Julien Michel's avatar Julien Michel
Browse files

Dernière corrections extraction de route.

parent 38ca096b
......@@ -188,7 +188,7 @@ int main( int argc, char * argv[] )
// Software Guide : BeginCodeSnippet
double sigma = alpha*(1.2/resolution+1);
typedef itk::GradientRecursiveGaussianImageFilter<InternalImageType,
VectorImageType> GradientFilterType;
VectorImageType> GradientFilterType;
GradientFilterType::Pointer gradientFilter = GradientFilterType::New();
gradientFilter->SetSigma(sigma);
gradientFilter->SetInput(sqrtFilter->GetOutput());
......@@ -207,7 +207,8 @@ int main( int argc, char * argv[] )
// Software Guide : BeginCodeSnippet
typedef otb::NeighborhoodScalarProductFilter<VectorImageType,
InternalImageType,InternalImageType> NeighborhoodScalarProductType;
NeighborhoodScalarProductType::Pointer scalarFilter = NeighborhoodScalarProductType::New();
NeighborhoodScalarProductType::Pointer scalarFilter
= NeighborhoodScalarProductType::New();
scalarFilter->SetInput(gradientFilter->GetOutput());
// Software Guide : EndCodeSnippet
......@@ -227,7 +228,8 @@ int main( int argc, char * argv[] )
RemoveIsolatedByDirectionType::Pointer removeIsolatedByDirectionFilter
= RemoveIsolatedByDirectionType::New();
removeIsolatedByDirectionFilter->SetInput(scalarFilter->GetOutput());
removeIsolatedByDirectionFilter->SetInputDirection(scalarFilter->GetOutputDirection());
removeIsolatedByDirectionFilter
->SetInputDirection(scalarFilter->GetOutputDirection());
// Software Guide : EndCodeSnippet
......@@ -242,7 +244,8 @@ int main( int argc, char * argv[] )
// Software Guide : BeginCodeSnippet
typedef otb::RemoveWrongDirectionFilter<InternalImageType,
InternalImageType,InternalImageType> RemoveWrongDirectionType;
RemoveWrongDirectionType::Pointer removeWrongDirectionFilter = RemoveWrongDirectionType::New();
RemoveWrongDirectionType::Pointer removeWrongDirectionFilter
= RemoveWrongDirectionType::New();
removeWrongDirectionFilter->SetInput(removeIsolatedByDirectionFilter->GetOutput());
removeWrongDirectionFilter->SetInputDirection(scalarFilter->GetOutputDirection());
......@@ -261,7 +264,8 @@ int main( int argc, char * argv[] )
NonMaxRemovalByDirectionType::Pointer nonMaxRemovalByDirectionFilter
= NonMaxRemovalByDirectionType::New();
nonMaxRemovalByDirectionFilter->SetInput(removeWrongDirectionFilter->GetOutput());
nonMaxRemovalByDirectionFilter->SetInputDirection(scalarFilter->GetOutputDirection());
nonMaxRemovalByDirectionFilter
->SetInputDirection(scalarFilter->GetOutputDirection());
// Software Guide : EndCodeSnippet
......@@ -274,7 +278,8 @@ int main( int argc, char * argv[] )
// Software Guide : BeginCodeSnippet
typedef otb::VectorizationPathListFilter<InternalImageType,
InternalImageType,PathType> VectorizationFilterType;
VectorizationFilterType::Pointer vectorizationFilter = VectorizationFilterType::New();
VectorizationFilterType::Pointer vectorizationFilter
= VectorizationFilterType::New();
vectorizationFilter->SetInput(nonMaxRemovalByDirectionFilter->GetOutput());
vectorizationFilter->SetInputDirection(scalarFilter->GetOutputDirection());
vectorizationFilter->SetAmplitudeThreshold(atof(argv[8]));
......@@ -299,7 +304,8 @@ int main( int argc, char * argv[] )
simplifyPathListFilter->SetInput(vectorizationFilter->GetOutput());
typedef otb::BreakAngularPathListFilter<PathType> BreakAngularPathType;
BreakAngularPathType::Pointer breakAngularPathListFilter = BreakAngularPathType::New();
BreakAngularPathType::Pointer breakAngularPathListFilter
= BreakAngularPathType::New();
breakAngularPathListFilter->SetMaxAngle(M_PI/8.);
breakAngularPathListFilter->SetInput(simplifyPathListFilter->GetOutput());
......@@ -323,7 +329,7 @@ int main( int argc, char * argv[] )
// Software Guide : BeginCodeSnippet
typedef otb::LinkPathListFilter<PathType> LinkPathType;
LinkPathType::Pointer linkPathListFilter = LinkPathType::New();
linkPathListFilter->SetDistanceThreshold(25.0/resolution);//research area of 25 m
linkPathListFilter->SetDistanceThreshold(25.0/resolution);
linkPathListFilter->SetAngularThreshold(M_PI/8);
linkPathListFilter->SetInput(removeTortuousPathListFilter->GetOutput());
......@@ -366,7 +372,8 @@ int main( int argc, char * argv[] )
// Software Guide : BeginCodeSnippet
InternalImageType::Pointer output = InternalImageType::New();
output->SetRegions(multispectralReader->GetOutput()->GetLargestPossibleRegion());
output->SetRegions(multispectralReader->GetOutput()
->GetLargestPossibleRegion());
output->Allocate();
output->FillBuffer(0.0);
......
......@@ -60,6 +60,10 @@
#include "itkRescaleIntensityImageFilter.h"
#include "otbMath.h"
#include "itkInvertIntensityImageFilter.h"
#include "itkGrayscaleDilateImageFilter.h"
#include "itkBinaryBallStructuringElement.h"
int main( int argc, char * argv[] )
{
......@@ -370,30 +374,49 @@ int main( int argc, char * argv[] )
//
// Software Guide : EndLatex
writer->SetFileName(argv[2]);
// Software Guide : BeginCodeSnippet
roadExtractionFilter->SetInput(reader->GetOutput());
drawingFilter->SetInput(blackBackground);
drawingFilter->SetInputPath(roadExtractionFilter->GetOutput());
rescaleFilter->SetInput(drawingFilter->GetOutput());
writer->SetInput(rescaleFilter->GetOutput());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// The update of the pipeline is triggered by the \code{Update()} method
// of the writing filter.
// of the rescale intensity filter.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
writer->Update();
rescaleFilter->Update();
// Software Guide : EndCodeSnippet
// output image enhancement
typedef itk::BinaryBallStructuringElement<OutputPixelType,Dimension> StructuringElementType;
typedef itk::GrayscaleDilateImageFilter<OutputImageType,OutputImageType,StructuringElementType> DilateFilterType;
typedef itk::InvertIntensityImageFilter<OutputImageType,OutputImageType> InvertFilterType;
StructuringElementType se;
se.SetRadius(1);
se.CreateStructuringElement();
DilateFilterType::Pointer dilater = DilateFilterType::New();
dilater->SetInput(rescaleFilter->GetOutput());
dilater->SetKernel(se);
InvertFilterType::Pointer invertFilter = InvertFilterType::New();
invertFilter->SetInput(dilater->GetOutput());
writer->SetFileName(argv[2]);
writer->SetInput(invertFilter->GetOutput());
writer->Update();
// Software Guide : BeginLatex
//
......@@ -401,8 +424,8 @@ int main( int argc, char * argv[] )
// the road extraction filter to a fusionned Quickbird image.
// \begin{figure}
// \center
// \includegraphics[width=0.25\textwidth]{qb_ExtractRoad_pretty.eps}
// \includegraphics[width=0.25\textwidth]{ExtractRoadOutput.eps}
// \includegraphics[width=0.44\textwidth]{qb_ExtractRoad_pretty.eps}
// \includegraphics[width=0.44\textwidth]{ExtractRoadOutput.eps}
// \itkcaption[Road extraction filter application]{Result of applying
// the \doxygen{otb}{RoadExtractionFilter} to a fusionned Quickbird
// image. From left to right : original image, extracted road with their
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment