DynamicConvert - Dynamic Conversion¶
Change the pixel type and rescale the image’s dynamic
Detailed description¶
- This application performs an image pixel type conversion (short, ushort, uchar, int, uint, float and double types are handled). The output image is written in the specified format (ie. that corresponds to the given extension).
- The conversion can include a rescale of the data range, by default it’s set between the 2nd to the 98th percentile. The rescale can be linear or log2. The choice of the output channels can be done with the extended filename, but less easy to handle. To do this, a ‘channels’ parameter allows you to select the desired bands at the output. There are 3 modes, the available choices are: * grayscale : to display mono image as standard color image * rgb : select 3 bands in the input image (multi-bands) * all : keep all bands.
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 DynamicConvert .
[1] | Table: Parameters table for Dynamic Conversion. |
Parameter Key | Parameter Name | Parameter Type |
---|---|---|
in | Input image | Input image |
out | Output Image | Output image |
type | Rescale type | Choices |
type linear | Linear | Choice |
type log2 | Log2 | Choice |
type.linear.gamma | Gamma correction factor | Float |
mask | Input mask | Input image |
quantile | Histogram quantile cutting | Group |
quantile.high | High cut quantile | Float |
quantile.low | Low cut quantile | Float |
channels | Channels selection | Choices |
channels all | Default mode | Choice |
channels grayscale | Grayscale mode | Choice |
channels rgb | RGB composition | Choice |
channels.grayscale.channel | Grayscale channel | Int |
channels.rgb.red | Red Channel | Int |
channels.rgb.green | Green Channel | Int |
channels.rgb.blue | Blue Channel | Int |
outmin | Output min value | Float |
outmax | Output max value | Float |
ram | Available RAM (Mb) | Int |
inxml | Load otb application from xml file | XML input parameters file |
outxml | Save otb application to xml file | XML output parameters file |
Input image: Input image.
Output Image: Output image.
Rescale type: Transfer function for the rescaling. Available choices are:
- Linear
- Gamma correction factor: Gamma correction factor.
- Log2
Input mask: 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.
[Histogram quantile cutting]: Cut the histogram edges before rescaling.
- High cut quantile: Quantiles to cut from histogram high values before computing min/max rescaling (in percent, 2 by default).
- Low cut quantile: Quantiles to cut from histogram low values before computing min/max rescaling (in percent, 2 by default).
Channels selection: It’s possible to select the channels of the output image. There are 3 modes, the available choices are:. Available choices are:
- Default mode: Select all bands in the input image, (1,...,n).
- Grayscale mode: Display single channel as standard color image.
- Grayscale channel
- RGB composition: Select 3 bands in the input image (multi-bands), by default (1,2,3).
- Red Channel: Red channel index.
- Green Channel: Green channel index.
- Blue Channel: Blue channel index.
Output min value: Minimum value of the output image.
Output max value: Maximum value of the output image.
Available RAM (Mb): Available memory for processing (in MB).
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_DynamicConvert -in QB_Toulouse_Ortho_XS.tif -out otbConvertWithScalingOutput.png -type linear -channels rgb -outmin 0 -outmax 255
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 DynamicConvert application
DynamicConvert = otbApplication.Registry.CreateApplication("DynamicConvert")
# The following lines set all the application parameters:
DynamicConvert.SetParameterString("in", "QB_Toulouse_Ortho_XS.tif")
DynamicConvert.SetParameterString("out", "otbConvertWithScalingOutput.png")
DynamicConvert.SetParameterString("type","linear")
DynamicConvert.SetParameterString("channels","rgb")
DynamicConvert.SetParameterFloat("outmin", 0)
DynamicConvert.SetParameterFloat("outmax", 255)
# The following line execute the application
DynamicConvert.ExecuteAndWriteOutput()
Limitations¶
None
Authors¶
This application has been written by OTB-Team.
See Also¶
- These additional resources can be useful for further information:
- Convert, Rescale