BinaryMorphologicalOperation¶
对输入图像通道执行形态运算
描述¶
此应用程序对单波段图像或输入通道执行二进制形态运算。
参数¶
Input Image -in image
Mandatory
The input image to be filtered.
Output Image -out image [dtype]
Mandatory
Output image
Selected Channel -channel int
Default value: 1
The selected channel index
Type of structuring element -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.
Foreground value -foreval float
Default value: 1
Set the foreground value, default is 1.0.
Background value -backval float
Default value: 0
Set the background value, default is 0.0.
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).
实例¶
从命令行执行以下操作:
otbcli_BinaryMorphologicalOperation -in qb_RoadExtract.tif -out opened.tif -channel 1 -xradius 5 -yradius 5 -filter erode
来自Python的评论:
import otbApplication
app = otbApplication.Registry.CreateApplication("BinaryMorphologicalOperation")
app.SetParameterString("in", "qb_RoadExtract.tif")
app.SetParameterString("out", "opened.tif")
app.SetParameterInt("channel", 1)
app.SetParameterInt("xradius", 5)
app.SetParameterInt("yradius", 5)
app.SetParameterString("filter","erode")
app.ExecuteAndWriteOutput()