Create resampling structure
R = makeresampler(interpolant, padmethod)
R = makeresampler(interpolant, padmethod)
creates
a separable resampler structure for use with tformarray
and imtransform
.
The interpolant
argument specifies
the interpolating kernel that the separable resampler uses. In its
simplest form, interpolant
can have any of the
following strings as a value.
Interpolant  Description 

 Cubic interpolation 
 Linear interpolation 
 Nearestneighbor interpolation 
If you are using a custom interpolating kernel, you can specify interpolant
as
a cell array in either of these forms:




To specify the interpolation method independently along each dimension, you can combine both types of interpolant specifications. The number of elements in the cell array must equal the number of transform dimensions. For example, if you specify this value for interpolant
{'nearest', 'linear', {2 KERNEL_TABLE}}
the resampler uses nearestneighbor interpolation along the first transform dimension, linear interpolation along the second dimension, and a custom tablebased interpolation along the third.
The padmethod
argument controls how the resampler
interpolates or assigns values to output elements that map close to
or outside the edge of the input array. The following table lists
all the possible values of padmethod
.
Pad Method  Description 

 Assigns values from the fill value array to points that
map outside the array and repeats border elements of the array for
points that map inside the array (same as 
 Pads array with circular repetition of elements within
the dimension. Same as 
 Generates an output array with smoothlooking edges (except
when using nearestneighbor interpolation). For output points that
map near the edge of the input array (either inside or outside), it
combines input image and fill values. When 
 Pads array by repeating border elements of array. Same
as 
 Pads array with mirror reflections of itself. Same as 
In the case of 'fill'
, 'replicate'
, 'circular'
,
or 'symmetric'
, the resampling performed by tformarray
or imtransform
occurs
in two logical steps:
Pad the array A
infinitely to fill
the entire input transform space.
Evaluate the convolution of the padded A
with
the resampling kernel at the output points specified by the geometric
map.
Each nontransform dimension is handled separately. The padding is virtual, (accomplished by remapping array subscripts) for performance and memory efficiency. If you implement a custom resampler, you can implement these behaviors.
The syntaxes described above construct a resampler structure that uses the separable resampler function that ships with the Image Processing Toolbox™ software. It is also possible to create a resampler structure that uses a userwritten resampler by using this syntax:
R = makeresampler(PropertyName,PropertyValue,...)
The makeresampler
function supports the following
properties.
Property  Description 

 Can have the value 
 See the 
 See the 
 Positive integer indicating the dimensionality the custom
resampler can handle. Use a value of 
 Handle to a function that performs the resampling. The function is called with the following interface. B = resample_fcn(A,M,TDIMS_A,TDIMS_B,FSIZE_A,FSIZE_B,F,R) See
the help for The
first 
 Userdefined. 
Stretch an image in the ydirection using a separable resampler that applies cubic interpolation in the ydirection and nearestneighbor interpolation in the xdirection. (This is equivalent to, but faster than, applying bicubic interpolation.)
A = imread('moon.tif'); resamp = makeresampler({'nearest','cubic'},'fill'); stretch = maketform('affine',[1 0; 0 1.3; 0 0]); B = imtransform(A,stretch,resamp);