Skip to content
Snippets Groups Projects
Commit b1b6228f authored by Jordi Inglada's avatar Jordi Inglada
Browse files

BUG: revert EdgeDensityExample

parent 3281e6af
No related branches found
No related tags found
No related merge requests found
......@@ -22,9 +22,9 @@ PURPOSE. See the above copyright notices for more information.
#include "itkRescaleIntensityImageFilter.h"
// Software Guide : BeginCommandLineArgs
// INPUTS: {amst.png}
// OUTPUTS: {EdgeDensityOutput.png}, {PrettyEdgeDensityOutput.png}
// 3 30 10 1.0 0.01
// INPUTS: {suburb2.jpeg}
// OUTPUTS: {EdgeDensityOutput.tif}, {PrettyEdgeDensityOutput.png}
// 7 50 10 1.0 0.01
// Software Guide : EndCommandLineArgs
// Software Guide : BeginLatex
......@@ -93,7 +93,7 @@ int main(int argc, char* argv[] )
typedef otb::Image< PixelType, Dimension > ImageType;
typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::ImageFileWriter<ImageType> WriterType;
// Software Guide : BeginCodeSnippet
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We define now the type for the function which will be used by the
......@@ -105,7 +105,7 @@ int main(int argc, char* argv[] )
// Software Guide : BeginCodeSnippet
typedef otb::BinaryImageDensityFunction<ImageType> CountFunctionType;
// Software Guide : BeginCodeSnippet
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// These {\em non null pixels} will be the result of an edge
......@@ -118,12 +118,12 @@ int main(int argc, char* argv[] )
typedef itk::CannyEdgeDetectionImageFilter<ImageType, ImageType>
CannyDetectorType;
// Software Guide : BeginCodeSnippet
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Finally, we can define the type for the edge density filter which
// takes as template the input image type, the edge detector type,
// the count fucntion type and the output image type.
// takes as template the input and output image types, the edge
// detector type, and the count fucntion type..
//
// Software Guide : EndLatex
......@@ -131,29 +131,82 @@ int main(int argc, char* argv[] )
typedef otb::EdgeDensityImageFilter<ImageType, ImageType, CannyDetectorType,
CountFunctionType> EdgeDensityFilterType;
/**Instancitation of an object*/
EdgeDensityFilterType::Pointer filter = EdgeDensityFilterType::New();
ReaderType::Pointer reader = ReaderType::New();
CannyDetectorType::Pointer CannyFilter = CannyDetectorType::New();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We can now instantiate the different processing objects of the
// pipeline using the \code{New()} method.
//
// Software Guide : EndLatex
/** Set The input*/
reader->SetFileName(infname);
filter->SetInput(reader->GetOutput());
/** Update the Canny Filter Information*/
CannyFilter->SetUpperThreshold(upperThreshold);
CannyFilter->SetLowerThreshold(lowerThreshold);
CannyFilter->SetVariance(variance);
CannyFilter->SetMaximumError(maximumError);
// Software Guide : BeginCodeSnippet
ReaderType::Pointer reader = ReaderType::New();
EdgeDensityFilterType::Pointer filter = EdgeDensityFilterType::New();
CannyDetectorType::Pointer cannyFilter = CannyDetectorType::New();
WriterType::Pointer writer = WriterType::New();
filter->SetDetector(CannyFilter);
/** Write the output*/
WriterType::Pointer writer = WriterType::New();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// The edge detection filter needs to be instantiated because we
// need to set its parameters. This is what we do here for the Canny
// filter.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
cannyFilter->SetUpperThreshold(upperThreshold);
cannyFilter->SetLowerThreshold(lowerThreshold);
cannyFilter->SetVariance(variance);
cannyFilter->SetMaximumError(maximumError);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// After that, we can pass the edge detector to the filter which
// will be used it internally.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter->SetDetector(cannyFilter);
filter->SetNeighborhoodRadius( radius );
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Finally, we set the file names for the input and the output
// images and we plug the pipeline. The \code{Update()} method of
// the writer will trigger the processing.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
reader->SetFileName(infname);
writer->SetFileName(outfname);
filter->SetInput(reader->GetOutput());
writer->SetInput(filter->GetOutput());
writer->Update();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
// Figure~\ref{fig:EDGEDENSITY_FILTER} shows the result of applying
// the edge density filter to an image.
// \begin{figure}
// \center
// \includegraphics[width=0.25\textwidth]{suburb2.eps}
// \includegraphics[width=0.25\textwidth]{PrettyEdgeDensityOutput.eps}
// \itkcaption[Edge Density Filter]{Result of applying the
// \doxygen{otb}{EdgeDensityImageFilter} to an image. From left to right :
// original image, edge density.}
// \label{fig:EDGEDENSITY_FILTER}
// \end{figure}
//
// Software Guide : EndLatex
/************* Image for printing **************/
......
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