Import libraries


In [2]:
import sys
import os
import otbApplication

Show available OTB applications


In [4]:
print otbApplication.Registry.GetAvailableApplications()


('BandMath', 'BinaryMorphologicalOperation', 'BlockMatching', 'BundleToPerfectSensor', 'ClassificationMapRegularization', 'ColorMapping', 'CompareImages', 'ComputeConfusionMatrix', 'ComputeImagesStatistics', 'ComputeModulusAndPhase', 'ComputeOGRLayersFeaturesStatistics', 'ComputePolylineFeatureFromImage', 'ConcatenateImages', 'ConcatenateVectorData', 'ConnectedComponentSegmentation', 'Convert', 'ConvertCartoToGeoPoint', 'ConvertSensorToGeoPoint', 'DEMConvert', 'DSFuzzyModelEstimation', 'Despeckle', 'DimensionalityReduction', 'DisparityMapToElevationMap', 'DomainTransform', 'DownloadSRTMTiles', 'EdgeExtraction', 'ExtractROI', 'FineRegistration', 'FusionOfClassifications', 'GeneratePlyFile', 'GenerateRPCSensorModel', 'GrayScaleMorphologicalOperation', 'GridBasedImageResampling', 'HaralickTextureExtraction', 'HomologousPointsExtraction', 'HooverCompareSegmentation', 'HyperspectralUnmixing', 'ImageClassifier', 'ImageEnvelope', 'KMeansClassification', 'KmzExport', 'LSMSSegmentation', 'LSMSSmallRegionsMerging', 'LSMSVectorization', 'LineSegmentDetection', 'LocalStatisticExtraction', 'ManageNoData', 'MeanShiftSmoothing', 'MorphologicalClassification', 'MorphologicalMultiScaleDecomposition', 'MorphologicalProfilesAnalysis', 'MultiImageSamplingRate', 'MultiResolutionPyramid', 'MultivariateAlterationDetector', 'OGRLayerClassifier', 'OSMDownloader', 'ObtainUTMZoneFromGeoPoint', 'OrthoRectification', 'Pansharpening', 'PixelValue', 'PolygonClassStatistics', 'PredictRegression', 'Quicklook', 'RadiometricIndices', 'Rasterization', 'ReadImageInfo', 'RefineSensorModel', 'Rescale', 'RigidTransformResample', 'SARCalibration', 'SARDeburst', 'SARDecompositions', 'SARPolarMatrixConvert', 'SARPolarSynth', 'SFSTextureExtraction', 'SOMClassification', 'SampleExtraction', 'SampleSelection', 'Segmentation', 'Smoothing', 'SplitImage', 'StereoFramework', 'StereoRectificationGridGenerator', 'Superimpose', 'TestApplication', 'TileFusion', 'TrainImagesClassifier', 'TrainRegression', 'TrainVectorClassifier', 'VectorClassifier', 'VectorDataDSValidation', 'VectorDataExtractROI', 'VectorDataReprojection', 'VectorDataSetField', 'VectorDataTransform', 'VertexComponentAnalysis')

Create application


In [6]:
app = otbApplication.Registry.CreateApplication("Smoothing")

Show application parameters


In [8]:
print app.GetParametersKeys()


('in', 'out', 'ram', 'type', 'type.mean.radius', 'type.gaussian.radius', 'type.anidif.timestep', 'type.anidif.nbiter', 'type.anidif.conductance', 'inxml', 'outxml')

Run appliction and save results


In [10]:
file="/eodata/Landsat-5/TM/L1G/1984/04/06/LS05_RFUI_TM__GEO_1P_19840406T105359_19840406T105428_000524_0207_0018_654F/LS05_RFUI_TM__GEO_1P_19840406T105359_19840406T105428_000524_0207_0018_654F.TIFF/LT52070181984097ESA00_B1.TIF"
app.SetParameterString("in",file)
for type in ['mean']:
    print 'Running with ' + type + ' smoothing type'    
    app.SetParameterString("type", type)    
    app.SetParameterString("out", "out" + type + ".tif")    
    app.ExecuteAndWriteOutput()


Running with mean smoothing type