From 25c6e340c00e9ef66496ad0f57120924ea2e3f58 Mon Sep 17 00:00:00 2001 From: Otmane Lahlou <otmane.lahlou@c-s.fr> Date: Fri, 21 Oct 2011 18:12:32 +0200 Subject: [PATCH] ADD: Orthorectification test in python --- Testing/Code/Wrappers/Python/CMakeLists.txt | 27 +++++++++++++- .../Python/PythonOrthoRectification.py | 37 +++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 Testing/Code/Wrappers/Python/PythonOrthoRectification.py diff --git a/Testing/Code/Wrappers/Python/CMakeLists.txt b/Testing/Code/Wrappers/Python/CMakeLists.txt index 7712470a3d..a15b285395 100644 --- a/Testing/Code/Wrappers/Python/CMakeLists.txt +++ b/Testing/Code/Wrappers/Python/CMakeLists.txt @@ -4,6 +4,10 @@ SET(BASELINE_FILES ${OTB_DATA_ROOT}/Baseline/OTB/Files) SET(INPUTDATA ${OTB_DATA_ROOT}/Input) SET(TEMP ${OTBTesting_BINARY_DIR}/Temporary) +IF(OTB_DATA_USE_LARGEINPUT) + SET(LARGEINPUT ${OTB_DATA_LARGEINPUT_ROOT} ) +ENDIF(OTB_DATA_USE_LARGEINPUT) + set(TEST_DRIVER otbTestDriver --add-before-env PYTHONPATH "${CMAKE_BINARY_DIR}/Code/Wrappers/SWIG" @@ -40,4 +44,25 @@ add_test( NAME pyTvHyperspectralUnmixingFCLS 5 fcls ) - \ No newline at end of file + +IF(OTB_DATA_USE_LARGEINPUT) +add_test( NAME pyTvOrthoRectification_UTM + COMMAND ${TEST_DRIVER} + --compare-image 0.0 + ${BASELINE}/owTvOrthorectifTest_UTM.tif + ${TEMP}/pyTvOrthorectifTest_UTM.tif + Execute + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonOrthoRectification.py + ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF + ${TEMP}/pyTvOrthorectifTest_UTM.tif + 374100.8 + 4829184.8 + 500 + 500 + 0.5 + -0.5 + utm + 4 + ${INPUTDATA}/DEM/srtm_directory/ + ) +ENDIF(OTB_DATA_USE_LARGEINPUT) \ No newline at end of file diff --git a/Testing/Code/Wrappers/Python/PythonOrthoRectification.py b/Testing/Code/Wrappers/Python/PythonOrthoRectification.py new file mode 100644 index 0000000000..1a245d6464 --- /dev/null +++ b/Testing/Code/Wrappers/Python/PythonOrthoRectification.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +# +# Example on the use of the Rescale +# +from sys import argv +import otbApplication as otb + +app = otb.Registry.CreateApplication("OrthoRectification") + +app.SetParameterString("in", argv[1]) +app.SetParameterString("out", argv[2] + ".tif") +app.SetParameterFloat("outputs.ulx",float(argv[3])) +app.SetParameterFloat("outputs.uly",float(argv[4])) +app.SetParameterInt("outputs.sizex",int(argv[5])) +app.SetParameterInt("outputs.sizey",int(argv[6])) +app.SetParameterFloat("outputs.spacingx",float(argv[7])) +app.SetParameterFloat("outputs.spacingy",float(argv[8])) + +app.SetParameterString("map", argv[9]) +app.SetParameterString("dem", argv[10]) + +app.ExecuteAndWriteOutput() + +print dir(app) + +# print some values +print app.GetParameterRole() +print app.GetDocName() +print app.GetDocLongDescription() +print app.DocCLExample() +print app.DocAuthors() +print app.DocLimitations() +print app.DocSeeAlso() + +print app.GetParameterOutputImagePixelType("out") +print app.GetParameterOutputImagePixelType("int") # dummy -- GitLab