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
99b8eca1
Commit
99b8eca1
authored
16 years ago
by
Julien Michel
Browse files
Options
Downloads
Patches
Plain Diff
Exemples de la formation
parents
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
Utils/otbConcatenateImages.cxx
+100
-0
100 additions, 0 deletions
Utils/otbConcatenateImages.cxx
with
100 additions
and
0 deletions
Utils/otbConcatenateImages.cxx
0 → 100755
+
100
−
0
View file @
99b8eca1
#include
<iostream>
#include
"otbImage.h"
#include
"otbVectorImage.h"
#include
"otbImageFileReader.h"
#include
"otbObjectList.h"
#include
"otbImageList.h"
#include
"otbImageListToVectorImageFilter.h"
#include
"otbStreamingImageFileWriter.h"
#include
"otbCommandLineArgumentParser.h"
int
main
(
int
argc
,
char
**
argv
)
{
// Parse command line parameters
typedef
otb
::
CommandLineArgumentParser
ParserType
;
ParserType
::
Pointer
parser
=
ParserType
::
New
();
parser
->
AddOutputImage
();
parser
->
AddOption
(
"--InputImagesList"
,
"Images list to concatenate"
,
"-il"
,
argc
-
4
,
true
);
typedef
otb
::
CommandLineArgumentParseResult
ParserResultType
;
ParserResultType
::
Pointer
parseResult
=
ParserResultType
::
New
();
try
{
parser
->
ParseCommandLine
(
argc
,
argv
,
parseResult
);
}
catch
(
itk
::
ExceptionObject
&
err
)
{
return
EXIT_SUCCESS
;
}
const
unsigned
int
NbImages
=
argc
-
4
;
std
::
cout
<<
"Concat of "
<<
NbImages
<<
" images into a multi-band image "
<<
std
::
endl
;
typedef
unsigned
short
int
PixelType
;
const
unsigned
int
Dimension
=
2
;
typedef
otb
::
Image
<
PixelType
,
Dimension
>
InputImageType
;
typedef
otb
::
ImageFileReader
<
InputImageType
>
ImageReaderType
;
typedef
otb
::
ObjectList
<
ImageReaderType
>
ReaderListType
;
ReaderListType
::
Pointer
readerList
=
ReaderListType
::
New
();
typedef
otb
::
ImageList
<
InputImageType
>
ImageListType
;
ImageListType
::
Pointer
imageList
=
ImageListType
::
New
();
for
(
unsigned
int
i
=
0
;
i
<
NbImages
;
i
++
)
{
ImageReaderType
::
Pointer
imageReader
=
ImageReaderType
::
New
();
imageReader
->
SetFileName
(
parseResult
->
GetParameterString
(
"--InputImagesList"
,
i
).
c_str
()
);
std
::
cout
<<
"Adding image "
<<
parseResult
->
GetParameterString
(
"--InputImagesList"
,
i
).
c_str
()
<<
std
::
endl
;
imageReader
->
UpdateOutputInformation
();
imageList
->
PushBack
(
imageReader
->
GetOutput
()
);
readerList
->
PushBack
(
imageReader
);
}
typedef
otb
::
VectorImage
<
PixelType
,
Dimension
>
VectorImageType
;
typedef
otb
::
ImageListToVectorImageFilter
<
ImageListType
,
VectorImageType
>
ImageListToVectorImageFilterType
;
ImageListToVectorImageFilterType
::
Pointer
iL2VI
=
ImageListToVectorImageFilterType
::
New
();
iL2VI
->
SetInput
(
imageList
);
typedef
otb
::
StreamingImageFileWriter
<
VectorImageType
>
ImageWriterType
;
ImageWriterType
::
Pointer
imageWriter
=
ImageWriterType
::
New
();
imageWriter
->
SetFileName
(
parseResult
->
GetOutputImage
().
c_str
());
unsigned
long
size
=
(
10000
*
10000
*
sizeof
(
PixelType
))
/
NbImages
;
std
::
cout
<<
"Streaming size: "
<<
size
<<
std
::
endl
;
imageWriter
->
SetBufferMemorySize
(
size
);
imageWriter
->
SetInput
(
iL2VI
->
GetOutput
()
);
imageWriter
->
Update
();
return
0
;
}
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