Image Processing Toolbox User's Guide |
Syntax
Description
A = getimage(h)
returns the first image data contained in the Handle Graphics object h
. h
can be a figure, axes, or image. A
is identical to the image CData
; it contains the same values and is of the same class (uint8
, uint16
, double
, or logical
) as the image CData
. If h
is not an image or does not contain an image, A
is empty.
[x,y,A] = getimage(h) returns the image XData
in x
and the YData
in y
. XData
and YData
are two-element vectors that indicate the range of the x-axis and y-axis.
[...,A,flag] = getimage(h) returns an integer flag that indicates the type of image h
contains. This table summarizes the possible values for flag
.
[...] = getimage returns information for the current axes object. It is equivalent to [...] = getimage(gca)
.
Class Support
The output array A
is of the same class as the image CData
. All other inputs and outputs are of class double
.
Note
For int16
and single
images, the image data returned by getimage
is of class double
, not int16
or single
. This is because the getimage
function gets the data from the image object's CData
property and image objects store int16
and single
image data as class double
.
For example, create an image object of class int16
. If you retrieve the CData
from the object and check its class, it returns double
.
Therefore, if you get the image data using the getimage
function, the data it returns is also of class double
. The flag
return value is set to 3
.
The same is true for an image of class single
. Getting the CData
directly from the image object or by using getimage
, the class of the returned data is double
.
For images of class single, the flag
return value is set to 2
because single
and double
share the same dynamic range.
Example
After using imshow
or imtool
to display an image directly from a file, use getimage
to get the image data into the workspace.
See Also
getheight | getimagemodel |
© 1994-2005 The MathWorks, Inc.