Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
273
Issues
273
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
7f9b9e2d
Commit
7f9b9e2d
authored
Nov 25, 2020
by
Cédric Traizet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: use ImageMetadata in OpticalCalibrationFilter when determining the default values
parent
f65c8622
Pipeline
#6249
failed with stages
in 92 minutes and 22 seconds
Changes
16
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
229 additions
and
145 deletions
+229
-145
Data/Baseline/OTB/Files/ioTvImageMetadataInterfaceTest_spot5.txt
...seline/OTB/Files/ioTvImageMetadataInterfaceTest_spot5.txt
+4
-4
Data/Baseline/OTB/Files/ioTvImageMetadataInterfaceTest_spot5_2.txt
...line/OTB/Files/ioTvImageMetadataInterfaceTest_spot5_2.txt
+4
-4
Modules/Core/Metadata/include/otbImageMetadata.h
Modules/Core/Metadata/include/otbImageMetadata.h
+6
-0
Modules/Core/Metadata/src/otbFormosatImageMetadataInterface.cxx
...s/Core/Metadata/src/otbFormosatImageMetadataInterface.cxx
+21
-20
Modules/Core/Metadata/src/otbImageMetadata.cxx
Modules/Core/Metadata/src/otbImageMetadata.cxx
+13
-0
Modules/Core/Metadata/src/otbSpotImageMetadataInterface.cxx
Modules/Core/Metadata/src/otbSpotImageMetadataInterface.cxx
+29
-21
Modules/Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx
...Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx
+1
-1
Modules/Radiometry/OpticalCalibration/include/otbImageToRadianceImageFilter.h
...pticalCalibration/include/otbImageToRadianceImageFilter.h
+6
-5
Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h
...calCalibration/include/otbImageToReflectanceImageFilter.h
+15
-13
Modules/Radiometry/OpticalCalibration/include/otbRadianceToImageImageFilter.h
...pticalCalibration/include/otbRadianceToImageImageFilter.h
+6
-5
Modules/Radiometry/OpticalCalibration/include/otbRadianceToReflectanceImageFilter.h
...Calibration/include/otbRadianceToReflectanceImageFilter.h
+12
-9
Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h
...calCalibration/include/otbReflectanceToImageImageFilter.h
+15
-13
Modules/Radiometry/OpticalCalibration/include/otbReflectanceToRadianceImageFilter.h
...Calibration/include/otbReflectanceToRadianceImageFilter.h
+12
-9
Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.hxx
...include/otbReflectanceToSurfaceReflectanceImageFilter.hxx
+30
-18
Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.hxx
...clude/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.hxx
+28
-11
Modules/Radiometry/Simulation/include/otbSurfaceReflectanceToReflectanceFilter.hxx
...tion/include/otbSurfaceReflectanceToReflectanceFilter.hxx
+27
-12
No files found.
Data/Baseline/OTB/Files/ioTvImageMetadataInterfaceTest_spot5.txt
View file @
7f9b9e2d
...
...
@@ -10,9 +10,9 @@ SatAzimuth -74.1736
AcquisitionDate 2009-03-16T11:03:49.972847Z
ProductionDate 2009-03-26T11:56:45Z
BandName XS1
PhysicalGain
2.24793
PhysicalGain
3.04029
PhysicalBias 0
SolarIrradiance 1
858
SolarIrradiance 1
043
SpectralSensitivity LUT1D.DIM0.SIZE = 541
LUT1D.DIM0.ORIGIN = 0.45
LUT1D.DIM0.SPACING = 0.0025
...
...
@@ -26,9 +26,9 @@ LUT1D.DIM0.ORIGIN = 0.45
LUT1D.DIM0.SPACING = 0.0025
LUT1D.ARRAY = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.000767371 0.00153474 0.0104196 0.0193045 0.0615428 0.103781 0.200796 0.297811 0.412078 0.526345 0.620393 0.71444 0.780931 0.847421 0.886912 0.926403 0.95094 0.975478 0.985468 0.995459 0.997729 1 0.993748 0.987495 0.974977 0.962458 0.943181 0.923905 0.899244 0.874583 0.844649 0.814715 0.768634 0.722553 0.65867 0.594786 0.516931 0.439075 0.366208 0.293341 0.235793 0.178245 0.1414 0.104555 0.082136 0.0597166 0.0472382 0.0347598 0.0272426 0.0197255 0.0155478 0.01137 0.0090188 0.00666756 0.00509771 0.00352787 0.0028316 0.00213534 0.00106767 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BandName XS3
PhysicalGain
3.04029
PhysicalGain
2.24793
PhysicalBias 0
SolarIrradiance 1
043
SolarIrradiance 1
858
SpectralSensitivity LUT1D.DIM0.SIZE = 541
LUT1D.DIM0.ORIGIN = 0.45
LUT1D.DIM0.SPACING = 0.0025
...
...
Data/Baseline/OTB/Files/ioTvImageMetadataInterfaceTest_spot5_2.txt
View file @
7f9b9e2d
...
...
@@ -11,9 +11,9 @@ AcquisitionDate 2003-07-23T07:27:43.889716Z
ProductionDate 2003-12-05T08:21:19Z
GCP <GCPParam>
BandName XS1
PhysicalGain 1.
003
2
PhysicalGain 1.
381
2
PhysicalBias 0
SolarIrradiance 1
858
SolarIrradiance 1
047
SpectralSensitivity LUT1D.DIM0.SIZE = 541
LUT1D.DIM0.ORIGIN = 0.45
LUT1D.DIM0.SPACING = 0.0025
...
...
@@ -27,9 +27,9 @@ LUT1D.DIM0.ORIGIN = 0.45
LUT1D.DIM0.SPACING = 0.0025
LUT1D.ARRAY = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.000767371 0.00153474 0.0104196 0.0193045 0.0615428 0.103781 0.200796 0.297811 0.412078 0.526345 0.620393 0.71444 0.780931 0.847421 0.886912 0.926403 0.95094 0.975478 0.985468 0.995459 0.997729 1 0.993748 0.987495 0.974977 0.962458 0.943181 0.923905 0.899244 0.874583 0.844649 0.814715 0.768634 0.722553 0.65867 0.594786 0.516931 0.439075 0.366208 0.293341 0.235793 0.178245 0.1414 0.104555 0.082136 0.0597166 0.0472382 0.0347598 0.0272426 0.0197255 0.0155478 0.01137 0.0090188 0.00666756 0.00509771 0.00352787 0.0028316 0.00213534 0.00106767 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BandName XS3
PhysicalGain 1.
381
2
PhysicalGain 1.
003
2
PhysicalBias 0
SolarIrradiance 1
047
SolarIrradiance 1
858
SpectralSensitivity LUT1D.DIM0.SIZE = 541
LUT1D.DIM0.ORIGIN = 0.45
LUT1D.DIM0.SPACING = 0.0025
...
...
Modules/Core/Metadata/include/otbImageMetadata.h
View file @
7f9b9e2d
...
...
@@ -305,6 +305,12 @@ public:
/** Getter for numeric keys on each band*/
itk
::
VariableLengthVector
<
double
>
GetAsVector
(
const
MDNum
&
key
)
const
;
/** test wether the metadata corresponding to key is present on each band */
bool
HasBandMetadata
(
const
MDNum
&
key
)
const
;
/** test wether the metadata corresponding to key is present on each band */
bool
HasBandMetadata
(
const
MDL1D
&
key
)
const
;
};
extern
OTBMetadata_EXPORT
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
otb
::
ImageMetadataBase
&
imd
);
...
...
Modules/Core/Metadata/src/otbFormosatImageMetadataInterface.cxx
View file @
7f9b9e2d
...
...
@@ -1461,30 +1461,31 @@ void FormosatImageMetadataInterface::Parse(const MetadataSupplierInterface & mds
solarIrradianceVec
=
dimapData
.
SolarIrradiance
;
}
if
(
dimapData
.
PhysicalBias
.
size
()
==
nbBands
&&
dimapData
.
PhysicalGain
.
size
()
==
nbBands
&&
solarIrradianceVec
.
size
()
==
nbBands
)
auto
setDimapBandMetadata
=
[
this
](
const
MDNum
&
key
,
const
std
::
vector
<
double
>
&
input
)
{
auto
bias
=
dimapData
.
PhysicalBias
.
begin
();
auto
gain
=
dimapData
.
PhysicalGain
.
begin
();
auto
solarIrradiance
=
solarIrradianceVec
.
begin
();
for
(
auto
&
band
:
m_Imd
.
Bands
)
if
(
input
.
size
()
==
1
)
{
band
.
Add
(
MDNum
::
PhysicalGain
,
*
gain
);
band
.
Add
(
MDNum
::
PhysicalBias
,
*
bias
);
band
.
Add
(
MDNum
::
SolarIrradiance
,
*
solarIrradiance
);
bias
++
;
gain
++
;
solarIrradiance
++
;
// this is a PAN image
m_Imd
.
Bands
[
0
].
Add
(
key
,
input
[
0
]);
}
}
else
{
otbGenericExceptionMacro
(
MissingMetadataException
,
else
if
(
input
.
size
()
==
4
)
{
// MS image, note the band ordering
m_Imd
.
Bands
[
0
].
Add
(
key
,
input
[
2
]);
m_Imd
.
Bands
[
1
].
Add
(
key
,
input
[
1
]);
m_Imd
.
Bands
[
2
].
Add
(
key
,
input
[
0
]);
m_Imd
.
Bands
[
3
].
Add
(
key
,
input
[
3
]);
}
else
{
otbGenericExceptionMacro
(
MissingMetadataException
,
<<
"The number of bands in image metadatas is incoherent with the DIMAP product"
)
}
}
};
setDimapBandMetadata
(
MDNum
::
PhysicalBias
,
dimapData
.
PhysicalBias
);
setDimapBandMetadata
(
MDNum
::
PhysicalGain
,
dimapData
.
PhysicalGain
);
setDimapBandMetadata
(
MDNum
::
SolarIrradiance
,
solarIrradianceVec
);
FetchSpectralSensitivity
();
...
...
Modules/Core/Metadata/src/otbImageMetadata.cxx
View file @
7f9b9e2d
...
...
@@ -645,6 +645,19 @@ itk::VariableLengthVector<double> ImageMetadata::GetAsVector(const MDNum& key) c
return
output
;
}
bool
ImageMetadata
::
HasBandMetadata
(
const
MDNum
&
key
)
const
{
return
std
::
all_of
(
Bands
.
begin
(),
Bands
.
end
(),
[
key
](
ImageMetadataBase
band
){
return
band
.
Has
(
key
);});
}
bool
ImageMetadata
::
HasBandMetadata
(
const
MDL1D
&
key
)
const
{
return
std
::
all_of
(
Bands
.
begin
(),
Bands
.
end
(),
[
key
](
ImageMetadataBase
band
){
return
band
.
Has
(
key
);});
}
// printing
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
otb
::
ImageMetadataBase
&
imd
)
{
...
...
Modules/Core/Metadata/src/otbSpotImageMetadataInterface.cxx
View file @
7f9b9e2d
...
...
@@ -1806,31 +1806,39 @@ void SpotImageMetadataInterface::Parse(const MetadataSupplierInterface & mds)
m_Imd
.
Add
(
MDNum
::
SatAzimuth
,
dimapData
.
SceneOrientation
[
0
]
-
90
);
}
auto
nbBands
=
m_Imd
.
Bands
.
size
();
if
(
dimapData
.
PhysicalBias
.
size
()
==
nbBands
&&
dimapData
.
PhysicalGain
.
size
()
==
nbBands
&&
dimapData
.
SolarIrradiance
.
size
()
==
nbBands
)
auto
setDimapBandMetadata
=
[
this
](
const
MDNum
&
key
,
const
std
::
vector
<
double
>
&
input
)
{
auto
bias
=
dimapData
.
PhysicalBias
.
begin
();
auto
gain
=
dimapData
.
PhysicalGain
.
begin
();
auto
solarIrradiance
=
dimapData
.
SolarIrradiance
.
begin
();
for
(
auto
&
band
:
m_Imd
.
Bands
)
if
(
input
.
size
()
==
1
)
{
band
.
Add
(
MDNum
::
PhysicalGain
,
*
gain
);
band
.
Add
(
MDNum
::
PhysicalBias
,
*
bias
);
band
.
Add
(
MDNum
::
SolarIrradiance
,
*
solarIrradiance
);
bias
++
;
gain
++
;
solarIrradiance
++
;
// this is a PAN image
m_Imd
.
Bands
[
0
].
Add
(
key
,
input
[
0
]);
}
}
else
{
otbGenericExceptionMacro
(
MissingMetadataException
,
else
if
(
input
.
size
()
==
4
)
{
// MS image, note the band ordering
m_Imd
.
Bands
[
0
].
Add
(
key
,
input
[
2
]);
m_Imd
.
Bands
[
1
].
Add
(
key
,
input
[
1
]);
m_Imd
.
Bands
[
2
].
Add
(
key
,
input
[
0
]);
m_Imd
.
Bands
[
3
].
Add
(
key
,
input
[
3
]);
}
else
if
(
input
.
size
()
==
3
)
{
m_Imd
.
Bands
[
0
].
Add
(
key
,
input
[
2
]);
m_Imd
.
Bands
[
1
].
Add
(
key
,
input
[
1
]);
m_Imd
.
Bands
[
2
].
Add
(
key
,
input
[
0
]);
}
else
{
otbGenericExceptionMacro
(
MissingMetadataException
,
<<
"The number of bands in image metadatas is incoherent with the DIMAP product"
)
}
}
};
setDimapBandMetadata
(
MDNum
::
PhysicalBias
,
dimapData
.
PhysicalBias
);
setDimapBandMetadata
(
MDNum
::
PhysicalGain
,
dimapData
.
PhysicalGain
);
setDimapBandMetadata
(
MDNum
::
SolarIrradiance
,
dimapData
.
SolarIrradiance
);
auto
nbBands
=
m_Imd
.
Bands
.
size
();
// band IDs is not parsed in geom files. There are two possible cases: panchromatic and multispectral
if
(
dimapData
.
BandIDs
.
empty
())
...
...
Modules/Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx
View file @
7f9b9e2d
...
...
@@ -2202,7 +2202,7 @@ namespace
// In previous version of OTB the effective bandwith was tabulated
// because Ossim did not read this specific metadata.
outMetadata
.
effectiveBandwidth
[
bandName
]
=
mds
.
GetAs
<
double
>
(
prefix
+
"effectiveBandwidth"
);
outMetadata
.
effectiveBandwidth
[
bandName
]
=
mds
.
GetAs
<
double
>
(
0.
,
prefix
+
"effectiveBandwidth"
);
outMetadata
.
absCalFactor
[
bandName
]
=
mds
.
GetAs
<
double
>
(
prefix
+
"absCalFactor"
);
...
...
Modules/Radiometry/OpticalCalibration/include/otbImageToRadianceImageFilter.h
View file @
7f9b9e2d
...
...
@@ -172,15 +172,16 @@ protected:
/** Update the functor list and input parameters */
void
BeforeThreadedGenerateData
(
void
)
override
{
OpticalImageMetadataInterface
::
Pointer
imageMetadataInterface
=
OpticalImageMetadataInterfaceFactory
::
CreateIMI
(
this
->
GetInput
()
->
GetMetaDataDictionary
());
if
(
m_Alpha
.
GetSize
()
==
0
)
const
auto
&
metadata
=
this
->
GetInput
()
->
GetImageMetadata
();
if
(
m_Alpha
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
PhysicalGain
))
{
m_Alpha
=
imageMetadataInterface
->
GetPhysicalGain
(
);
m_Alpha
=
metadata
.
GetAsVector
(
MDNum
::
PhysicalGain
);
}
if
(
m_Beta
.
GetSize
()
==
0
)
if
(
m_Beta
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
PhysicalBias
)
)
{
m_Beta
=
imageMetadataInterface
->
GetPhysicalBias
(
);
m_Beta
=
metadata
.
GetAsVector
(
MDNum
::
PhysicalBias
);
}
otbMsgDevMacro
(
<<
"Dimension: "
);
...
...
Modules/Radiometry/OpticalCalibration/include/otbImageToReflectanceImageFilter.h
View file @
7f9b9e2d
...
...
@@ -272,37 +272,39 @@ protected:
/** Update the functor list and input parameters */
void
BeforeThreadedGenerateData
(
void
)
override
{
const
auto
&
metadata
=
this
->
GetInput
()
->
GetImageMetadata
();
OpticalImageMetadataInterface
::
Pointer
imageMetadataInterface
=
OpticalImageMetadataInterfaceFactory
::
CreateIMI
(
this
->
GetInput
()
->
GetMetaDataDictionary
());
if
(
m_Alpha
.
GetSize
()
==
0
)
if
(
m_Alpha
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
PhysicalGain
))
{
m_Alpha
=
imageMetadataInterface
->
GetPhysicalGain
(
);
m_Alpha
=
metadata
.
GetAsVector
(
MDNum
::
PhysicalGain
);
}
if
(
m_Beta
.
GetSize
()
==
0
)
if
(
m_Beta
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
PhysicalBias
)
)
{
m_Beta
=
imageMetadataInterface
->
GetPhysicalBias
(
);
m_Beta
=
metadata
.
GetAsVector
(
MDNum
::
PhysicalBias
);
}
if
((
m_Day
==
0
)
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
))
if
(
m_Day
==
0
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
)
&&
metadata
.
Has
(
MDTime
::
AcquisitionDate
))
{
m_Day
=
imageMetadataInterface
->
GetDay
();
m_Day
=
metadata
[
MDTime
::
AcquisitionDate
].
GetDay
();
}
if
((
m_Month
==
0
)
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
))
if
(
m_Month
==
0
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
)
&&
metadata
.
Has
(
MDTime
::
AcquisitionDate
))
{
m_Month
=
imageMetadataInterface
->
GetMonth
();
m_Month
=
metadata
[
MDTime
::
AcquisitionDate
].
GetMonth
();
}
if
(
m_SolarIllumination
.
GetSize
()
==
0
)
if
(
m_SolarIllumination
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
SolarIrradiance
)
)
{
m_SolarIllumination
=
imageMetadataInterface
->
GetSolarIrradiance
(
);
m_SolarIllumination
=
metadata
.
GetAsVector
(
MDNum
::
SolarIrradiance
);
}
if
(
m_ZenithalSolarAngle
==
120.0
)
if
(
m_ZenithalSolarAngle
==
120.0
&&
metadata
.
Has
(
MDNum
::
SunElevation
)
)
{
// the zenithal angle is the complementary of the elevation angle
m_ZenithalSolarAngle
=
90.0
-
imageMetadataInterface
->
GetSunElevation
()
;
m_ZenithalSolarAngle
=
90.0
-
metadata
[
MDNum
::
SunElevation
]
;
}
otbMsgDevMacro
(
<<
"Using correction parameters: "
);
...
...
Modules/Radiometry/OpticalCalibration/include/otbRadianceToImageImageFilter.h
View file @
7f9b9e2d
...
...
@@ -173,15 +173,16 @@ protected:
/** Update the functor list and input parameters */
void
BeforeThreadedGenerateData
(
void
)
override
{
OpticalImageMetadataInterface
::
Pointer
imageMetadataInterface
=
OpticalImageMetadataInterfaceFactory
::
CreateIMI
(
this
->
GetInput
()
->
GetMetaDataDictionary
());
if
(
m_Alpha
.
GetSize
()
==
0
)
const
auto
&
metadata
=
this
->
GetInput
()
->
GetImageMetadata
();
if
(
m_Alpha
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
PhysicalGain
))
{
m_Alpha
=
imageMetadataInterface
->
GetPhysicalGain
(
);
m_Alpha
=
metadata
.
GetAsVector
(
MDNum
::
PhysicalGain
);
}
if
(
m_Beta
.
GetSize
()
==
0
)
if
(
m_Beta
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
PhysicalBias
)
)
{
m_Beta
=
imageMetadataInterface
->
GetPhysicalBias
(
);
m_Beta
=
metadata
.
GetAsVector
(
MDNum
::
PhysicalBias
);
}
otbMsgDevMacro
(
<<
"Dimension: "
);
...
...
Modules/Radiometry/OpticalCalibration/include/otbRadianceToReflectanceImageFilter.h
View file @
7f9b9e2d
...
...
@@ -261,26 +261,29 @@ protected:
/** Update the functor list and input parameters */
void
BeforeThreadedGenerateData
(
void
)
override
{
OpticalImageMetadataInterface
::
Pointer
imageMetadataInterface
=
OpticalImageMetadataInterfaceFactory
::
CreateIMI
(
this
->
GetInput
()
->
GetMetaDataDictionary
());
if
((
m_Day
==
0
)
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
))
const
auto
&
metadata
=
this
->
GetInput
()
->
GetImageMetadata
();
if
(
m_Day
==
0
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
)
&&
metadata
.
Has
(
MDTime
::
AcquisitionDate
))
{
m_Day
=
imageMetadataInterface
->
GetDay
();
m_Day
=
metadata
[
MDTime
::
AcquisitionDate
].
GetDay
();
}
if
((
m_Month
==
0
)
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
))
if
(
m_Month
==
0
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
)
&&
metadata
.
Has
(
MDTime
::
AcquisitionDate
))
{
m_Month
=
imageMetadataInterface
->
GetMonth
();
m_Month
=
metadata
[
MDTime
::
AcquisitionDate
].
GetMonth
();
}
if
(
m_SolarIllumination
.
GetSize
()
==
0
)
if
(
m_SolarIllumination
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
SolarIrradiance
)
)
{
m_SolarIllumination
=
imageMetadataInterface
->
GetSolarIrradiance
(
);
m_SolarIllumination
=
metadata
.
GetAsVector
(
MDNum
::
SolarIrradiance
);
}
if
(
m_ZenithalSolarAngle
==
120.0
)
if
(
m_ZenithalSolarAngle
==
120.0
&&
metadata
.
Has
(
MDNum
::
SunElevation
)
)
{
// the zenithal angle is the complementary of the elevation angle
m_ZenithalSolarAngle
=
90.0
-
imageMetadataInterface
->
GetSunElevation
()
;
m_ZenithalSolarAngle
=
90.0
-
metadata
[
MDNum
::
SunElevation
]
;
}
otbMsgDevMacro
(
<<
"Using correction parameters: "
);
...
...
Modules/Radiometry/OpticalCalibration/include/otbReflectanceToImageImageFilter.h
View file @
7f9b9e2d
...
...
@@ -258,37 +258,39 @@ protected:
/** Update the functor list and input parameters */
void
BeforeThreadedGenerateData
(
void
)
override
{
const
auto
&
metadata
=
this
->
GetInput
()
->
GetImageMetadata
();
OpticalImageMetadataInterface
::
Pointer
imageMetadataInterface
=
OpticalImageMetadataInterfaceFactory
::
CreateIMI
(
this
->
GetInput
()
->
GetMetaDataDictionary
());
if
(
m_Alpha
.
GetSize
()
==
0
)
if
(
m_Alpha
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
PhysicalGain
))
{
m_Alpha
=
imageMetadataInterface
->
GetPhysicalGain
(
);
m_Alpha
=
metadata
.
GetAsVector
(
MDNum
::
PhysicalGain
);
}
if
(
m_Beta
.
GetSize
()
==
0
)
if
(
m_Beta
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
PhysicalBias
)
)
{
m_Beta
=
imageMetadataInterface
->
GetPhysicalBias
(
);
m_Beta
=
metadata
.
GetAsVector
(
MDNum
::
PhysicalBias
);
}
if
((
m_Day
==
0
)
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
))
if
(
m_Day
==
0
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
)
&&
metadata
.
Has
(
MDTime
::
AcquisitionDate
))
{
m_Day
=
imageMetadataInterface
->
GetDay
();
m_Day
=
metadata
[
MDTime
::
AcquisitionDate
].
GetDay
();
}
if
((
m_Month
==
0
)
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
))
if
(
m_Month
==
0
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
)
&&
metadata
.
Has
(
MDTime
::
AcquisitionDate
))
{
m_Month
=
imageMetadataInterface
->
GetMonth
();
m_Month
=
metadata
[
MDTime
::
AcquisitionDate
].
GetMonth
();
}
if
(
m_SolarIllumination
.
GetSize
()
==
0
)
if
(
m_SolarIllumination
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
SolarIrradiance
)
)
{
m_SolarIllumination
=
imageMetadataInterface
->
GetSolarIrradiance
(
);
m_SolarIllumination
=
metadata
.
GetAsVector
(
MDNum
::
SolarIrradiance
);
}
if
(
m_ZenithalSolarAngle
==
120.0
)
if
(
m_ZenithalSolarAngle
==
120.0
&&
metadata
.
Has
(
MDNum
::
SunElevation
)
)
{
// the zenithal angle is the complementary of the elevation angle
m_ZenithalSolarAngle
=
90.0
-
imageMetadataInterface
->
GetSunElevation
()
;
m_ZenithalSolarAngle
=
90.0
-
metadata
[
MDNum
::
SunElevation
]
;
}
otbMsgDevMacro
(
<<
"Using correction parameters: "
);
...
...
Modules/Radiometry/OpticalCalibration/include/otbReflectanceToRadianceImageFilter.h
View file @
7f9b9e2d
...
...
@@ -244,26 +244,29 @@ protected:
/** Update the functor list and input parameters */
void
BeforeThreadedGenerateData
(
void
)
override
{
OpticalImageMetadataInterface
::
Pointer
imageMetadataInterface
=
OpticalImageMetadataInterfaceFactory
::
CreateIMI
(
this
->
GetInput
()
->
GetMetaDataDictionary
());
if
((
m_Day
==
0
)
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
))
const
auto
&
metadata
=
this
->
GetInput
()
->
GetImageMetadata
();
if
(
m_Day
==
0
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
)
&&
metadata
.
Has
(
MDTime
::
AcquisitionDate
))
{
m_Day
=
imageMetadataInterface
->
GetDay
();
m_Day
=
metadata
[
MDTime
::
AcquisitionDate
].
GetDay
();
}
if
((
m_Month
==
0
)
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
))
if
(
m_Month
==
0
&&
(
!
m_IsSetFluxNormalizationCoefficient
)
&&
(
!
m_IsSetSolarDistance
)
&&
metadata
.
Has
(
MDTime
::
AcquisitionDate
))
{
m_Month
=
imageMetadataInterface
->
GetMonth
();
m_Month
=
metadata
[
MDTime
::
AcquisitionDate
].
GetMonth
();
}
if
(
m_SolarIllumination
.
GetSize
()
==
0
)
if
(
m_SolarIllumination
.
GetSize
()
==
0
&&
metadata
.
HasBandMetadata
(
MDNum
::
SolarIrradiance
)
)
{
m_SolarIllumination
=
imageMetadataInterface
->
GetSolarIrradiance
(
);
m_SolarIllumination
=
metadata
.
GetAsVector
(
MDNum
::
SolarIrradiance
);
}
if
(
m_ZenithalSolarAngle
==
120.0
)
if
(
m_ZenithalSolarAngle
==
120.0
&&
metadata
.
Has
(
MDNum
::
SunElevation
)
)
{
// the zenithal angle is the complementary of the elevation angle
m_ZenithalSolarAngle
=
90.0
-
imageMetadataInterface
->
GetSunElevation
()
;
m_ZenithalSolarAngle
=
90.0
-
metadata
[
MDNum
::
SunElevation
]
;
}
otbMsgDevMacro
(
<<
"Using correction parameters: "
);
...
...
Modules/Radiometry/OpticalCalibration/include/otbReflectanceToSurfaceReflectanceImageFilter.hxx
View file @
7f9b9e2d
...
...
@@ -96,34 +96,49 @@ void ReflectanceToSurfaceReflectanceImageFilter<TInputImage, TOutputImage>::Upda
SetFilterFunctionValuesFileName
=
true
;
}
MetaDataDictionaryType
dict
=
this
->
GetInput
()
->
GetMetaDataDictionary
();
OpticalImageMetadataInterface
::
Pointer
imageMetadataInterface
=
OpticalImageMetadataInterfaceFactory
::
CreateIMI
(
dict
);
const
auto
&
metadata
=
this
->
GetInput
()
->
GetImageMetadata
();
if
(
m_AtmoCorrectionParameters
->
GetAeronetFileName
()
!=
""
)
m_AtmoCorrectionParameters
->
UpdateAeronetData
(
imageMetadataInterface
->
GetYear
(),
imageMetadataInterface
->
GetHour
(),
imageMetadataInterface
->
GetMinute
());
{
m_AtmoCorrectionParameters
->
UpdateAeronetData
(
metadata
[
MDTime
::
AcquisitionDate
].
GetYear
(),
metadata
[
MDTime
::
AcquisitionDate
].
GetHour
(),
metadata
[
MDTime
::
AcquisitionDate
].
GetMinute
());
}
// Acquisition parameters
if
(
!
m_IsSetAcquiCorrectionParameters
)
// Get info from image metadata
interface
if
(
!
m_IsSetAcquiCorrectionParameters
)
// Get info from image metadata
{
m_AcquiCorrectionParameters
=
AcquiCorrectionParametersType
::
New
();
m_AcquiCorrectionParameters
->
SetSolarZenithalAngle
(
90.
-
imageMetadataInterface
->
GetSunElevation
()
);
m_AcquiCorrectionParameters
->
SetSolarAzimutalAngle
(
imageMetadataInterface
->
GetSunAzimuth
()
);
m_AcquiCorrectionParameters
->
SetViewingZenithalAngle
(
90.
-
imageMetadataInterface
->
GetSatElevation
()
);
m_AcquiCorrectionParameters
->
SetViewingAzimutalAngle
(
imageMetadataInterface
->
GetSatAzimuth
()
);
m_AcquiCorrectionParameters
->
SetSolarZenithalAngle
(
90.
-
metadata
[
MDNum
::
SunElevation
]
);
m_AcquiCorrectionParameters
->
SetSolarAzimutalAngle
(
metadata
[
MDNum
::
SunAzimuth
]
);
m_AcquiCorrectionParameters
->
SetViewingZenithalAngle
(
90.
-
metadata
[
MDNum
::
SatElevation
]
);
m_AcquiCorrectionParameters
->
SetViewingAzimutalAngle
(
metadata
[
MDNum
::
SatAzimuth
]
);
m_AcquiCorrectionParameters
->
SetDay
(
imageMetadataInterface
->
GetDay
());
m_AcquiCorrectionParameters
->
SetMonth
(
imageMetadataInterface
->
GetMonth
());
m_AcquiCorrectionParameters
->
SetDay
(
metadata
[
MDTime
::
AcquisitionDate
].
GetDay
());
m_AcquiCorrectionParameters
->
SetMonth
(
metadata
[
MDTime
::
AcquisitionDate
].
GetMonth
());
if
(
!
SetFilterFunctionValuesFileName
)
{
if
(
imageMetadataInterface
->
GetSpectralSensitivity
()
->
Capacity
()
>
0
)
if
(
metadata
.
HasBandMetadata
(
MDL1D
::
SpectralSensitivity
)
)
{
m_AcquiCorrectionParameters
->
SetWavelengthSpectralBand
(
imageMetadataInterface
->
GetSpectralSensitivity
());
auto
spectralSensitivity
=
AcquiCorrectionParametersType
::
InternalWavelengthSpectralBandVectorType
::
New
();
for
(
const
auto
&
band
:
metadata
.
Bands
)
{
const
auto
&
spectralSensitivityLUT
=
band
[
MDL1D
::
SpectralSensitivity
];
const
auto
&
axis
=
spectralSensitivityLUT
.
Axis
[
0
];
auto
filterFunction
=
FilterFunctionValues
::
New
();
// LUT1D stores a double vector whereas FilterFunctionValues stores a float vector
std
::
vector
<
float
>
vec
(
spectralSensitivityLUT
.
Array
.
begin
(),
spectralSensitivityLUT
.
Array
.
end
());
filterFunction
->
SetFilterFunctionValues
(
vec
);
filterFunction
->
SetMinSpectralValue
(
axis
.
Origin
);
filterFunction
->
SetMaxSpectralValue
(
axis
.
Origin
+
axis
.
Spacing
*
axis
.
Size
);
filterFunction
->
SetUserStep
(
axis
.
Spacing
);
spectralSensitivity
->
PushBack
(
filterFunction
);
}
m_AcquiCorrectionParameters
->
SetWavelengthSpectralBand
(
spectralSensitivity
);
}
else
{
...
...
@@ -152,9 +167,6 @@ void ReflectanceToSurfaceReflectanceImageFilter<TInputImage, TOutputImage>::Upda
itkExceptionMacro
(
<<
"Input must be set before updating the functors"
);
}
MetaDataDictionaryType
dict
=
this
->
GetInput
()
->
GetMetaDataDictionary
();
OpticalImageMetadataInterface
::
Pointer
imageMetadataInterface
=
OpticalImageMetadataInterfaceFactory
::
CreateIMI
(
dict
);
this
->
GetFunctorVector
().
clear
();
for
(
unsigned
int
i
=
0
;
i
<
this
->
GetInput
()
->
GetNumberOfComponentsPerPixel
();
++
i
)
...
...
Modules/Radiometry/OpticalCalibration/include/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.hxx
View file @
7f9b9e2d
...
...
@@ -83,25 +83,41 @@ void SurfaceAdjacencyEffectCorrectionSchemeFilter<TInputImage, TOutputImage>::Up
}
// Acquisition parameters
if
(
!
m_IsSetAcquiCorrectionParameters
)
// Get info from image metadata
interface
if
(
!
m_IsSetAcquiCorrectionParameters
)
// Get info from image metadata
{
MetaDataDictionaryType
dict
=
this
->
GetInput
()
->
GetMetaDataDictionary
();
OpticalImageMetadataInterface
::
Pointer
imageMetadataInterface
=
OpticalImageMetadataInterfaceFactory
::
CreateIMI
(
dict
);
const
auto
&
metadata
=
this
->
GetInput
()
->
GetImageMetadata
();
m_AcquiCorrectionParameters
=
AcquiCorrectionParametersType
::
New
();
m_AcquiCorrectionParameters
->
SetSolarZenithalAngle
(
90.
-
imageMetadataInterface
->
GetSunElevation
());
m_AcquiCorrectionParameters
->
SetSolarAzimutalAngle
(
imageMetadataInterface
->
GetSunAzimuth
());
m_AcquiCorrectionParameters
->
SetViewingZenithalAngle
(
90.
-
imageMetadataInterface
->
GetSatElevation
());
m_AcquiCorrectionParameters
->
SetViewingAzimutalAngle
(
imageMetadataInterface
->
GetSatAzimuth
());
m_AcquiCorrectionParameters
->
SetSolarZenithalAngle
(
90.
-
metadata
[
MDNum
::
SunElevation
]);
m_AcquiCorrectionParameters
->
SetSolarAzimutalAngle
(
metadata
[
MDNum
::
SunAzimuth
]);
m_AcquiCorrectionParameters
->
SetViewingZenithalAngle
(
90.
-
metadata
[
MDNum
::
SatElevation
]);
m_AcquiCorrectionParameters
->
SetViewingAzimutalAngle
(
metadata
[
MDNum
::
SatAzimuth
]);
m_AcquiCorrectionParameters
->
SetDay
(
metadata
[
MDTime
::
AcquisitionDate
].
GetDay
());
m_AcquiCorrectionParameters
->
SetMonth
(
metadata
[
MDTime
::
AcquisitionDate
].
GetMonth
());
m_AcquiCorrectionParameters
->
SetDay
(
imageMetadataInterface
->
GetDay
());
m_AcquiCorrectionParameters
->
SetMonth
(
imageMetadataInterface
->
GetMonth
());
if
(
imageMetadataInterface
->
GetSpectralSensitivity
()
->
Capacity
()
>
0
)
if
(
metadata
.
HasBandMetadata
(
MDL1D
::
SpectralSensitivity
)
)
{
m_AcquiCorrectionParameters
->
SetWavelengthSpectralBand
(
imageMetadataInterface
->
GetSpectralSensitivity
());
auto
spectralSensitivity
=
AcquiCorrectionParametersType
::
InternalWavelengthSpectralBandVectorType
::
New
();
for
(
const
auto
&
band
:
metadata
.
Bands
)
{
const
auto
&
spectralSensitivityLUT
=
band
[
MDL1D
::
SpectralSensitivity
];
const
auto
&
axis
=
spectralSensitivityLUT
.
Axis
[
0
];
auto
filterFunction
=
FilterFunctionValues
::
New
();
// LUT1D stores a double vector whereas FilterFunctionValues stores a float vector
std
::
vector
<
float
>
vec
(
spectralSensitivityLUT
.
Array
.
begin
(),
spectralSensitivityLUT
.
Array
.
end
());
filterFunction
->
SetFilterFunctionValues
(
vec
);
filterFunction
->
SetMinSpectralValue
(
axis
.
Origin
);
filterFunction
->
SetMaxSpectralValue
(
axis
.
Origin
+
axis
.
Spacing
*
axis
.
Size
);
filterFunction
->
SetUserStep
(
axis
.
Spacing
);
spectralSensitivity
->
PushBack
(
filterFunction
);
}
m_AcquiCorrectionParameters
->
SetWavelengthSpectralBand
(
spectralSensitivity
);
}