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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.