DynamicConvert¶
更改像素类型并重新调整图像的动态比例
描述¶
此应用程序执行图像像素类型转换(处理Short、ushort、uchar、int、uint、Float和Double类型)。输出图像以指定的格式(即其对应于给定的扩展名)。转换可以包括数据范围的重新缩放,默认情况下它设置在第2到第98个百分位数之间。重缩放可以是线性的,也可以是对数的。可以使用扩展文件名选择输出通道,但不太容易处理。要做到这一点,“频道”参数允许您在输出端选择所需的频段。有3种模式,可供选择的有:
- All :保留所有乐队。
- Grayscale :将单色图像显示为标准彩色图像
- RGB :在输入图像中选择3个波段(多波段)
参数¶
Input image -in image
Mandatory
Input image
Output Image -out image [dtype]
Mandatory
Output image
Rescale type -type [linear|log2]
Default value: linear
Transfer function for the rescaling
- Linear
- Log2
线性期权¶
Gamma correction factor -type.linear.gamma float
Default value: 1
Gamma correction factor
Input mask -mask image
Optional mask to indicate which pixels are valid for computing the histogram quantiles. Pixels where the mask is zero will not contribute to the histogram. The mask must have the same dimensions as the input image.
直方图分位数切割¶
在重新缩放之前剪切直方图边缘
High cut quantile -quantile.high float
Default value: 2
Quantiles to cut from histogram high values before computing min/max rescaling (in percent, 2 by default)
Low cut quantile -quantile.low float
Default value: 2
Quantiles to cut from histogram low values before computing min/max rescaling (in percent, 2 by default)
Channels selection -channels [all|grayscale|rgb]
Default value: all
It's possible to select the channels of the output image. There are 3 modes, the available choices are:
- Default mode
Select all bands in the input image, (1,...,n). - Grayscale mode
Display single channel as standard color image. - RGB composition
Select 3 bands in the input image (multi-bands), by default (1,2,3).
RGB合成选项¶
Red Channel -channels.rgb.red int
Mandatory
Red channel index.
Green Channel -channels.rgb.green int
Mandatory
Green channel index.
Blue Channel -channels.rgb.blue int
Mandatory
Blue channel index.
Output min value -outmin float
Default value: 0
Minimum value of the output image.
Output max value -outmax float
Default value: 255
Maximum value of the output image.
Available RAM (MB) -ram int
Default value: 256
Available memory for processing (in MB).
实例¶
从命令行执行以下操作:
otbcli_DynamicConvert -in QB_Toulouse_Ortho_XS.tif -out otbConvertWithScalingOutput.png -type linear -channels rgb -outmin 0 -outmax 255
来自Python的评论:
import otbApplication
app = otbApplication.Registry.CreateApplication("DynamicConvert")
app.SetParameterString("in", "QB_Toulouse_Ortho_XS.tif")
app.SetParameterString("out", "otbConvertWithScalingOutput.png")
app.SetParameterString("type","linear")
app.SetParameterString("channels","rgb")
app.SetParameterFloat("outmin", 0)
app.SetParameterFloat("outmax", 255)
app.ExecuteAndWriteOutput()
局限性¶
该应用程序不支持将复杂像素类型作为输出。