Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Belvire
otb
Commits
b1b6228f
Commit
b1b6228f
authored
16 years ago
by
Jordi Inglada
Browse files
Options
Downloads
Patches
Plain Diff
BUG: revert EdgeDensityExample
parent
3281e6af
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Examples/FeatureExtraction/EdgeDensityExample.cxx
+78
-25
78 additions, 25 deletions
Examples/FeatureExtraction/EdgeDensityExample.cxx
with
78 additions
and
25 deletions
Examples/FeatureExtraction/EdgeDensityExample.cxx
+
78
−
25
View file @
b1b6228f
...
...
@@ -22,9 +22,9 @@ PURPOSE. See the above copyright notices for more information.
#include
"itkRescaleIntensityImageFilter.h"
// Software Guide : BeginCommandLineArgs
// INPUTS: {
amst.pn
g}
// OUTPUTS: {EdgeDensityOutput.
png
}, {PrettyEdgeDensityOutput.png}
//
3 3
0 10 1.0 0.01
// INPUTS: {
suburb2.jpe
g}
// OUTPUTS: {EdgeDensityOutput.
tif
}, {PrettyEdgeDensityOutput.png}
//
7 5
0 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 :
Begin
CodeSnippet
// Software Guide :
End
CodeSnippet
// 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 :
Begin
CodeSnippet
// Software Guide :
End
CodeSnippet
// 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 :
Begin
CodeSnippet
// Software Guide :
End
CodeSnippet
// 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 ou
tput image
type.
// takes as template the input
and output
image type
s
, the edge
//
detector
type
,
and the
c
ou
nt 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 **************/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment