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 or a channel of the input.

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 Output Image Output image
channel Selected Channel Int
ram Available RAM (Mb) Int
structype Type of structuring element Choices
structype ball Ball Choice
structype cross Cross Choice
structype.ball.xradius Structuring element X radius Int
structype.ball.yradius Structuring element Y radiuss 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.

Output Image: Output image.

Selected Channel: The selected channel index.

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

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

  • Ball
  • Structuring element X radius: The structuring element radius along the X axis.
  • Structuring element Y radiuss: The structuring element radius along the y axis.
  • Cross

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

  • Dilate
  • Foreground value: Set the foreground value, default is 1.0.
  • Background value: Set the background value, default is 0.0.
  • Erode
  • Foreground value: Set the foreground value, default is 1.0.
  • Background value: Set the background value, default is 0.0.
  • Opening
  • Foreground value: Set the foreground value, default is 1.0.
  • Background value: Set the background value, default is 0.0.
  • Closing
  • Foreground value: Set the foreground value, default is 1.0.

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.