Commit 6683c484 authored by Julien Osman's avatar Julien Osman
Browse files

Merge branch 'improve_tests_InverseForwardSensorModel' into 'develop'

Improve tests prTvTestCreateInverseForwardSensorModel

See merge request orfeotoolbox/otb!776
parents b8367b7e 3ad1c0f0
Pipeline #6357 failed with stages
in 67 minutes and 45 seconds
Testing geopoint: [3.740934, 44.107956]
Testing InverseSensorModel: [3.740934, 44.107956] -> [14190.558, 13591.703]
Testing ForwardSensorModel: [14190.558, 13591.703] -> [3.7409338, 44.107956]
Testing geopoint: [1.4434869, 43.604688]
Testing InverseSensorModel: [1.4434869, 43.604688] -> [11234.024, 8199.2289]
Testing ForwardSensorModel: [11234.024, 8199.2289] -> [1.4434838, 43.604235]
Testing geopoint: [1.4434869, 43.604688]
Testing InverseSensorModel: [1.4434869, 43.604688] -> [11234.662, 8124.3911]
Testing ForwardSensorModel: [11234.662, 8124.3911] -> [1.4434869, 43.604688]
...@@ -63,13 +63,37 @@ otb_add_test(NAME prTvGenericRSTransformWithSRID COMMAND otbTransformTestDriver ...@@ -63,13 +63,37 @@ otb_add_test(NAME prTvGenericRSTransformWithSRID COMMAND otbTransformTestDriver
) )
otb_add_test(NAME prTvTestCreateInverseForwardSensorModel_Cevennes COMMAND otbTransformTestDriver otb_add_test(NAME prTvTestCreateInverseForwardSensorModel_Cevennes COMMAND otbTransformTestDriver
--compare-ascii ${EPSILON_4}
${BASELINE_FILES}/prTvTestCreateInverseForwardSensorModel_Cevennes.txt
${TEMP}/prTvTestCreateInverseForwardSensorModel_Cevennes.txt
otbCreateInverseForwardSensorModel otbCreateInverseForwardSensorModel
LARGEINPUT{QUICKBIRD/CEVENNES/06FEB12104912-P1BS-005533998070_01_P001.TIF} LARGEINPUT{QUICKBIRD/CEVENNES/06FEB12104912-P1BS-005533998070_01_P001.TIF}
${TEMP}/prTvTestCreateInverseForwardSensorModel_Cevennes.txt
3.740934
44.107956
) )
otb_add_test(NAME prTvTestCreateInverseForwardSensorModel_Toulouse COMMAND otbTransformTestDriver otb_add_test(NAME prTvTestCreateInverseForwardSensorModel_Toulouse COMMAND otbTransformTestDriver
--compare-ascii ${EPSILON_4}
${BASELINE_FILES}/prTvTestCreateInverseForwardSensorModel_Toulouse.txt
${TEMP}/prTvTestCreateInverseForwardSensorModel_Toulouse.txt
otbCreateInverseForwardSensorModel
LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF}
${TEMP}/prTvTestCreateInverseForwardSensorModel_Toulouse.txt
1.44348693
43.60468837
)
otb_add_test(NAME prTvTestCreateInverseForwardSensorModel_DEM COMMAND otbTransformTestDriver
--compare-ascii ${EPSILON_4}
${BASELINE_FILES}/prTvTestCreateInverseForwardSensorModel_DEM.txt
${TEMP}/prTvTestCreateInverseForwardSensorModel_DEM.txt
otbCreateInverseForwardSensorModel otbCreateInverseForwardSensorModel
LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF} LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF}
${TEMP}/prTvTestCreateInverseForwardSensorModel_DEM.txt
1.44348693
43.60468837
${INPUTDATA}/DEM/srtm_directory/N43E001.hgt
) )
otb_add_test(NAME prTvTestCreateProjectionWithOSSIM_Cevennes COMMAND otbTransformTestDriver otb_add_test(NAME prTvTestCreateProjectionWithOSSIM_Cevennes COMMAND otbTransformTestDriver
...@@ -151,7 +175,6 @@ set(FWDBWDChecking_INPUTS ...@@ -151,7 +175,6 @@ set(FWDBWDChecking_INPUTS
#LARGEINPUT{RAPIDEYE/level3A/2008-12-25T005918_RE3_3A-NAC_752656_40091.tif} #LARGEINPUT{RAPIDEYE/level3A/2008-12-25T005918_RE3_3A-NAC_752656_40091.tif}
) )
otb_add_test(NAME bfTvInverseLogPolarTransform COMMAND otbTransformTestDriver otb_add_test(NAME bfTvInverseLogPolarTransform COMMAND otbTransformTestDriver
--compare-ascii ${NOTOL} --compare-ascii ${NOTOL}
${BASELINE_FILES}/bfInverseLogPolarTransformResults.txt ${BASELINE_FILES}/bfInverseLogPolarTransformResults.txt
......
...@@ -18,16 +18,6 @@ ...@@ -18,16 +18,6 @@
* limitations under the License. * limitations under the License.
*/ */
/*!
*
* PURPOSE:
*
* Application to rproject an image region into gepgraphical coordinates
* usinf un Interpolator+regionextractor and an Iterator.
*
*/
// iostream is used for general output // iostream is used for general output
#include <iostream> #include <iostream>
#include <iterator> #include <iterator>
...@@ -40,12 +30,24 @@ ...@@ -40,12 +30,24 @@
#include "otbInverseSensorModel.h" #include "otbInverseSensorModel.h"
#include "otbForwardSensorModel.h" #include "otbForwardSensorModel.h"
#include "otbDEMHandler.h"
int otbCreateInverseForwardSensorModel(int argc, char* argv[]) int otbCreateInverseForwardSensorModel(int argc, char* argv[])
{ {
if (argc != 2)
std::string InputFilename, OutputFilename, pointX, pointY;
switch (argc)
{ {
std::cout << argv[0] << " <input filename>" << std::endl; case 6 :
otb::DEMHandler::GetInstance().OpenDEMFile(argv[5]);
case 5 :
InputFilename = argv[1];
OutputFilename = argv[2];
pointX = argv[3];
pointY = argv[4];
break;
default :
std::cout << argv[0] << " <input filename> <output filename> <test_point_X> <test_point_Y> [optional DEM path]\n";
return EXIT_FAILURE; return EXIT_FAILURE;
} }
...@@ -60,7 +62,7 @@ int otbCreateInverseForwardSensorModel(int argc, char* argv[]) ...@@ -60,7 +62,7 @@ int otbCreateInverseForwardSensorModel(int argc, char* argv[])
ReaderType::Pointer reader = ReaderType::New(); ReaderType::Pointer reader = ReaderType::New();
// Set parameters ... // Set parameters ...
reader->SetFileName(argv[1]); reader->SetFileName(InputFilename);
// Read meta data (ossimKeywordlist) // Read meta data (ossimKeywordlist)
reader->GenerateOutputInformation(); reader->GenerateOutputInformation();
...@@ -82,5 +84,20 @@ int otbCreateInverseForwardSensorModel(int argc, char* argv[]) ...@@ -82,5 +84,20 @@ int otbCreateInverseForwardSensorModel(int argc, char* argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
std::ofstream ofs(OutputFilename, std::ofstream::out);
ofs.precision(8);
InverseModelType::InputPointType geoPoint;
geoPoint[0] = atof(pointX.c_str());
geoPoint[1] = atof(pointY.c_str());
ofs << "Testing geopoint: " << geoPoint << "\n\n";
auto indexPoint = inverse_model->TransformPoint(geoPoint);
ofs << "Testing InverseSensorModel: " << geoPoint << " -> " << indexPoint << "\n";
auto newGeoPoint = forward_model->TransformPoint(indexPoint);
ofs << "Testing ForwardSensorModel: " << indexPoint << " -> " << newGeoPoint << "\n";
return EXIT_SUCCESS; return EXIT_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