GridBasedImageResampling¶
根据重采样栅格对图像进行重采样
描述¶
这个应用程序允许从输入重采样网格执行图像重采样。
参数¶
输入和输出数据¶
这组参数允许设置输入和输出图像。
Input image -io.in image
Mandatory
The input image to resample
Output Image -io.out image [dtype]
Mandatory
The resampled output image
重采样栅格参数¶
Input resampling grid -grid.in image
Mandatory
The resampling grid
Grid Type -grid.type [def|loc]
Default value: def
allows one to choose between two grid types
- Displacement grid: $G(x_out,y_out) = (x_in-x_out, y_in-y_out)$
A deformation grid contains at each grid position the offset to apply to this position in order to get to the corresponding point in the input image to resample - Localisation grid: $G(x_out,y_out) = (x_in, y_in)$
A localisation grid contains at each grid position the corresponding position in the input image to resample
输出图像参数¶
输出图像的参数
Upper Left X -out.ulx float
Default value: 0
X Coordinate of the upper-left pixel of the output resampled image
Upper Left Y -out.uly float
Default value: 0
Y Coordinate of the upper-left pixel of the output resampled image
Size X -out.sizex int
Mandatory
Size of the output resampled image along X (in pixels)
Size Y -out.sizey int
Mandatory
Size of the output resampled image along Y (in pixels)
Pixel Size X -out.spacingx float
Default value: 1
Size of each pixel along X axis
Pixel Size Y -out.spacingy float
Default value: 1
Size of each pixel along Y axis
Default value -out.default float
Default value: 0
The default value to give to pixel that falls outside of the input image.
Interpolation -interpolator [nn|linear|bco]
Default value: bco
This group of parameters allows one to define how the input image will be interpolated during resampling.
- Nearest Neighbor interpolation
Nearest neighbor interpolation leads to poor image quality, but it is very fast. - Linear interpolation
Linear interpolation leads to average image quality but is quite fast - Bicubic interpolation
双三次插值选项¶
Radius for bicubic interpolation -interpolator.bco.radius int
Default value: 2
This parameter allows controlling the size of the bicubic interpolation filter. If the target pixel size is higher than the input pixel size, increasing this parameter will reduce aliasing artifacts.
Available RAM (MB) -ram int
Default value: 256
Available memory for processing (in MB).
实例¶
从命令行执行以下操作:
otbcli_GridBasedImageResampling -io.in ROI_IKO_PAN_LesHalles_sub.tif -io.out ROI_IKO_PAN_LesHalles_sub_resampled.tif uint8 -grid.in ROI_IKO_PAN_LesHalles_sub_deformation_field.tif -out.sizex 256 -out.sizey 256 -grid.type def
来自Python的评论:
import otbApplication
app = otbApplication.Registry.CreateApplication("GridBasedImageResampling")
app.SetParameterString("io.in", "ROI_IKO_PAN_LesHalles_sub.tif")
app.SetParameterString("io.out", "ROI_IKO_PAN_LesHalles_sub_resampled.tif")
app.SetParameterOutputImagePixelType("io.out", 1)
app.SetParameterString("grid.in", "ROI_IKO_PAN_LesHalles_sub_deformation_field.tif")
app.SetParameterInt("out.sizex", 256)
app.SetParameterInt("out.sizey", 256)
app.SetParameterString("grid.type","def")
app.ExecuteAndWriteOutput()