Commit 4b48ea30 authored by Julien Osman's avatar Julien Osman
Browse files

TEST: Regenerate the baseline for the new tests GDALRPCTransformer2

parent 7d24cd40
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -274,8 +274,8 @@ otb_add_test(NAME ioTvGDALRPCTransformerTest_ikonos
otbGDALRPCTransformerTest2
${INPUTDATA}/ikonos/ikonos-1.geom # Geom
${INPUTDATA}/ikonos/ikonos-1.gcp2 # GCP
1 # GeoTol
1 # ImgTol
0.04 # GeoTol
0.1 # ImgTol
)
otb_add_test(NAME ioTvGDALRPCTransformerTest_quickbird
......@@ -283,8 +283,8 @@ otb_add_test(NAME ioTvGDALRPCTransformerTest_quickbird
otbGDALRPCTransformerTest2
${INPUTDATA}/QB/qb-1.geom # Geom
${INPUTDATA}/QB/qb-1.gcp2 # GCP
1 # GeoTol
1 # ImgTol
0.024 # GeoTol
0.1 # ImgTol
)
otb_add_test(NAME ioTvGDALRPCTransformerTest_spot6
......@@ -292,8 +292,8 @@ otb_add_test(NAME ioTvGDALRPCTransformerTest_spot6
otbGDALRPCTransformerTest2
${INPUTDATA}/spot6/spot6-1.geom # Geom
${INPUTDATA}/spot6/spot6-1.gcp2 # GCP
1 # GeoTol
1 # ImgTol
0.06 # GeoTol
0.1 # ImgTol
)
otb_add_test(NAME ioTvGDALRPCTransformerTest_worldview2
......@@ -301,8 +301,8 @@ otb_add_test(NAME ioTvGDALRPCTransformerTest_worldview2
otbGDALRPCTransformerTest2
${INPUTDATA}/wv2/wv2-1.geom # Geom
${INPUTDATA}/wv2/wv2-1.gcp2 # GCP
1 # GeoTol
1 # ImgTol
0.0185 # GeoTol
0.1 # ImgTol
)
otb_add_test(NAME ioTvGDALRPCTransformerTest_pl_hnord
......@@ -310,7 +310,7 @@ otb_add_test(NAME ioTvGDALRPCTransformerTest_pl_hnord
otbGDALRPCTransformerTest2
${INPUTDATA}/pleiades/pleiades-1.geom # Geom
${INPUTDATA}/pleiades/pleiades-1.gcp2 # GCP
1 # GeoTol
1 # ImgTol
0.02 # GeoTol
0.1 # ImgTol
)
......@@ -27,15 +27,18 @@
#include "otbGeomMetadataSupplier.h"
#include "otbImageMetadataInterfaceFactory.h"
#include "otbMacro.h"
#include "otbDEMHandler.h"
//typedef otb::Image<double> ImageType;
typedef std::list<itk::Point<double, 3>> pointsContainerType;
typedef std::vector<itk::Point<double, 3>> pointsContainerType;
typedef itk::Statistics::EuclideanDistanceMetric<otb::GDALRPCTransformer::PointType> DistanceType;
typedef otb::GeographicalDistance<otb::GDALRPCTransformer::PointType> GeographicalDistanceType;
int otbGDALRPCTransformerTest2(int itkNotUsed(argc), char* argv[])
{
bool success = true;
otb::GDALRPCTransformer::PointType imagePoint;
otb::GDALRPCTransformer::PointType geo3dPoint;
// Inputs
std::string inputGeomFile(argv[1]);
......@@ -58,6 +61,7 @@ int otbGDALRPCTransformerTest2(int itkNotUsed(argc), char* argv[])
auto rpcModel = boost::any_cast<otb::Projection::RPCParam>(imd[otb::MDGeom::RPC]);
// Setting the RPCTransformer
// otb::DEMHandler::GetInstance().SetDefaultHeightAboveEllipsoid(0.0);
otb::GDALRPCTransformer transformer(rpcModel.LineOffset, rpcModel.SampleOffset, rpcModel.LatOffset, rpcModel.LonOffset, rpcModel.HeightOffset,
rpcModel.LineScale, rpcModel.SampleScale, rpcModel.LatScale, rpcModel.LonScale, rpcModel.HeightScale,
rpcModel.LineNum, rpcModel.LineDen, rpcModel.SampleNum, rpcModel.SampleDen, false);
......@@ -68,10 +72,7 @@ int otbGDALRPCTransformerTest2(int itkNotUsed(argc), char* argv[])
std::ifstream file(gcpFileName, std::ios::in);
if (file)
{
otb::GDALRPCTransformer::PointType imagePoint;
otb::GDALRPCTransformer::PointType geo3dPoint;
std::string line;
imagePoint[2] = rpcModel.HeightOffset;
while (getline(file, line))
{
if (line.find_first_of("#") != 0)
......@@ -79,6 +80,7 @@ int otbGDALRPCTransformerTest2(int itkNotUsed(argc), char* argv[])
std::istringstream iss(line);
iss >> imagePoint[0] >> imagePoint[1] >> geo3dPoint[0] >> geo3dPoint[1] >> geo3dPoint[2];
imagePoint[2] = geo3dPoint[2];
pointsContainer.push_back(imagePoint);
geo3dPointsContainer.push_back(geo3dPoint);
......@@ -88,35 +90,32 @@ int otbGDALRPCTransformerTest2(int itkNotUsed(argc), char* argv[])
}
// For each CGP
pointsContainerType::iterator pointsIt = pointsContainer.begin();
pointsContainerType::iterator geo3dPointsIt = geo3dPointsContainer.begin();
while ((pointsIt != pointsContainer.end()) && (geo3dPointsIt != geo3dPointsContainer.end()))
for (pointsContainerType::iterator pointsIt = pointsContainer.begin(), geo3dPointsIt = geo3dPointsContainer.begin() ;
(pointsIt != pointsContainer.end()) && (geo3dPointsIt != geo3dPointsContainer.end()) ;
++pointsIt, ++geo3dPointsIt)
{
otbLogMacro(Debug, << "Point: " << *pointsIt << " GeoPoint: " << *geo3dPointsIt);
// std::cout << "Point: " << *pointsIt << " GeoPoint: " << *geo3dPointsIt << "\n";
// Testing forward transform
otbLogMacro(Debug, << "ForwardTransform: " << transformer.ForwardTransform(*pointsIt));
auto forwardPointDistance = geoDistance->Evaluate(transformer.ForwardTransform(*pointsIt), *geo3dPointsIt);
otbLogMacro(Debug, << "forwardPointDistance: " << forwardPointDistance);
geo3dPoint = transformer.ForwardTransform(*pointsIt);
auto forwardPointDistance = geoDistance->Evaluate(geo3dPoint, *geo3dPointsIt);
if (forwardPointDistance > geoTol)
{
std::cerr << "Geo distance between otbGDALRPCTransformer->ForwardTransform and GCP too high : "
std::cerr << "Geo distance between otbGDALRPCTransformer->ForwardTransform and GCP too high :\n"
<< "GCP: " << *geo3dPointsIt << " / computed: " << geo3dPoint << "\n"
<< "dist = " << forwardPointDistance << " (tol = " << geoTol << ")" << std::endl;
success = false;
}
// Testing inverse transform
otbLogMacro(Debug, << "InverseTransform: " << transformer.InverseTransform(*geo3dPointsIt));
auto inversePointDistance = distance->Evaluate(transformer.InverseTransform(*geo3dPointsIt), *pointsIt);
otbLogMacro(Debug, << "inversePointDistance: " << inversePointDistance);
imagePoint = transformer.InverseTransform(*geo3dPointsIt);
auto inversePointDistance = distance->Evaluate(imagePoint, *pointsIt);
if (inversePointDistance > imgTol)
{
std::cerr << "Distance between otbGDALRPCTransformer->InverseTransform and GCP too high : "
std::cerr << "Distance between otbGDALRPCTransformer->InverseTransform and GCP too high :\n"
<< "GCP: " << *pointsIt << " / computed: " << imagePoint << "\n"
<< "dist = " << inversePointDistance << " (tol = " << imgTol << ")" << std::endl;
success = false;
}
++pointsIt;
++geo3dPointsIt;
}
if (success)
......
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