See the following script. The geom is read by the ReadImageInfo
application. The metadata are then copied into the output image of a smoothing application, and used as input of Orthorectification. It seems to work, but I only tested with a develop build. This should be tested with 7.2 too.
import otbApplication as otb
from sys import argv
inImageFilename = argv[1]
geomFilename = argv[2]
outImageFilename = argv[3]
# Read the geom file
readInfoWithGeom = otb.Registry.CreateApplication("ReadImageInfo")
readInfoWithGeom.SetParameterString("in", inImageFilename + "?&geom=" + geomFilename)
readInfoWithGeom.Execute()
# Get the image metadata
imd = readInfoWithGeom.GetImageMetaData("in")
# Try to use it in a pipeline
smoothing = otb.Registry.CreateApplication("Smoothing")
smoothing.IN = inImageFilename
smoothing.Execute()
imagePtr = smoothing.GetParameterOutputImage("out")
# GetBufferedRegion is not exposed in the wrapper (?) but the buffered region
# is required in SetupImageInformation. Set a default region instead
bufferedRegion = otb.itkRegion()
smoothing.SetupImageInformation(imagePtr,
smoothing.GetImageOrigin("out"),
smoothing.GetImageSpacing("out"),
smoothing.GetImageSize("out"),
bufferedRegion,
imd)
#Print output geom
"""
readInfoOut = otb.Registry.CreateApplication("ReadImageInfo")
readInfoOut.SetParameterInputImage("in", imagePtr)
readInfoOut.Execute()
"""
orthoRectification = otb.Registry.CreateApplication("OrthoRectification")
orthoRectification.SetParameterInputImage("io.in", imagePtr)
orthoRectification.SetParameterString("io.out", outImageFilename)
orthoRectification.ExecuteAndWriteOutput()