# resample: Resample an array In mmand: Mathematical Morphology in Any Number of Dimensions

## Description

The `resample` function uses a kernel function to resample a target array. This can be thought of as a generalisation of array indexing which allows fractional indices. It is (S3) generic. The `rescale` function is an alternative interface for the common case where the image is being scaled to a new size.

## Usage

 ```1 2 3 4 5 6 7``` ```resample(x, points, kernel, ...) ## Default S3 method: resample(x, points, kernel, pointType = c("auto", "general", "grid"), ...) rescale(x, factor, kernel, ...) ```

## Arguments

 `x` Any object. For the default method, this must be coercible to an array. `points` Either a matrix giving the points to sample at, one per row, or a list giving the locations on each axis, which will be made into a grid. `kernel` A kernel function object, used to provide coefficients for each resampled value, or the name of one. `...` Additional options, such as kernel parameters. `pointType` A string giving the type of the point specification being used. Usually can be left as `"auto"`. `factor` A vector of scale factors, which will be recycled to the dimensionality of `x`.

## Value

If a generalised sampling scheme is used (i.e. with `points` a matrix), the result is a vector of sampled values. For a grid scheme (i.e. with `points` a list, including for `rescale`), it is a resampled array.

## Author(s)

Jon Clayden <[email protected]>

`kernels` for kernel-generating functions.

## Examples

 `1` ```resample(c(0,0,1,0,0), seq(0.75,5.25,0.5), triangleKernel()) ```

### Example output

```  0.00 0.00 0.00 0.25 0.75 0.75 0.25 0.00 0.00 0.00
```

mmand documentation built on May 2, 2019, 6:53 a.m.