map2pix
(Removed) Convert map coordinates to pixel coordinates
The map2pix
function has been removed. Use the worldToIntrinsic
function instead. For more information, see Version History.
Syntax
[row,col] = map2pix(R,x,y)
p = map2pix(R,x,y)
[...] = map2pix(R,s)
Description
[row,col] = map2pix(R,x,y)
calculates pixel
coordinates row,col
from map coordinates x,y
.
R
is either a 3-by-2 referencing matrix defining a 2-dimensional affine
transformation from intrinsic pixel coordinates to map coordinates, or a map raster reference
object. x
and y
are vectors or arrays of matching size. The
outputs row
and col
have the same size as
x
and y
.
p = map2pix(R,x,y)
combines row
and col
into a single array p
. If x
and
y
are column vectors of length n
, then
p
is an n
-by-2 matrix and each p(k,:)
specifies the pixel coordinates of a single point. Otherwise, p
has size
[size(row) 2]
, and p(k1,k2,...,kn,:)
contains the pixel
coordinates of a single point.
[...] = map2pix(R,s)
combines x
and y
into a single array s
. If x
and
y
are column vectors of length n
, the s
should be an n
-by-2 matrix such that each row (s(k,:))
specifies the map coordinates of a single point. Otherwise, s
should have size
[size(X) 2]
, and s(k1,k2,...,kn,:)
should contain the map
coordinates of a single point.
Examples
% Find the pixel coordinates for the spatial coordinates % (207050, 912900) [X,cmap] = imread('concord_ortho_w.tif'); R = worldfileread('concord_ortho_w.tfw','planar',size(X)); [r,c] = map2pix(R,207050,912900);