GridBasedImageResampling¶
Resamples an image according to a resampling grid
Description¶
This application allows performing image resampling from an input resampling grid.
Parameters¶
Input and output data¶
This group of parameters allows setting the input and output images.
Input image -io.in image
Mandatory
The input image to resample
Output Image -io.out image [dtype]
Mandatory
The resampled output image
Resampling grid parameters¶
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 resampleLocalisation 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
Output Image parameters¶
Parameters of the output image
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 fastBicubic interpolation
Bicubic interpolation options¶
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).
Examples¶
From the command-line:
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
From 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()