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
Main Repositories
otb
Commits
1acca180
Commit
1acca180
authored
15 years ago
by
Manuel Grizonnet
Browse files
Options
Downloads
Patches
Plain Diff
DOC:obia
parent
a1a6bf5c
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/OBIA/otbRadiometricAttributesLabelMapFilterExample.cxx
+42
-7
42 additions, 7 deletions
...es/OBIA/otbRadiometricAttributesLabelMapFilterExample.cxx
with
42 additions
and
7 deletions
Examples/OBIA/otbRadiometricAttributesLabelMapFilterExample.cxx
+
42
−
7
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
;
}
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