pixcenters
(Removed) Compute pixel centers for georeferenced image or data grid
The pixcenters function has been removed. Use the geographicGrid or worldGrid
function instead. For more information, see Version History.
Syntax
[x,y] = pixcenters(R,height,width)
[x,y] = pixcenters(r,sizea)
[x,y] = pixcenters(..., 'makegrid')
Description
[x,y] = pixcenters(R,height,width) returns the
spatial coordinates of a spatially-referenced image or regular gridded data set.
R is either a 3-by-2 referencing matrix defining a 2-dimensional
affine transformation from intrinsic pixel coordinates to map coordinates, or a MapCellsReference object. height and
width are the image dimensions. If r does not
include a rotation (i.e., r(1,1) = r(2,2) = 0), then
x is a 1-by-width vector and
y is a 1-by-height vector. In this case, the
spatial coordinates of the pixel in row row and column
col are given by x(col), y(row). Otherwise,
x and y are each a
height-by-width matrix such that
x(col,row), y(col,row) are the coordinates of the pixel with
subscripts (row,col).
[x,y] = pixcenters(r,sizea) accepts the size
vector sizea = [height, width, ...] instead of
height and width.
[x,y] = pixcenters(info) accepts a scalar structure array with the
fields
| 3-by-2 referencing matrix |
| Scalar number |
| Scalar number |
[x,y] = pixcenters(..., 'makegrid') returns
x and y as
height-by-width matrices even if
r is irrotational. This syntax can be helpful when you call
pixcenters from within a function or script.
Examples
[Z,R] = readgeoraster('MtWashington-ft.grd','OutputType','double'); info = georasterinfo('MtWashington-ft.grd'); Z = standardizeMissing(Z,info.MissingDataIndicator); figure [x,y] = pixcenters(R,size(Z)); h = surf(x,y,Z); axis equal demcmap(Z) set(h,'EdgeColor','none') xlabel('x (easting in meters)') ylabel('y (northing in meters)') zlabel('elevation in feet')
Tips
pixcenters is useful for working with surf,
mesh, or surface, and for coordinate
transformations.
Version History
Introduced before R2006aSee Also
Functions
readgeoraster|mapoutline|intrinsicToWorld|worldfileread|mapshow|geographicGrid|worldGrid