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
bf6f493c
Commit
bf6f493c
authored
14 years ago
by
Manuel Grizonnet
Browse files
Options
Downloads
Patches
Plain Diff
ADD:Test for otbScalarImageToPanTexTextureFilter
parent
67c24fbc
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
Testing/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.cxx
+86
-0
86 additions, 0 deletions
...FeatureExtraction/otbScalarImageToPanTexTextureFilter.cxx
with
86 additions
and
0 deletions
Testing/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.cxx
0 → 100644
+
86
−
0
View file @
bf6f493c
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include
"itkExceptionObject.h"
#include
"otbScalarImageToPanTexTextureFilter.h"
#include
"itkMinimumMaximumImageCalculator.h"
#include
"otbImage.h"
#include
"otbImageFileReader.h"
#include
"otbImageFileWriter.h"
#include
"otbStandardFilterWatcher.h"
int
otbScalarImageToPanTexTextureFilter
(
int
argc
,
char
*
argv
[])
{
if
(
argc
!=
5
)
{
std
::
cerr
<<
"Usage: "
<<
argv
[
0
]
<<
" infname outprefix nbBins radius"
<<
std
::
endl
;
return
EXIT_FAILURE
;
}
const
char
*
infname
=
argv
[
1
];
const
char
*
outprefix
=
argv
[
2
];
const
unsigned
int
nbBins
=
atoi
(
argv
[
3
]);
const
unsigned
int
radius
=
atoi
(
argv
[
4
]);
const
unsigned
int
Dimension
=
2
;
typedef
float
PixelType
;
typedef
otb
::
Image
<
PixelType
,
Dimension
>
ImageType
;
typedef
otb
::
ScalarImageToPanTexTextureFilter
<
ImageType
,
ImageType
>
PanTexTextureFilterType
;
typedef
otb
::
ImageFileReader
<
ImageType
>
ReaderType
;
typedef
otb
::
ImageFileWriter
<
ImageType
>
WriterType
;
typedef
itk
::
MinimumMaximumImageCalculator
<
ImageType
>
MinMaxCalculatorType
;
ReaderType
::
Pointer
reader
=
ReaderType
::
New
();
PanTexTextureFilterType
::
Pointer
filter
=
PanTexTextureFilterType
::
New
();
WriterType
::
Pointer
writer
=
WriterType
::
New
();
// Read image
reader
->
SetFileName
(
infname
);
reader
->
Update
();
// Build radius
PanTexTextureFilterType
::
SizeType
sradius
;
sradius
.
Fill
(
radius
);
filter
->
SetInput
(
reader
->
GetOutput
());
filter
->
SetNumberOfBinsPerAxis
(
nbBins
);
filter
->
SetRadius
(
sradius
);
otb
::
StandardFilterWatcher
watcher
(
filter
,
"Textures filter"
);
// Compute min/max
MinMaxCalculatorType
::
Pointer
minMax
=
MinMaxCalculatorType
::
New
();
minMax
->
SetImage
(
reader
->
GetOutput
());
minMax
->
Compute
();
filter
->
SetInputImageMinimum
(
minMax
->
GetMinimum
());
filter
->
SetInputImageMaximum
(
minMax
->
GetMaximum
());
filter
->
Update
();
// Write outputs
itk
::
OStringStream
oss
;
oss
.
str
(
""
);
oss
<<
outprefix
<<
"PanTex.tif"
;
writer
->
SetInput
(
filter
->
GetOutput
());
writer
->
SetFileName
(
oss
.
str
());
writer
->
Update
();
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