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
01bea962
Commit
01bea962
authored
16 years ago
by
Jordi Inglada
Browse files
Options
Downloads
Patches
Plain Diff
DOC: WIP line segment detector example
parent
06f5b657
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Examples/FeatureExtraction/LineSegmentDetectorExample.cxx
+85
-15
85 additions, 15 deletions
Examples/FeatureExtraction/LineSegmentDetectorExample.cxx
with
85 additions
and
15 deletions
Examples/FeatureExtraction/LineSegmentDetectorExample.cxx
+
85
−
15
View file @
01bea962
...
...
@@ -52,38 +52,108 @@ int main( int argc, char * argv[] )
const
unsigned
int
Dimension
=
2
;
typedef
otb
::
Image
<
InputPixelType
,
Dimension
>
InputImageType
;
typedef
otb
::
ImageFileReader
<
InputImageType
>
ReaderType
;
// Software Guide : BeginLatex
//
// As usual, we start by defining the types for the input image and
// the image file reader.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef
otb
::
Image
<
InputPixelType
,
Dimension
>
ImageType
;
typedef
otb
::
ImageFileReader
<
ImageType
>
ReaderType
;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We instantiate the reader and set the file name for the input image.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ReaderType
::
Pointer
reader
=
ReaderType
::
New
();
reader
->
SetFileName
(
infname
);
typedef
otb
::
LineSegmentDetector
<
InputImageType
,
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We define now the type for the segment detector filter. It is
// templated over the input image type and the precision with which
// the coordinates of the detected segments will be given. It is
// recommended to set this precision to a real type. The output of the
// filter will be a list of \doxygen{itk}{LineSpatialObject}s.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef
otb
::
LineSegmentDetector
<
ImageType
,
PrecisionType
>
LsdFilterType
;
LsdFilterType
::
Pointer
lsdFilter
=
lsdFilterType
::
New
();
LsdFilterType
::
Pointer
lsdFilter
=
LsdFilterType
::
New
();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// In order to be able to display the results, we will draw the
// detected segments on top of the input image. For this matter, we
// will use the \doxygen{otb}{DrawLineSpatialObjectListFilter} which
// is templated over the input and output image types.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef
otb
::
DrawLineSpatialObjectListFilter
<
Input
ImageType
,
Input
ImageType
>
DrawLineListType
;
typedef
otb
::
DrawLineSpatialObjectListFilter
<
ImageType
,
ImageType
>
DrawLineListType
;
DrawLineListType
::
Pointer
drawLineFilter
=
DrawLineListType
::
New
();
reader
->
GenerateOutputInformation
();
lsdFilter
->
SetInput
(
reader
->
GetOutput
());
drawLineFilter
->
SetInput
(
reader
->
GetOutput
());
drawLineFilter
->
SetInputLineSpatialObjectList
(
lsdFilter
->
GetOutput
());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We can now define the type for the writer, instantiate it and set
// the file name for the output image.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef
otb
::
ImageFileWriter
<
InputImageType
>
WriterType
;
typedef
otb
::
ImageFileWriter
<
ImageType
>
WriterType
;
WriterType
::
Pointer
writer
=
WriterType
::
New
();
writer
->
SetFileName
(
outfname
);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We plug the pipeline.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
lsdFilter
->
SetInput
(
reader
->
GetOutput
());
writer
->
SetInput
(
drawLineFilter
->
GetOutput
());
drawLineFilter
->
SetInput
(
reader
->
GetOutput
());
drawLineFilter
->
SetInputLineSpatialObjectList
(
lsdFilter
->
GetOutput
());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Before calling the \code{Update()} method of the writer in order to
// trigger the pipeline execution, we call the
// \doxygen{GenerateOutputInformation()} of the reader, so the LSD
// filter gets the information about image size and spacing.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
reader
->
GenerateOutputInformation
();
writer
->
Update
();
...
...
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