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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
David Youssefi
otb
Commits
93da592e
Commit
93da592e
authored
13 years ago
by
Julien Malik
Browse files
Options
Downloads
Patches
Plain Diff
ENH: LineSegmentDetection - do the amplitude conversion inside appli, and rescale image to 0-255
parent
e341e571
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
FeatureExtraction/otbLineSegmentDetection.cxx
+37
-8
37 additions, 8 deletions
FeatureExtraction/otbLineSegmentDetection.cxx
with
37 additions
and
8 deletions
FeatureExtraction/otbLineSegmentDetection.cxx
+
37
−
8
View file @
93da592e
...
...
@@ -19,10 +19,14 @@
#include
"otbStreamingLineSegmentDetector.h"
#include
"otbImage.h"
#include
"otbVectorImage.h"
#include
"otbVectorImageToAmplitudeImageFilter.h"
#include
"otbVectorData.h"
#include
"otbImageFileReader.h"
#include
"otbVectorDataFileWriter.h"
#include
"otbStandardFilterWatcher.h"
#include
"otbStreamingStatisticsImageFilter.h"
#include
"itkShiftScaleImageFilter.h"
#include
"otbVectorDataProjectionFilter.h"
#include
"otbVectorDataTransformFilter.h"
...
...
@@ -50,13 +54,23 @@ int LineSegmentDetection::Execute(otb::ApplicationOptionsResult* parseResult)
typedef
float
InputPixelType
;
const
unsigned
int
Dimension
=
2
;
typedef
otb
::
Image
<
InputPixelType
,
Dimension
>
ImageType
;
typedef
otb
::
ImageFileReader
<
ImageType
>
ReaderType
;
typedef
otb
::
VectorImage
<
InputPixelType
,
Dimension
>
VectorImageType
;
typedef
otb
::
ImageFileReader
<
VectorImageType
>
ReaderType
;
typedef
otb
::
VectorData
<
double
,
Dimension
>
VectorDataType
;
typedef
VectorDataType
::
Pointer
VectorDataPointerType
;
typedef
otb
::
VectorDataFileWriter
<
VectorDataType
>
VectorDataFileWriterType
;
typedef
VectorDataFileWriterType
::
Pointer
VectorDataFileWriterPointerType
;
typedef
otb
::
VectorImageToAmplitudeImageFilter
<
VectorImageType
,
ImageType
>
VectorImageToAmplitudeImageFilterType
;
typedef
otb
::
StreamingStatisticsImageFilter
<
ImageType
>
StreamingStatisticsImageFilterType
;
typedef
itk
::
ShiftScaleImageFilter
<
ImageType
,
ImageType
>
ShiftScaleImageFilterType
;
typedef
otb
::
StreamingLineSegmentDetector
<
ImageType
>::
FilterType
LSDFilterType
;
...
...
@@ -64,11 +78,26 @@ int LineSegmentDetection::Execute(otb::ApplicationOptionsResult* parseResult)
reader
->
SetFileName
(
parseResult
->
GetInputImage
());
reader
->
UpdateOutputInformation
();
ImageType
::
Pointer
inputImage
=
reader
->
GetOutput
();
VectorImageToAmplitudeImageFilterType
::
Pointer
amplitudeConverter
=
VectorImageToAmplitudeImageFilterType
::
New
();
amplitudeConverter
->
SetInput
(
reader
->
GetOutput
());
StreamingStatisticsImageFilterType
::
Pointer
stats
=
StreamingStatisticsImageFilterType
::
New
();
stats
->
SetInput
(
amplitudeConverter
->
GetOutput
());
stats
->
Update
();
InputPixelType
min
=
stats
->
GetMinimum
();
InputPixelType
max
=
stats
->
GetMaximum
();
ShiftScaleImageFilterType
::
Pointer
shiftScale
=
ShiftScaleImageFilterType
::
New
();
shiftScale
->
SetInput
(
amplitudeConverter
->
GetOutput
());
shiftScale
->
SetShift
(
-
min
);
shiftScale
->
SetScale
(
255.0
/
(
max
-
min
)
);
LSDFilterType
::
Pointer
lsd
=
LSDFilterType
::
New
();
lsd
->
GetFilter
()
->
SetInput
(
inputImage
);
lsd
->
GetFilter
()
->
SetInput
(
shiftScale
->
GetOutput
()
);
otb
::
StandardFilterWatcher
watcher
(
lsd
->
GetStreamer
(),
"Line Segment Detection"
);
lsd
->
Update
();
...
...
@@ -82,8 +111,8 @@ int LineSegmentDetection::Execute(otb::ApplicationOptionsResult* parseResult)
* We need to reproject in WGS84 if the input image is in sensor model geometry
*/
std
::
string
projRef
=
inputImage
->
GetProjectionRef
();
ImageKeywordlist
kwl
=
inputImage
->
GetImageKeywordlist
();
std
::
string
projRef
=
reader
->
GetOutput
()
->
GetProjectionRef
();
ImageKeywordlist
kwl
=
reader
->
GetOutput
()
->
GetImageKeywordlist
();
VectorDataType
::
Pointer
vd
=
lsd
->
GetFilter
()
->
GetOutputVectorData
();
VectorDataType
::
Pointer
projectedVD
=
vd
;
...
...
@@ -98,9 +127,9 @@ int LineSegmentDetection::Execute(otb::ApplicationOptionsResult* parseResult)
VectorDataProjectionFilterType
::
Pointer
vproj
=
VectorDataProjectionFilterType
::
New
();
vproj
->
SetInput
(
vd
);
vproj
->
SetInputKeywordList
(
inputImage
->
GetImageKeywordlist
());
vproj
->
SetInputOrigin
(
inputImage
->
GetOrigin
());
vproj
->
SetInputSpacing
(
inputImage
->
GetSpacing
());
vproj
->
SetInputKeywordList
(
reader
->
GetOutput
()
->
GetImageKeywordlist
());
vproj
->
SetInputOrigin
(
reader
->
GetOutput
()
->
GetOrigin
());
vproj
->
SetInputSpacing
(
reader
->
GetOutput
()
->
GetSpacing
());
if
(
parseResult
->
IsOptionPresent
(
"DEMDirectory"
)
)
{
...
...
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