BinaryMorphologicalOperation - Binary Morphological Operation

Performs morphological operations on an input image channel

Detailed description

This application performs binary morphological operations on a mono band image

Parameters

This section describes in details the parameters available for this application. Table [1] presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is BinaryMorphologicalOperation .

[1]Table: Parameters table for Binary Morphological Operation.
Parameter Key Parameter Name Parameter Type
in Input Image Input image
out Feature Output Image Output image
channel Selected Channel Int
ram Available RAM (Mb) Int
structype Structuring Element Type Choices
structype ball Ball Choice
structype cross Cross Choice
structype.ball.xradius The Structuring Element X Radius Int
structype.ball.yradius The Structuring Element Y Radius Int
filter Morphological Operation Choices
filter dilate Dilate Choice
filter erode Erode Choice
filter opening Opening Choice
filter closing Closing Choice
filter.dilate.foreval Foreground Value Float
filter.dilate.backval Background Value Float
filter.erode.foreval Foreground Value Float
filter.erode.backval Background Value Float
filter.opening.foreval Foreground Value Float
filter.opening.backval Background Value Float
filter.closing.foreval Foreground Value Float
inxml Load otb application from xml file XML input parameters file
outxml Save otb application to xml file XML output parameters file

Input Image: The input image to be filtered.

Feature Output Image: Output image containing the filtered output image.

Selected Channel: The selected channel index.

Available RAM (Mb): Available memory for processing (in MB).

Structuring Element Type: Choice of the structuring element type. Available choices are:

  • Ball
  • The Structuring Element X Radius: The Structuring Element X Radius.
  • The Structuring Element Y Radius: The Structuring Element Y Radius.
  • Cross

Morphological Operation: Choice of the morphological operation. Available choices are:

  • Dilate
  • Foreground Value: The Foreground Value.
  • Background Value: The Background Value.
  • Erode
  • Foreground Value: The Foreground Value.
  • Background Value: The Background Value.
  • Opening
  • Foreground Value: The Foreground Value.
  • Background Value: The Background Value.
  • Closing
  • Foreground Value: The Foreground Value.

Load otb application from xml file: Load otb application from xml file.

Save otb application to xml file: Save otb application to xml file.

Example

To run this example in command-line, use the following:

otbcli_BinaryMorphologicalOperation -in qb_RoadExtract.tif -out opened.tif -channel 1 -structype.ball.xradius 5 -structype.ball.yradius 5 -filter erode

To run this example from Python, use the following code snippet:

#!/usr/bin/python

# Import the otb applications package
import otbApplication

# The following line creates an instance of the BinaryMorphologicalOperation application
BinaryMorphologicalOperation = otbApplication.Registry.CreateApplication("BinaryMorphologicalOperation")

# The following lines set all the application parameters:
BinaryMorphologicalOperation.SetParameterString("in", "qb_RoadExtract.tif")

BinaryMorphologicalOperation.SetParameterString("out", "opened.tif")

BinaryMorphologicalOperation.SetParameterInt("channel", 1)

BinaryMorphologicalOperation.SetParameterInt("structype.ball.xradius", 5)

BinaryMorphologicalOperation.SetParameterInt("structype.ball.yradius", 5)

BinaryMorphologicalOperation.SetParameterString("filter","erode")

# The following line execute the application
BinaryMorphologicalOperation.ExecuteAndWriteOutput()

Limitations

None

Authors

This application has been written by OTB-Team.

See Also

These additional resources can be useful for further information:
itkBinaryDilateImageFilter, itkBinaryErodeImageFilter, itkBinaryMorphologicalOpeningImageFilter and itkBinaryMorphologicalClosingImageFilter classes