Performs morphological operations on a grayscale input image


This application performs grayscale morphological operations on a mono band image

This application has several output images and supports “multi-writing”. Instead of computing and writing each image independently, the streamed image blocks are written in a synchronous way for each output. The output images will be computed strip by strip, using the available RAM to compute the strip size, and a user defined streaming mode can be specified using the streaming extended filenames (type, mode and value). Note that multi-writing can be disabled using the multi-write extended filename option: &multiwrite=false, in this case the output images will be written one by one. Note that multi-writing is not supported for MPI writers.


Input Image -in image Mandatory
The input image to be filtered.

Feature Output Image -out image [dtype] Mandatory
Output image containing the filtered output image.

Selected Channel -channel int Default value: 1
The selected channel index

Structuring Element Type -structype [box|ball|cross] Default value: box
Choice of the structuring element type

  • Box
  • Ball
  • Cross

Structuring element X radius -xradius int Default value: 5
The structuring element radius along the X axis.

Structuring element Y radius -yradius int Default value: 5
The structuring element radius along the Y axis.

Morphological Operation -filter [dilate|erode|opening|closing] Default value: dilate
Choice of the morphological operation

  • Dilate
  • Erode
  • Opening
  • Closing

Available RAM (MB) -ram int Default value: 256
Available memory for processing (in MB).


From the command-line:

otbcli_GrayScaleMorphologicalOperation -in qb_RoadExtract.tif -out opened.tif -channel 1 -xradius 5 -yradius 5 -filter erode

From Python:

import otbApplication

app = otbApplication.Registry.CreateApplication("GrayScaleMorphologicalOperation")

app.SetParameterString("in", "qb_RoadExtract.tif")
app.SetParameterString("out", "opened.tif")
app.SetParameterInt("channel", 1)
app.SetParameterInt("xradius", 5)
app.SetParameterInt("yradius", 5)


See also

itkGrayscaleDilateImageFilter, itkGrayscaleErodeImageFilter, itkGrayscaleMorphologicalOpeningImageFilter and itkGrayscaleMorphologicalClosingImageFilter classes