Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
273
Issues
273
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
1acca180
Commit
1acca180
authored
Jan 09, 2010
by
Manuel Grizonnet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DOC:obia
parent
a1a6bf5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
7 deletions
+42
-7
Examples/OBIA/otbRadiometricAttributesLabelMapFilterExample.cxx
...es/OBIA/otbRadiometricAttributesLabelMapFilterExample.cxx
+42
-7
No files found.
Examples/OBIA/otbRadiometricAttributesLabelMapFilterExample.cxx
View file @
1acca180
...
...
@@ -26,7 +26,7 @@
// This example shows the basic approch to perform object based analysis on a image.
// The input image is firstly segmented using the \doxygen{otb}{MeanShiftImageFilter}
// Then each segmented region is converted to a Map of labeled objects.
// After the \doxygen{otb}{RadiometricAttributesLabelMapFilter} computes
computes
// After the \doxygen{otb}{RadiometricAttributesLabelMapFilter} computes
// radiometric attributes for each object.
// Images are supposed to be standard 4-bands image (B,G,R,NIR). The
// index of each channel can be set via the Set***ChannelIndex()
...
...
@@ -129,11 +129,12 @@ int main(int argc, char * argv[])
// types.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter
->
SetInput
(
reader
->
GetOutput
());
// Software Guide : EndCodeSnippet
LabelMapFilterType
::
Pointer
labelMapFilter
=
LabelMapFilterType
::
New
();
labelMapFilter
->
SetInput
(
filter
->
GetLabeledClusteredOutput
());
labelMapFilter
->
SetBackgroundValue
(
itk
::
NumericTraits
<
LabelType
>::
m
ax
());
labelMapFilter
->
SetBackgroundValue
(
itk
::
NumericTraits
<
LabelType
>::
m
in
());
ShapeLabelMapFilterType
::
Pointer
shapeLabelMapFilter
=
ShapeLabelMapFilterType
::
New
();
shapeLabelMapFilter
->
SetInput
(
labelMapFilter
->
GetOutput
());
...
...
@@ -143,28 +144,62 @@ int main(int argc, char * argv[])
statisticsLabelMapFilter
->
SetInput2
(
reader
->
GetOutput
());
statisticsLabelMapFilter
->
Update
();
// Software Guide : BeginLatex
//
// Instantiate the \doxygen{otb}{RadiometricAttributesLabelMapFilter} to
// compute radiometric value on each label object.
//
// Software Guide : EndLatex
RadiometricLabelMapFilterType
::
Pointer
radiometricLabelMapFilter
=
RadiometricLabelMapFilterType
::
New
();
radiometricLabelMapFilter
->
SetInput1
(
statisticsLabelMapFilter
->
GetOutput
());
radiometricLabelMapFilter
->
SetInput2
(
vreader
->
GetOutput
());
// Software Guide : BeginLatex
//
// Then, we specify the red and the near infrared channels
//
//
// Software Guide : EndLatex
radiometricLabelMapFilter
->
SetRedChannelIndex
(
2
);
radiometricLabelMapFilter
->
SetNIRChannelIndex
(
3
);
radiometricLabelMapFilter
->
Update
();
// Software Guide : BeginLatex
//
// The \doxygen{otb}{AttributesMapOpeningLabelMapFilter} will proceed the selection.
// There are three parameters. \code{AttributeName} specifies the radiometric attribute, \code{Lambda}
// controls the thresholding of the input and \code{ReverseOrdering} make this filter to remove the
// object with an attribute value greater than \code{Lambda} instead.
//
//
// Software Guide : EndLatex
OpeningLabelMapFilterType
::
Pointer
opening
=
OpeningLabelMapFilterType
::
New
();
opening
->
SetInput
(
radiometricLabelMapFilter
->
GetOutput
());
opening
->
SetAttributeName
(
attr
);
opening
->
SetReverseOrdering
(
lowerThan
);
opening
->
SetLambda
(
thresh
);
opening
->
SetReverseOrdering
(
lowerThan
);
// Software Guide : BeginLatex
//
// Then, Label object selected are transform in a Label Image using the \doxygen{itk}{LabelMapToLabelImageFilter}
//
//
// Software Guide : EndLatex
LabelMapToLabeledImageFilterType
::
Pointer
labelMap2LabeledImage
=
LabelMapToLabeledImageFilterType
::
New
();
labelMap2LabeledImage
->
SetInput
(
opening
->
GetOutput
());
// Software Guide : BeginLatex
//
// And finally, we declare the writer and call its \code{Update()} method to
// trigger the full pipeline execution.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
WriterType
::
Pointer
writer
=
WriterType
::
New
();
writer
->
SetFileName
(
outfname
);
writer
->
SetInput
(
labelMap2LabeledImage
->
GetOutput
());
writer
->
Update
();
// Software Guide : EndCodeSnippet
return
EXIT_SUCCESS
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment