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
Antoine Belvire
otb
Commits
a11120cd
Commit
a11120cd
authored
15 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Ikonos gain parameter
parent
57325eb7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/IO/otbImageMetadataInterface.cxx
+88
-21
88 additions, 21 deletions
Code/IO/otbImageMetadataInterface.cxx
Code/IO/otbImageMetadataInterface.h
+3
-0
3 additions, 0 deletions
Code/IO/otbImageMetadataInterface.h
with
91 additions
and
21 deletions
Code/IO/otbImageMetadataInterface.cxx
+
88
−
21
View file @
a11120cd
...
...
@@ -509,6 +509,21 @@ std::string ImageMetadataInterface::GetSensorID( const MetaDataDictionaryType &
return
output
;
}
unsigned
int
ImageMetadataInterface
::
GetNumberOfBands
(
const
MetaDataDictionaryType
&
dict
)
const
{
ImageKeywordlistType
ImageKeywordlist
;
if
(
dict
.
HasKey
(
MetaDataKey
::
OSSIMKeywordlistKey
))
{
itk
::
ExposeMetaData
<
ImageKeywordlistType
>
(
dict
,
MetaDataKey
::
OSSIMKeywordlistKey
,
ImageKeywordlist
);
}
ossimKeywordlist
kwl
;
ImageKeywordlist
.
convertToOSSIMKeywordlist
(
kwl
);
std
::
string
key
=
"support_data.number_bands"
;
ossimString
keywordString
=
kwl
.
find
(
key
.
c_str
());
return
keywordString
.
toUInt32
();
}
std
::
vector
<
std
::
string
>
ImageMetadataInterface
::
GetBandName
(
const
MetaDataDictionaryType
&
dict
)
const
{
ImageKeywordlistType
ImageKeywordlist
;
...
...
@@ -645,7 +660,7 @@ ImageMetadataInterface::VariableLengthVectorType
ImageMetadataInterface
::
GetIkonosPhysicalBias
(
const
MetaDataDictionaryType
&
dict
)
const
{
VariableLengthVectorType
outputValuesVariableLengthVector
;
outputValuesVariableLengthVector
.
SetSize
(
1
);
//FIXME
outputValuesVariableLengthVector
.
SetSize
(
GetNumberOfBands
(
dict
));
outputValuesVariableLengthVector
.
Fill
(
0.0
);
return
outputValuesVariableLengthVector
;
...
...
@@ -654,33 +669,85 @@ ImageMetadataInterface::VariableLengthVectorType
ImageMetadataInterface
::
VariableLengthVectorType
ImageMetadataInterface
::
GetIkonosPhysicalGain
(
const
MetaDataDictionaryType
&
dict
)
const
{
//Value computed from
//Values are different pre/post 2001-01-22 production date, find out where we are
ImageKeywordlistType
ImageKeywordlist
;
if
(
dict
.
HasKey
(
MetaDataKey
::
OSSIMKeywordlistKey
))
{
itk
::
ExposeMetaData
<
ImageKeywordlistType
>
(
dict
,
MetaDataKey
::
OSSIMKeywordlistKey
,
ImageKeywordlist
);
}
ossimKeywordlist
kwl
;
ImageKeywordlist
.
convertToOSSIMKeywordlist
(
kwl
);
std
::
string
key
=
"production_date"
;
ossimString
keywordString
=
kwl
.
find
(
key
.
c_str
());
std
::
string
output
(
keywordString
.
chars
());
//The Ikonos production date has the format MM/DD/YY
ossimString
separatorList
=
"/"
;
std
::
vector
<
ossimString
>
keywordStrings
=
keywordString
.
split
(
separatorList
);
assert
(
keywordStrings
.
size
()
>
2
);
int
productionYear
=
keywordStrings
[
2
].
toInt
();
int
productionMonth
=
keywordStrings
[
0
].
toInt
();
int
productionDay
=
keywordStrings
[
1
].
toInt
();
bool
isPost20010122
=
false
;
if
((
productionYear
>
2
)
||
(
productionYear
<
99
))
isPost20010122
=
true
;
else
{
if
(
productionYear
==
2
)
{
if
(
productionMonth
>
1
)
isPost20010122
=
true
;
else
if
(
productionDay
>=
22
)
isPost20010122
=
true
;
}
}
//Value computed from
// http://www.geoeye.com/CorpSite/assets/docs/technical-papers/2009/IKONOS_Esun_Calculations.pdf
// to get the equivalent of the SPOT alpha
VariableLengthVectorType
gain
;
gain
.
SetSize
(
5
);
if
(
isPost20010122
)
{
gain
[
0
]
=
6.48830
;
//Pan
gain
[
1
]
=
5.19064
;
//Blue
gain
[
2
]
=
6.44122
;
//Green
gain
[
3
]
=
6.24442
;
//Red
gain
[
4
]
=
8.04222
;
//NIR
}
else
{
gain
[
0
]
=
6.48830
;
//Pan
gain
[
1
]
=
4.51329
;
//Blue
gain
[
2
]
=
5.75014
;
//Green
gain
[
3
]
=
5.52720
;
//Red
gain
[
4
]
=
7.11684
;
//NIR
}
VariableLengthVectorType
gainPre20010122
;
gainPre20010122
.
SetSize
(
5
);
gainPre20010122
[
0
]
=
6.48830
;
//Pan
gainPre20010122
[
1
]
=
4.51329
;
//Blue
gainPre20010122
[
2
]
=
5.75014
;
//Green
gainPre20010122
[
3
]
=
5.52720
;
//Red
gainPre20010122
[
4
]
=
7.11684
;
//NIR
VariableLengthVectorType
gainPost20010122
;
gainPost20010122
.
SetSize
(
5
);
gainPost20010122
[
0
]
=
6.48830
;
//Pan
gainPost20010122
[
1
]
=
5.19064
;
//Blue
gainPost20010122
[
2
]
=
6.44122
;
//Green
gainPost20010122
[
3
]
=
6.24442
;
//Red
gainPost20010122
[
4
]
=
8.04222
;
//NIR
//Values are different pre/post 2001-01-22 production date, find out where we are
std
::
vector
<
std
::
string
>
bandName
=
GetBandName
(
dict
);
VariableLengthVectorType
outputValuesVariableLengthVector
;
outputValuesVariableLengthVector
.
SetSize
(
1
);
//FIXME
outputValuesVariableLengthVector
.
Fill
(
1.0
);
unsigned
int
numBands
=
GetNumberOfBands
(
dict
);
outputValuesVariableLengthVector
.
SetSize
(
numBands
);
for
(
unsigned
int
i
=
0
;
i
<
numBands
;
++
i
)
{
if
(
bandName
[
i
].
find
(
"Pan"
)
!=
std
::
string
::
npos
)
outputValuesVariableLengthVector
[
i
]
=
gain
[
0
];
if
(
bandName
[
i
].
find
(
"Blue"
)
!=
std
::
string
::
npos
)
outputValuesVariableLengthVector
[
i
]
=
gain
[
1
];
if
(
bandName
[
i
].
find
(
"Green"
)
!=
std
::
string
::
npos
)
outputValuesVariableLengthVector
[
i
]
=
gain
[
2
];
if
(
bandName
[
i
].
find
(
"Red"
)
!=
std
::
string
::
npos
)
outputValuesVariableLengthVector
[
i
]
=
gain
[
3
];
if
(
bandName
[
i
].
find
(
"NIR"
)
!=
std
::
string
::
npos
)
outputValuesVariableLengthVector
[
i
]
=
gain
[
4
];
}
//TODO
return
outputValuesVariableLengthVector
;
}
...
...
This diff is collapsed.
Click to expand it.
Code/IO/otbImageMetadataInterface.h
+
3
−
0
View file @
a11120cd
...
...
@@ -129,6 +129,9 @@ public:
/** Get the sensor ID from the ossim metadata */
std
::
string
GetSensorID
(
const
MetaDataDictionaryType
&
dict
)
const
;
/** Get the number of bands from the ossim metadata */
unsigned
int
GetNumberOfBands
(
const
MetaDataDictionaryType
&
dict
)
const
;
/** Get the band name from the ossim metadata */
std
::
vector
<
std
::
string
>
GetBandName
(
const
MetaDataDictionaryType
&
dict
)
const
;
...
...
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