Getting OTB and Monteverdi
Making use of Orfeo Toolbox
OTB has most of the essential remote sensing tool in one place. OSGEO4W Shell shows you the list of utilities, two set for each tool – command line (otbcli
) and GUI (otbgui
). For example check out the BandMath
tool in each section.
C:\>otbcli_BandMath ERROR: Waiting for at least one parameter... This is the BandMath application, version 5.0.0 Perform a mathematical operation on monoband images Complete documentation: http://www.orfeo-toolbox.org/Applications/BandMath.html Parameters: -progress <boolean> Report progress MISSING -il <string list> Input image list (mandatory) MISSING -out <string> [pixel] Output Image [pixel=uint8/uint16/int16/uint32/int32/float/double] (default value is float) (mandatory) -ram <int32> Available RAM (Mb) (optional, off by default, default value is 128) MISSING -exp <string> Expression (mandatory) -inxml <string> Load otb application from xml file (optional, off by default) Examples: otbcli_BandMath -il verySmallFSATSW_r.tif verySmallFSATSW_nir.tif verySmallFSATSW.tif -out apTvUtBandMathOutput.tif -exp "cos(im1b1)+im2b1*im3b1-im3b2+ndvi(im3b3, im3b4)"
We need to include the MISSING
keywords. The GUI version looks like this.
And similar window can be found in Monteverdi, a standalone software with all the tools that OTB has to offer. Not only that, this software can create models, analyze LiDAR data, edit and process raster attribute tables, vector layers and has many other functionalities which are common in many commercial software.
You can use Python and OTB to process multiple rasters at once.
import os import glob def concatLandsat(dir): band = 3 # The number of desired bands goes here inputTif = sorted(glob.glob(os.path.join(dir, "*.TIF")))[:band] # Here I had to separate each string with white-space and put double quote around each inputImages = ' '.join('"' + x + '"' for x in inputTif) # Took the first image name (LT51370432006355BKT00_B1.TIF) so that I know it later outputImages = os.path.join(dir, inputTif[0])[:-7] + "_concat.tif" os.system('otbcli_ConcatenateImages -il %s -out "%s"' % (inputImages, outputImages)) return folderName = r"C:\Documents and Settings\Landsat_image" concatLandsat(folderName)
Check out the these two set of code to apply Radiometric Indices on an image with RadiometricIndices
.
otbcli_RadiometricIndices -in qb_RoadExtract.tif -list Vegetation:NDVI Vegetation:RVI Vegetation:IPVI -out RadiometricIndicesImage.tif
In Python
>>>import otbApplication >>>RadiometricIndices = otbApplication.Registry.CreateApplication("RadiometricIndices") >>>RadiometricIndices.SetParameterString("in", "qb_RoadExtract.tif", "list", "Vegetation:NDVI", "Vegetation:RVI", "out", "RadiometricIndicesImage.tif") >>>RadiometricIndices.ExecuteAndWriteOutput()
Check out the Orfeo Toolbox Cookbook for more examples. Also check out the official tutorials and the documentation.