Resize regular data grid
Z = resizem(Z1,scale)
Z = resizem(Z1,[numrows numcols])
[Z,R] = resizem(Z1,scale,R1)
[Z,R] = resizem(Z1,[numrows numcols],R1)
[...] = resizem(..., method)
Z = resizem(Z1,scale) returns a regular data grid Z that is scale times the size of the input, Z1. resizem uses interpolation to resample to a new sample density/cell size. If scale is between 0 and 1, the size of Z is smaller than the size of Z1. If scale is greater than 1, the size of Z is larger. For example, if scale is 0.5, the number of rows and the number of columns will be halved. By default, resizem uses nearest neighbor interpolation.
Z = resizem(Z1,[numrows numcols]) resizes Z1 to have numrows rows and numcols columns. numrows and numcols must be positive whole numbers.
[Z,R] = resizem(Z1,scale,R1) or [Z,R] = resizem(Z1,[numrows numcols],R1) resizes a regular data grid that is spatially referenced by R1. R1 can be a referencing vector, a referencing matrix, or a geographic raster reference object.
If R1 is a geographic raster reference object, its RasterSize property must be consistent with size(Z1) and its RasterInterpretation must be 'cells'.
If R1 is a referencing vector, it must be a 1-by-3 with elements:
[cells/degree northern_latitude_limit western_longitude_limit]
If R1 is a referencing matrix, it must be 3-by-2 and transform raster row and column indices to/from geographic coordinates according to:
[lon lat] = [row col 1] * R1
If R1 is a referencing matrix, it must define a (non-rotational, non-skewed) relationship in which each column of the data grid falls along a meridian and each row falls along a parallel. The output R will be the same type as R1 (referencing object, vector, or matrix). If R1 is a referencing vector, the form [numrows numcols] is not supported and scale must be a scalar resizing factor.
[...] = resizem(..., method) resizes a regular data grid using one of the following three interpolation methods:
|'nearest'||nearest neighbor interpolation (default)|
If the grid size is being reduced (scale is less than 1 or [numrows numcols] is less than the size of the input grid) and method is 'bilinear' or 'bicubic', resizem applies a low-pass filter before interpolation, to reduce aliasing. The default filter size is 11-by-11. You can specify a different length for the default filter using:
[...] = resizem(..., method, n)
n is an integer scalar specifying the size of the filter, which is n-by-n. If n is 0 or method is 'nearest', resizem omits the filtering step. You can also specify your own filter h using:
[...] = resizem(..., method, h)
h is any two-dimensional FIR filter (such as those returned by Image Processing Toolbox functions ftrans2, fwind1, fwind2, or fsamp2). If H is specified, filtering is applied even when method is 'nearest'.
Double the size of a grid then reduce it using different methods:
Z = [1 2; 3 4] Z = 1 2 3 4 neargrid = resizem(Z,2) neargrid = 1 1 2 2 1 1 2 2 3 3 4 4 3 3 4 4 bilingrid = resizem(Z,2,'bilinear') bilingrid = 1.0000 1.3333 1.6667 2.0000 1.6667 2.0000 2.3333 2.6667 2.3333 2.6667 3.0000 3.3333 3.0000 3.3333 3.6667 4.0000 bicubgrid = resizem(bilingrid,[3 2],'bicubic') bicubgrid = 0.7406 1.2994 1.6616 2.3462 1.9718 2.5306