Read an image and display it. Get the size of the image.
I = imread('pout.tif');
[nrows,ncols] = size(I)
nrows =
291
ncols =
240
Create a spatial referencing object for this image, with default property settings. By default, the upper-left corner of the image has intrinsic coordinate (1,1).
RI = imref2d(size(I));
h = imshow(I,RI);
xData = get(h,'XData')
xData = 1×2
1 240
yData = get(h,'YData')
yData = 1×2
1 291
For illustrative purposes, specify an arbitrary image extent in the x- and y-directions. This example shifts the image up by 20 pixels and to the right by 400 pixels. The example also shifts the image to the right by 100 pixels and compresses the image horizontally by a factor of 2.
Number of image rows or columns, specified as a positive integer.
n is the number of image columns for the
x-coordinate, or the number of image rows for the
y-coordinate.
Image world extent, specified as a 2-element numeric vector.
extent is returned by
get(image_handle,"XData") or
get(image_handle,"YData").
Axes coordinate to convert to intrinsic coordinates, specified as a
numeric vector.
Intrinsic coordinates, returned as a numeric vector. If all of the input
arguments are of data type single, then
pixelCoord is of data type
single. Otherwise, pixelCoord is
of data type double.
Data Types: double | single
Tips
axes2pix performs minimal checking on the validity of the
n, axesCoord, or
extent arguments. For example,
axes2pix can extrapolate from extent
to return a negative coordinate. The function calling
axes2pix bears responsibility for error checking.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.