Commit 7bfe8dd1 authored by Julien Osman's avatar Julien Osman
Browse files

Merge branch '2159' into 'develop'

Use SAR metadata in SarRadiometricCalibrationToImageFilter

Closes #2159

See merge request !807
parents a1b83a0f 9a2f068a
Pipeline #7881 passed with stages
in 96 minutes and 42 seconds
mytime : 2009-08-10T10:30:08.142149Z
First try size: 608
Second try size: 312
Third try size: 312
First try size: 496
Second try size: 256
Third try size: 256
OrthoRectification
Output Cartographic Map Projection
12
......@@ -14,3 +14,4 @@ RadarFrequency 9.6e+09
AcquisitionStartTime 2011-04-18T18:03:27.915976Z
AcquisitionStopTime 2011-04-18T18:03:29.380925Z
SAR <SARParam>
SARCalib <SARCalib>
......@@ -2,14 +2,16 @@ SensorID SAR
Mission RADARSAT-2
Instrument RADARSAT-2
ProductType SLC
Polarization HH
OrbitDirection Descending
BeamMode FQ9
TileHintX 2822
TileHintY 185
DataType 11
DataType 4
NumberOfLines 12953
NumberOfColumns 2822
AverageSceneHeight 453.201
CalScale 1
PRF 0
RSF 0
RadarFrequency 0
......@@ -18,16 +20,10 @@ LineSpacing 4.8254
PixelSpacing 4.73308
ProductionDate 2008-04-05T13:35:50Z
AcquisitionStartTime 2008-04-05T12:49:00.995676Z
SAR <SARParam>
SARCalib <SARCalib>
GCP <GCPParam>
Extra.FACILITY_IDENTIFIER GATN
Polarization HH
SAR <SARParam>
Polarization VV
SAR <SARParam>
Polarization HV
SAR <SARParam>
Polarization VH
SAR <SARParam>
{"Projection": "GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]",
[{"GCP_Id": "1", "GCP_Info": "", "GCP_Row": "0.5", "GCP_Col": "0.5", "GCP_X": "-97.5857", "GCP_Y": "49.4039", "GCP_Z": "453.201", },
{"GCP_Id": "2", "GCP_Info": "", "GCP_Row": "0.5", "GCP_Col": "217.5", "GCP_X": "-97.5577", "GCP_Y": "49.4002", "GCP_Z": "453.201", },
......
SensorID SAR
Mission S1A
Instrument SENTINEL-1
Instrument S1A
ProductType SLC
Polarization VV
Mode S6
Swath S6
OrbitDirection ASCENDING
......@@ -11,23 +12,23 @@ TileHintX 17663
TileHintY 1
DataType 11
OrbitNumber 6447
NumberOfLines 31106
NumberOfColumns 17663
AverageSceneHeight 19
CalScale 1
PRF 1663.48
RadarFrequency 5.405e+09
CenterIncidenceAngle 44.7171
LineSpacing 4.08568
PixelSpacing 3.19483
AcquisitionDate 2015-06-19T19:50:43.223221Z
ProductionDate 2015-06-20T01:51:06.838854Z
AcquisitionStartTime 2015-06-19T19:50:43.223221Z
AcquisitionStopTime 2015-06-19T19:51:01.921994Z
SAR <SARParam>
SARCalib <SARCalib>
GCP <GCPParam>
Extra.FACILITY_IDENTIFIER UPA_
Polarization VV
Swath S6
NumberOfLines 31106
NumberOfColumns 17663
AverageSceneHeight 19
CalScale 1
PRF 1663.48
RadarFrequency 5.405e+09
SAR <SARParam>
{"Projection": "GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]",
[{"GCP_Id": "1", "GCP_Info": "", "GCP_Row": "0", "GCP_Col": "0", "GCP_X": "-24.4551", "GCP_Y": "14.4996", "GCP_Z": "0", },
{"GCP_Id": "2", "GCP_Info": "", "GCP_Row": "0", "GCP_Col": "884", "GCP_X": "-24.4171", "GCP_Y": "14.5067", "GCP_Z": "0", },
......@@ -953,4 +954,4 @@ SAR <SARParam>
{"GCP_Id": "922", "GCP_Info": "", "GCP_Row": "31105", "GCP_Col": "15912", "GCP_X": "-24.0138", "GCP_Y": "15.7509", "GCP_Z": "0", },
{"GCP_Id": "923", "GCP_Info": "", "GCP_Row": "31105", "GCP_Col": "16796", "GCP_X": "-23.9781", "GCP_Y": "15.7574", "GCP_Z": "0", },
{"GCP_Id": "924", "GCP_Info": "", "GCP_Row": "31105", "GCP_Col": "17662", "GCP_X": "-23.9432", "GCP_Y": "15.7638", "GCP_Z": "0", },
]}
\ No newline at end of file
]}
SensorID SAR
Mission TSX-1
ProductType SSC____SM_S
Polarization HH
Mode SM
OrbitDirection DESCENDING
TileHintX 15328
TileHintY 1
DataType 11
OrbitNumber 4091
NumberOfLines 32710
NumberOfColumns 15328
CalScale 1.04345e-05
CalFactor 1.04345e-05
PRF 3832.52
RSF 1.09886e+08
RadarFrequency 9.65e+09
LineSpacing 1.84541
PixelSpacing 1.36411
RangeTimeFirstPixel 0.00422717
RangeTimeLastPixel 0.00436665
AcquisitionStartTime 2008-03-10T13:32:20.083162Z
AcquisitionStopTime 2008-03-10T13:32:28.617747Z
GCP <GCPParam>
Polarization HH
SAR <SARParam>
SARCalib <SARCalib>
GCP <GCPParam>
{"Projection": "GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]",
[{"GCP_Id": "1", "GCP_Info": "", "GCP_Row": "1", "GCP_Col": "1", "GCP_X": "-111.665", "GCP_Y": "36.2693", "GCP_Z": "0", },
{"GCP_Id": "2", "GCP_Info": "", "GCP_Row": "1", "GCP_Col": "232", "GCP_X": "-111.671", "GCP_Y": "36.2701", "GCP_Z": "0", },
......
This diff is collapsed.
......@@ -63,7 +63,7 @@ process:
+------------------------------------------------------------------+-----------------------+----------------------------+--------------------------+
| `MuParserX <http://muparserx.beltoforion.de>`_ | No | 4.0.7 | 4.0.7 |
+------------------------------------------------------------------+-----------------------+----------------------------+--------------------------+
| `OpenCV <http://opencv.org>`_ | No | 3.0.0 | 4.1.1 |
| `OpenCV <http://opencv.org>`_ | No | 3.0.0 | 4.5.1 |
+------------------------------------------------------------------+-----------------------+----------------------------+--------------------------+
| `OPENGL <https://www.opengl.org/>`_ | No | | |
+------------------------------------------------------------------+-----------------------+----------------------------+--------------------------+
......
......@@ -19,4 +19,7 @@
#
project(OTBBoostAdapters)
set(OTBBoostAdapters_LIBRARIES OTBBoostAdapters)
otb_module_impl()
/*
* Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ossimDateTime_h
#define ossimDateTime_h
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/config.hpp>
#include "otbOperatorUtilities.h"
// boost::posix_time::time_duration doesn't have a sufficient precision to
// store things such an azimuth time interval, and yet, this IS a duration.
// Hence this new class injected into boost namespace to emulate a duration
// with precision behind the microsecond.
namespace boost { namespace posix_time {
class precise_duration;
double ratio_(precise_duration const& lhs, precise_duration const& rhs);
class precise_duration
: private boostAdapter::addable<precise_duration>
, private boostAdapter::substractable<precise_duration>
, private boostAdapter::streamable<precise_duration>
, private boostAdapter::multipliable2<precise_duration, double>
, private boostAdapter::dividable<precise_duration, double>
, private boostAdapter::equality_comparable<precise_duration>
, private boostAdapter::less_than_comparable<precise_duration>
, private boostAdapter::addable<ptime, precise_duration>
, private boostAdapter::substractable<ptime, precise_duration>
{
public:
typedef double scalar_type;
/**@name Construction/destruction
*/
//@{
/** Initialization constructor.
*/
precise_duration() {} // = default;
explicit precise_duration(double usec_frac)
: m_usec_frac(usec_frac) {}
precise_duration(time_duration const& d)
: m_usec_frac(d.total_microseconds()) {}
//@}
double total_seconds() const {
return total_microseconds() / 1000000.;
}
double total_microseconds() const {
return m_usec_frac;
}
bool is_negative() const { return total_microseconds() < 0.0; }
precise_duration invert_sign() { return precise_duration(- total_seconds()); }
std::ostream & display(std::ostream & os) const { return os << m_usec_frac; }
std::istream & read (std::istream & is) { return is >> m_usec_frac; }
protected:
/**@name Operations
*/
//@{
void add(precise_duration const& rhs) { m_usec_frac += rhs.total_microseconds(); }
void sub(precise_duration const& rhs) { m_usec_frac -= rhs.total_microseconds(); }
void mult(scalar_type coeff) { m_usec_frac *= coeff; }
void div(scalar_type coeff) { assert(coeff && "Cannot divide by 0"); m_usec_frac /= coeff; }
friend precise_duration& operator+=(precise_duration & u, precise_duration const& v) {
u.add(v);
return u;
}
friend ptime& operator+=(ptime & u, precise_duration const& v) {
const time_duration d = microseconds(static_cast<int> (floor(v.total_microseconds()+0.5)));
u += d;
return u;
}
friend precise_duration& operator-=(precise_duration & u, precise_duration const& v) {
u.sub(v);
return u;
}
friend ptime& operator-=(ptime & u, precise_duration const& v) {
const time_duration d = microseconds(static_cast<int>( floor(v.total_microseconds()+0.5)));
u -= d;
return u;
}
template <typename U, typename V> static U diff(V const& lhs, V const& rhs) {
U const res(lhs.total_microseconds() - rhs.total_microseconds());
return res;
}
friend precise_duration& operator*=(precise_duration & u, scalar_type const& v) {
u.mult(v);
return u;
}
friend precise_duration& operator/=(precise_duration & u, scalar_type const& v) {
u.div(v);
return u;
}
friend bool operator<(precise_duration const& lhs, precise_duration const& rhs) {
return lhs.total_microseconds() < rhs.total_microseconds();
}
friend bool operator==(precise_duration const& lhs, precise_duration const& rhs) {
return lhs.total_microseconds() == rhs.total_microseconds();
}
public:
friend scalar_type ratio_(precise_duration const& lhs, precise_duration const& rhs)
{ return lhs.total_microseconds() / rhs.total_microseconds(); }
//@}
private:
double m_usec_frac;
};
time_duration abs(time_duration d);
}
} // boost::time namespaces
namespace otb
{
namespace MetaData
{
using TimeType = boost::posix_time::ptime;
using DurationType = boost::posix_time::precise_duration;
}
}
#endif
/*
* Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbOperatorUtilities_h
#define otbOperatorUtilities_h
#include <iostream>
namespace boostAdapter {
// Uses Barton-Nackman trick to help implement operator on classes
// Strongly inspired by boost.operators interface
//TODO: imported from ossim plugins, but can we use boost instead ?
#define DEFINE_OPERATORS(name, compound, op) \
template <typename T> struct name ## 1 \
{ \
friend T operator op(T lhs, T const& rhs) { \
lhs compound rhs; \
return lhs; \
} \
}; \
template <typename T, typename U> struct name ## 2 \
{ \
friend T operator op(T lhs, U const& rhs) { \
lhs compound rhs; \
return lhs; \
} \
friend T operator op(U const& lhs, T rhs) { \
rhs compound lhs; \
return rhs; \
} \
}; \
template <typename T, typename U=void> struct name : name ## 2<T,U> {}; \
template <typename T> struct name<T,void> : name ## 1<T> {};
template <typename U, typename V> struct substractable_asym
{
friend U operator-(V const& lhs, V const& rhs) {
return V::template diff<U,V>(lhs, rhs);
}
};
DEFINE_OPERATORS(addable, +=, +);
DEFINE_OPERATORS(substractable, -=, -);
DEFINE_OPERATORS(multipliable, *=, *);
#undef DEFINE_OPERATORS
template <typename T, typename R> struct dividable {
typedef R scalar_type;
friend T operator/(T lhs, scalar_type const& rhs) {
lhs /= rhs;
return lhs;
}
friend scalar_type operator/(T const& lhs, T const& rhs) {
return ratio_(lhs, rhs);
}
};
template <typename T> struct streamable {
friend std::ostream & operator<<(std::ostream & os, const T & v)
{ return v.display(os); }
friend std::istream & operator>>(std::istream & is, T & v)
{ return v.read(is); }
};
template <typename T> struct less_than_comparable {
friend bool operator>(T const& lhs, T const& rhs) {
return rhs < lhs;
}
friend bool operator>=(T const& lhs, T const& rhs) {
return !(lhs < rhs);
}
friend bool operator<=(T const& lhs, T const& rhs) {
return !(rhs < lhs);
}
};
template <typename T> struct equality_comparable {
friend bool operator!=(T const& lhs, T const& rhs) {
return !(rhs == lhs);
}
};
}// namespace boostAdapter
#endif // otbOperatorUtilities_h
......@@ -21,10 +21,9 @@
set(DOCUMENTATION "Adapters for the Boost library.")
otb_module(OTBBoostAdapters
ENABLE_SHARED
DEPENDS
OTBBoost
DESCRIPTION
"${DOCUMENTATION}"
)
#
# Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set(OTBBoostAdapters_SRC
otbDateTime.cxx
)
add_library(OTBBoostAdapters ${OTBBoostAdapters_SRC})
target_link_libraries(OTBBoostAdapters
${OTBBoost_LIBRARIES}
)
otb_module_target(OTBBoostAdapters)
/*
* Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "otbDateTime.h"
namespace boost
{
namespace posix_time
{
time_duration abs(time_duration d)
{
if(d.is_negative())
d = d.invert_sign();
return d;
}
}
}
\ No newline at end of file
......@@ -132,6 +132,22 @@ public:
static SpatialReference FromUTM(unsigned int zone, hemisphere hem);
/**
* \brief Build a SpatialReference from the datum, ellipsoid, prime meridian and angular units
*
* See OGRSpatialReference::SetGeogCS for more details.
*
* \param GeogName user visible name for the geographic coordinate system
* \param DatumName key name for this datum.
* \param SpheroidName user visible spheroid name
* \param SemiMajor the semi major axis of the spheroid
* \param InvFlattening the inverse flattening for the spheroid
* \throws InvalidSRDescriptionException in case of failure of FromGeogCS()
*/
static SpatialReference FromGeogCS(const std::string& GeogName, const std::string& DatumName,
const std::string& SpheroidName, const double SemiMajor,
const double InvFlattening);
/// Copy constructor
SpatialReference(const SpatialReference& other) noexcept;
......
......@@ -185,6 +185,22 @@ SpatialReference SpatialReference::FromUTM(unsigned int zone, hemisphere hem)
return SpatialReference(std::move(tmpSR));
}
SpatialReference SpatialReference::FromGeogCS(const std::string& GeogName, const std::string& DatumName,
const std::string& SpheroidName, const double SemiMajor,
const double InvFlattening)
{
OGRSpatialReferencePtr tmpSR(new OGRSpatialReference());
OGRErr code = tmpSR->SetGeogCS(GeogName.c_str(), DatumName.c_str(), SpheroidName.c_str(), SemiMajor, InvFlattening);
if (code != OGRERR_NONE)
{
std::ostringstream oss;
oss << "(InvalidSRDescriptionException) "
<< "FromGeogCS(" << GeogName << ", " << DatumName << ", " << SpheroidName << ", " << SemiMajor << ", " << InvFlattening << ")";
throw std::runtime_error(oss.str());
}
return SpatialReference(std::move(tmpSR));
}
std::string SpatialReference::ToWkt() const
{
char* cwkt;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment