Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
f1158f5a
Commit
f1158f5a
authored
Nov 16, 2020
by
Cédric Traizet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: add parsing for ikonos metadata from geom
parent
7e6c7488
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
227 additions
and
43 deletions
+227
-43
Data/Input/ikonos/ikonos-2.geom
Data/Input/ikonos/ikonos-2.geom
+162
-0
Modules/Core/Metadata/src/otbIkonosImageMetadataInterface.cxx
...les/Core/Metadata/src/otbIkonosImageMetadataInterface.cxx
+64
-43
Modules/Core/Metadata/test/CMakeLists.txt
Modules/Core/Metadata/test/CMakeLists.txt
+1
-0
No files found.
Data/Input/ikonos/ikonos-2.geom
0 → 100644
View file @
f1158f5a
adjustment_0
.
adj_param_0
.
center
:
0
adjustment_0
.
adj_param_0
.
description
:
intrack_offset
adjustment_0
.
adj_param_0
.
lock_flag
:
0
adjustment_0
.
adj_param_0
.
parameter
:
0
adjustment_0
.
adj_param_0
.
sigma
:
50
adjustment_0
.
adj_param_0
.
units
:
pixel
adjustment_0
.
adj_param_1
.
center
:
0
adjustment_0
.
adj_param_1
.
description
:
crtrack_offset
adjustment_0
.
adj_param_1
.
lock_flag
:
0
adjustment_0
.
adj_param_1
.
parameter
:
0
adjustment_0
.
adj_param_1
.
sigma
:
50
adjustment_0
.
adj_param_1
.
units
:
pixel
adjustment_0
.
adj_param_2
.
center
:
0
adjustment_0
.
adj_param_2
.
description
:
intrack_scale
adjustment_0
.
adj_param_2
.
lock_flag
:
0
adjustment_0
.
adj_param_2
.
parameter
:
0
adjustment_0
.
adj_param_2
.
sigma
:
50
adjustment_0
.
adj_param_2
.
units
:
unknown
adjustment_0
.
adj_param_3
.
center
:
0
adjustment_0
.
adj_param_3
.
description
:
crtrack_scale
adjustment_0
.
adj_param_3
.
lock_flag
:
0
adjustment_0
.
adj_param_3
.
parameter
:
0
adjustment_0
.
adj_param_3
.
sigma
:
50
adjustment_0
.
adj_param_3
.
units
:
unknown
adjustment_0
.
adj_param_4
.
center
:
0
adjustment_0
.
adj_param_4
.
description
:
map_rotation
adjustment_0
.
adj_param_4
.
lock_flag
:
0
adjustment_0
.
adj_param_4
.
parameter
:
0
adjustment_0
.
adj_param_4
.
sigma
:
0
.
1
adjustment_0
.
adj_param_4
.
units
:
degrees
adjustment_0
.
description
:
Initial
adjustment
adjustment_0
.
dirty_flag
:
0
adjustment_0
.
number_of_params
:
5
bias_error
:
0
ce90_absolute
:
0
ce90_relative
:
0
current_adjustment
:
0
height_off
:
111
height_scale
:
161
image_id
:
lat_off
:
49
.
8424
lat_scale
:
0
.
0854
line_den_coeff_00
:
1
line_den_coeff_01
:
0
.
003577312
96703222
line_den_coeff_02
:
0
.
00661417744
812363
line_den_coeff_03
:
-
0
.
0052
8102770185422
line_den_coeff_04
:
-
2.01415994765857e-06
line_den_coeff_05
:
-
5.68547052596961e-06
line_den_coeff_06
:
-
5.85716100607444e-06
line_den_coeff_07
:
9.68284883807856e-07
line_den_coeff_08
:
-
2.71272057558465e-06
line_den_coeff_09
:
1.59802943641606e-06
line_den_coeff_10
:
-
4.14978815475422e-09
line_den_coeff_11
:
1.35113227489467e-09
line_den_coeff_12
:
-
4.52364095011366e-10
line_den_coeff_13
:
1.99768701474204e-10
line_den_coeff_14
:
4.31800380813429e-09
line_den_coeff_15
:
1.23014563527531e-09
line_den_coeff_16
:
1.12599961368957e-09
line_den_coeff_17
:
2.12020276670411e-10
line_den_coeff_18
:
-
1.32884971432196e-08
line_den_coeff_19
:
-
4.38267508607325e-11
line_num_coeff_00
:
-
1.40537895062798e-05
line_num_coeff_01
:
0
.
0243
811721277574
line_num_coeff_02
:
-
1
.
02302
808810429
line_num_coeff_03
:
-
0
.
0064
8757712941276
line_num_coeff_04
:
-
0
.
00351076725260372
line_num_coeff_05
:
-
0
.
00011041052175
8032
line_num_coeff_06
:
0
.
005371166
96188431
line_num_coeff_07
:
-
0
.
0004
91874893630559
line_num_coeff_08
:
-
0
.
006772
92540355985
line_num_coeff_09
:
3.41076002016017e-05
line_num_coeff_10
:
6.08482073859084e-06
line_num_coeff_11
:
-
2.02696863861247e-06
line_num_coeff_12
:
1.78135418523675e-06
line_num_coeff_13
:
-
1.2036269452366e-07
line_num_coeff_14
:
-
4.61799035242981e-06
line_num_coeff_15
:
2.7328566234585e-06
line_num_coeff_16
:
-
1.6634701058419e-06
line_num_coeff_17
:
2.31174655392988e-06
line_num_coeff_18
:
6.06247903019451e-06
line_num_coeff_19
:
-
9.71977514279228e-09
line_off
:
2320
line_scale
:
2320
ll_lat
:
49
.
7573952191682
ll_lon
:
0
.
672602394455656
long_off
:
0
.
7711
long_scale
:
0
.
1058
lr_lat
:
49
.
7613012474294
lr_lon
:
0
.
876083474578688
meters_per_pixel_x
:
4
.
00105
902961893
meters_per_pixel_y
:
4
.
0003115530
8549
number_lines
:
4640
number_of_adjustments
:
1
number_samples
:
3667
polynomial_format
:
B
rand_error
:
0
rect
:
0
0
3666
4639
ref_point_hgt
:
111
ref_point_lat
:
49
.
8424
ref_point_line
:
2320
ref_point_lon
:
0
.
7711
ref_point_samp
:
1833
samp_den_coeff_00
:
1
samp_den_coeff_01
:
0
.
003577312
96703222
samp_den_coeff_02
:
0
.
00661417744
812363
samp_den_coeff_03
:
-
0
.
0052
8102770185422
samp_den_coeff_04
:
-
2.01415994765857e-06
samp_den_coeff_05
:
-
5.68547052596961e-06
samp_den_coeff_06
:
-
5.85716100607444e-06
samp_den_coeff_07
:
9.68284883807856e-07
samp_den_coeff_08
:
-
2.71272057558465e-06
samp_den_coeff_09
:
1.59802943641606e-06
samp_den_coeff_10
:
-
4.14978815475422e-09
samp_den_coeff_11
:
1.35113227489467e-09
samp_den_coeff_12
:
-
4.52364095011366e-10
samp_den_coeff_13
:
1.99768701474204e-10
samp_den_coeff_14
:
4.31800380813429e-09
samp_den_coeff_15
:
1.23014563527531e-09
samp_den_coeff_16
:
1.12599961368957e-09
samp_den_coeff_17
:
2.12020276670411e-10
samp_den_coeff_18
:
-
1.32884971432196e-08
samp_den_coeff_19
:
-
4.38267508607325e-11
samp_num_coeff_00
:
-
0
.
00137
856431376656
samp_num_coeff_01
:
1
.
036
82335435076
samp_num_coeff_02
:
0
.
03
84865594581929
samp_num_coeff_03
:
-
0
.
01021
8778296096
samp_num_coeff_04
:
0
.
005166
80076372087
samp_num_coeff_05
:
-
0
.
00524111
89251778
samp_num_coeff_06
:
-
0
.
0003470147
81279238
samp_num_coeff_07
:
0
.
0037153106
800081
samp_num_coeff_08
:
0
.
00027
9070882976255
samp_num_coeff_09
:
5.11077794659527e-05
samp_num_coeff_10
:
4.53108717461887e-06
samp_num_coeff_11
:
9.26592661130893e-07
samp_num_coeff_12
:
-
1.60557560304781e-05
samp_num_coeff_13
:
3.39063302956452e-07
samp_num_coeff_14
:
-
8.45284202498385e-06
samp_num_coeff_15
:
4.30820560499025e-08
samp_num_coeff_16
:
4.87568561673677e-07
samp_num_coeff_17
:
-
5.06398632927844e-06
samp_num_coeff_18
:
-
7.82314090137915e-07
samp_num_coeff_19
:
-
1.73215919797596e-09
samp_off
:
1833
samp_scale
:
1834
sensor
:
IKONOS
-
2
support_data
.
acquisition_date
:
2005
-
06
-
21
support_data
.
acquisition_time
:
10
:
53
support_data
.
azimuth_angle
:
147
.
9241
support_data
.
band_name
:
Blue
support_data
.
elevation_angle
:
60
.
87259
support_data
.
nominal_collection_azimuth_angle
:
126
.
9937
support_data
.
nominal_collection_elevation_angle
:
59
.
33891
support_data
.
number_bands
:
1
support_data
.
production_date
:
02
/
12
/
08
support_data
.
sensor
:
IKONOS
-
2
support_data
.
type
:
ossimIkonosMetaData
type
:
ossimIkonosRpcModel
ul_lat
:
49
.
924153841881
ul_lon
:
0
.
66456736972061
ur_lat
:
49
.
9280828715987
ur_lon
:
0
.
868748579461097
Modules/Core/Metadata/src/otbIkonosImageMetadataInterface.cxx
View file @
f1158f5a
...
...
@@ -801,6 +801,22 @@ namespace
&&
associativeContainer
.
find
(
"acquisitionDate"
)
!=
pastTheEnd
;
}
// Read Ikonos metadata from a geom file
template
<
class
T
>
void
ParseGeomFile
(
const
MetadataSupplierInterface
&
mds
,
T
&
metadataAssociativeContainer
)
{
metadataAssociativeContainer
[
"productionDate"
]
=
mds
.
GetAs
<
std
::
string
>
(
"support_data.production_date"
);
metadataAssociativeContainer
[
"sensorID"
]
=
mds
.
GetAs
<
std
::
string
>
(
"support_data.sensor"
);
metadataAssociativeContainer
[
"nominalCollectionAzimuth"
]
=
mds
.
GetAs
<
std
::
string
>
(
"support_data.nominal_collection_azimuth_angle"
);
metadataAssociativeContainer
[
"nominalCollectionElevation"
]
=
mds
.
GetAs
<
std
::
string
>
(
"support_data.nominal_collection_elevation_angle"
);
metadataAssociativeContainer
[
"sunAzimuth"
]
=
mds
.
GetAs
<
std
::
string
>
(
"support_data.azimuth_angle"
);
metadataAssociativeContainer
[
"sunElevation"
]
=
mds
.
GetAs
<
std
::
string
>
(
"support_data.elevation_angle"
);
metadataAssociativeContainer
[
"acquisitionDate"
]
=
mds
.
GetAs
<
std
::
string
>
(
"support_data.acquisition_date"
);
metadataAssociativeContainer
[
"acquisitionTime"
]
=
mds
.
GetAs
<
std
::
string
>
(
"support_data.acquisition_time"
);
metadataAssociativeContainer
[
"bandName"
]
=
mds
.
GetAs
<
std
::
string
>
(
"support_data.band_name"
);
}
template
<
class
T
>
void
ParseMetadataFile
(
const
std
::
string
&
metadataFilename
,
T
&
metadataAssociativeContainer
)
...
...
@@ -951,6 +967,7 @@ void IkonosImageMetadataInterface::FetchProductionDate(const std::string & produ
productionDateMD
.
tm_min
=
0
;
productionDateMD
.
tm_hour
=
0
;
productionDateMD
.
frac_sec
=
0
;
productionDateMD
.
tm_isdst
=
0
;
productionDateMD
.
tm_mday
=
boost
::
lexical_cast
<
int
>
(
dateParts
[
1
]);
// tm_mon: number of months since january (0-11)
...
...
@@ -1186,61 +1203,67 @@ void IkonosImageMetadataInterface::FetchSpectralSensitivity(const std::string &
void
IkonosImageMetadataInterface
::
Parse
(
const
MetadataSupplierInterface
&
mds
)
{
bool
hasValue
=
0
;
std
::
unordered_map
<
std
::
string
,
std
::
string
>
ikonosMetadata
;
auto
metadatatype
=
mds
.
GetMetadataValue
(
"METADATATYPE"
,
hasValue
);
if
(
!
hasValue
||
metadatatype
!=
"GE"
)
if
(
mds
.
GetAs
<
std
::
string
>
(
""
,
"METADATATYPE"
)
==
"GE"
)
{
otbGenericExceptionMacro
(
MissingMetadataException
,
<<
"No Geo-Eye metadata has been found"
)
}
FetchRPC
(
mds
);
auto
inputFilenameWithDir
=
mds
.
GetResourceFile
();
auto
inputFilenameWithDir
=
mds
.
GetResourceFile
();
auto
inputFilename
=
itksys
::
SystemTools
::
GetFilenameName
(
inputFilenameWithDir
);
// Find hdr and metadata files :
std
::
vector
<
std
::
string
>
inputFilenameParts
;
boost
::
split
(
inputFilenameParts
,
inputFilename
,
boost
::
is_any_of
(
"_"
));
auto
inputFilename
=
itksys
::
SystemTools
::
GetFilenameName
(
inputFilenameWithDir
);
// Find hdr and metadata files :
std
::
vector
<
std
::
string
>
inputFilenameParts
;
boost
::
split
(
inputFilenameParts
,
inputFilename
,
boost
::
is_any_of
(
"_"
));
auto
metadataFilename
=
itksys
::
SystemTools
::
GetParentDirectory
(
inputFilenameWithDir
)
+
"/"
+
inputFilenameParts
[
0
]
+
"_"
+
inputFilenameParts
[
1
]
+
"_metadata.txt"
;
auto
metadataFilename
=
itksys
::
SystemTools
::
GetParentDirectory
(
inputFilenameWithDir
)
+
"/"
+
inputFilenameParts
[
0
]
+
"_"
+
inputFilenameParts
[
1
]
+
"_metadata.txt"
;
if
(
!
itksys
::
SystemTools
::
FileExists
(
metadataFilename
))
{
otbGenericExceptionMacro
(
MissingMetadataException
,
<<
"Cannot find the Ikonos metadata file, tried: "
<<
metadataFilename
)
}
// Read metadata from the metadata file
if
(
!
itksys
::
SystemTools
::
FileExists
(
metadataFilename
))
{
otbGenericExceptionMacro
(
MissingMetadataException
,
<<
"Cannot find the Ikonos metadata file, tried: "
<<
metadataFilename
)
}
// Read metadata from the metadata file
ParseMetadataFile
(
metadataFilename
,
ikonosMetadata
);
std
::
unordered_map
<
std
::
string
,
std
::
string
>
ikonosMetadata
;
ParseMetadataFile
(
metadataFilename
,
ikonosMetadata
);
if
(
!
ContainsIkonosMetadata
(
ikonosMetadata
))
{
otbGenericExceptionMacro
(
MissingMetadataException
,
<<
"The Ikonos metadata file is incomplete: "
<<
metadataFilename
)
}
if
(
!
ContainsIkonosMetadata
(
ikonosMetadata
))
auto
hdrFilename
=
itksys
::
SystemTools
::
GetParentDirectory
(
inputFilenameWithDir
)
+
"/"
+
itksys
::
SystemTools
::
GetFilenameWithoutExtension
(
inputFilenameWithDir
)
+
".hdr"
;
if
(
!
itksys
::
SystemTools
::
FileExists
(
hdrFilename
))
{
otbGenericExceptionMacro
(
MissingMetadataException
,
<<
"Cannot find the Ikonos hdr file, tried: "
<<
hdrFilename
)
}
ParseHeaderFile
(
hdrFilename
,
ikonosMetadata
);
}
else
if
(
mds
.
GetAs
<
std
::
string
>
(
""
,
"support_data.sensor"
)
==
"IKONOS-2"
)
{
otbGenericExceptionMacro
(
MissingMetadataException
,
<<
"The Ikonos metadata file is incomplete: "
<<
metadataFilename
)
ParseGeomFile
(
mds
,
ikonosMetadata
);
}
auto
hdrFilename
=
itksys
::
SystemTools
::
GetParentDirectory
(
inputFilenameWithDir
)
+
"/"
+
itksys
::
SystemTools
::
GetFilenameWithoutExtension
(
inputFilenameWithDir
)
+
".hdr"
;
if
(
!
itksys
::
SystemTools
::
FileExists
(
hdrFilename
))
else
{
otbGenericExceptionMacro
(
MissingMetadataException
,
<<
"
Cannot find the Ikonos hdr file, tried: "
<<
hdrFilename
)
<<
"
No Geo-Eye metadata has been found"
)
}
ParseHeaderFile
(
hdrFilename
,
ikonosMetadata
);
try
{
...
...
@@ -1286,8 +1309,6 @@ void IkonosImageMetadataInterface::Parse(const MetadataSupplierInterface & mds)
m_Imd
.
Bands
[
0
].
Add
(
MDNum
::
PhysicalBias
,
0.
);
m_Imd
.
Bands
[
0
].
Add
(
MDNum
::
SolarIrradiance
,
ikonosSolarIrradiance
[
bandName
]);
FetchRPC
(
mds
);
FetchSpectralSensitivity
(
bandName
);
}
...
...
Modules/Core/Metadata/test/CMakeLists.txt
View file @
f1158f5a
...
...
@@ -459,6 +459,7 @@ set(spot5_2_geom_file ${INPUTDATA}/spot5/spot5-1.geom)
set
(
formosat_geom_file
${
INPUTDATA
}
/FORMOSAT_ROI_1000_100.geom
)
set
(
pleiades_geom_file
${
INPUTDATA
}
/pleiades/maido.geom
)
set
(
spot6_geom_file
${
INPUTDATA
}
/spot6/spot6-1.geom
)
set
(
ikonos_geom_file
${
INPUTDATA
}
/ikonos/ikonos-2.geom
)
foreach
(
sensor
${
sensor_list
}
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment