PythonRescaleTest.py 743 Bytes
Newer Older
1 2 3
# -*- coding: utf-8 -*-

#
4
#  Example on the use of the Rescale
5
#
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

import os
import sys
if os.name == 'posix':
  orig_dlopen_flags = sys.getdlopenflags()
  try:
    import dl
  except ImportError:
    try:
      import DLFCN as dl
    except ImportError:
      dl = None
  if dl:
    sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL)
  # now load the module !
  import otbApplication as otb
  sys.setdlopenflags(orig_dlopen_flags)
  del dl
  del orig_dlopen_flags
else:
  import otbApplication as otb
Cyrille Valladeau's avatar
Cyrille Valladeau committed
27

Julien Malik's avatar
Julien Malik committed
28
app = otb.Registry.CreateApplication("Rescale")
29

30
app.SetParameterString("in", sys.argv[1])
31 32
app.SetParameterFloat("outmin", 1)
app.SetParameterFloat("outmax", 100)
33
app.SetParameterString("out", sys.argv[2] + ".tif")
Julien Malik's avatar
Julien Malik committed
34

35
app.ExecuteAndWriteOutput()