Image Properties
Image
properties control the appearance and behavior of an
Image
object. By changing property values, you can modify certain aspects
of the image. Create an Image
object using the imageshow
function.
Use dot notation to query and set properties. For example, these commands show how to
create an Image
object that displays the 2-D image data I
,
query the value of the Colormap
property, and set the value of the
Colormap
property, respectively.
im = imageshow(I); cmap = im.Colormap; im.Colormap = parula;
Parent/Child
Parent
— Parent
Viewer
object
Parent of the Image
object, specified as a Viewer
object. You can create a Viewer
object optimized for 2-D image display
by using the viewer2d
function. When you call imageshow
without specifying a parent, the
function creates a new Viewer
object and sets that object as the
parent. After object creation, this property is read-only.
Data Display
Data
— Image data
m-by-n numeric matrix | m-by-n-by-3 numeric
array | 2-D blockedImage
object
Image data, specified as one of the options in this table. You can specify the
Data
property directly, or as an input argument to the imageshow
function.
Image Type | Description |
---|---|
Grayscale | Specify as an m-by-n numeric matrix. |
Binary | Specify as an m-by-n matrix of data
type logical . |
RGB | Specify as an m-by-n-by-3 numeric array. |
Blocked image | Specify as a blockedImage object that reads 2-D blocks of grayscale, RGB, or
binary image data. |
Interpolation
— Image interpolation method
"auto"
(default) | "bilinear"
| "nearest"
Image interpolation method, specified as one of the values in this table.
Value | Description |
---|---|
"auto" | The interpolation method depends on the current zoom level. If one data pixel spans fewer than 10 screen pixels, the image displays using bilinear interpolation. If one data pixel spans more than 10 screen pixels, the image displays using nearest neighbor interpolation. |
"bilinear" | The image displays using bilinear interpolation. The value of a pixel located at (x, y) is the weighted average of the surrounding pixels in the original image. |
"nearest" | The image displays using nearest neighbor interpolation. The value of a pixel located at (x, y) is the value of the pixel closest to (x, y) in the original image. This option provides the fastest performance, and is recommended for workflows, such as the playback of multiframe image series, where fast rendering speed is more important than image quality. |
Colormap
— Colormap
gray(256)
(default) | n-by-3 numeric matrix
Colormap for the image data, specified as an n-by-3 numeric
matrix with values in the range [0, 1]. The maximum number of colors
n is 256. This property has no effect when viewing RGB images. You
can specify a different colormap for each Image
object in a
scene.
Values less than or equal to the minimum value of DisplayRange
map to the first color in
Colormap
, and all values greater than or equal to the maximum
value of DisplayRange
map to the last color in
Colormap
. Intermediate values map linearly to the intermediate
colors in the colormap.
DisplayRange
— Display range
[0 1]
(default) | 2-element numeric vector | 3-by-2 numeric matrix
Display range of the image content, specified as one of these options:
2-element row vector of the form
[min max]
— Scale data according to the valuesmin
andmax
. For RGB images, specifying a 2-element row vector applies the same data limits to all color channels.3-by-2 numeric matrix with rows of the form
[min max]
— Scale each RGB channel according to the valuesmin
andmax
. The first, second, and third rows specify the data limits for the red, green, and blue color channels, respectively.
When the DisplayRangeMode
value is "type-range"
(the
default) or "data-range"
, this property updates automatically to
reflect the range of the data type or data of the current image, respectively. If you
specify this property, the DisplayRangeMode
property changes to
"manual"
.
DisplayRangeMode
— Display range mode
"type-range"
(default) | "data-range"
| "10-bit"
| "12-bit"
| "manual"
Display range mode, specified as one of the options in this table.
Value | Description |
---|---|
"type-range" | Set the display range equal to the data type range. For example, for
uint8 images, the display range is [0
255] . |
"data-range" | Set the display range equal to the data range of the image. For RGB images, the data range is the overall minimum and maximum across channels. |
"10-bit" | Set the display range to [0 1023] . This value is
useful for displaying medical images with 10-bit data ranges. |
"12-bit" | Set the display range to [0 4095] . This value is
useful for displaying medical images with 12-bit data ranges. |
"manual" | Manually set a fixed display range using DisplayRange . Specifying
DisplayRange automatically sets
DisplayRangeMode to
"manual" . |
AlphaData
— Transparency channel
1
(default) | numeric scalar | m-by-n numeric matrix | 2-D blockedImage
object
Transparency channel for the image data, specified as one of the options in this table.
Value | Description |
---|---|
Numeric scalar | Display the image with a constant transparency value in the range [0, 1]. |
m-by-n numeric matrix | Specify the transparency value for each pixel directly. m and n are the lengths of the first and second dimensions of the input image, respectively. The
function expects values of data type |
2-D blockedImage object | Specify the transparency for each pixel of the blocked image
directly. Use this option when The function expects underlying pixel values of data
type |
Transformation
— Geometric transformation applied to image
imref2d
object | affinetform2d
object | rigidtform2d
object | ...
Geometric transformation applied to the image, specified as one of the 2-D or 3-D
geometric transformation objects listed in the table. Use the
Transformation
property to apply intrinsic-to-world mapping,
adjust the size of the image, rotate the image, or perform other affine transformations.
The default value is an affinetform3d
object that performs an identity
transformation.
Value | Description |
---|---|
imref2d object | 2-D spatial referencing object |
affinetform2d object | 2-D affine transformation, including translation, rotation, anisotropic scaling, reflection, and shearing |
rigidtform2d object | 2-D rigid transformation, including translation and rotation |
simtform2d object | 2-D similarity transformation, including translation, rotation, and isotropic scaling |
transltform2d object | 2-D translation transformation |
affinetform3d object | 3-D affine transformation, including translation, rotation, anisotropic scaling, reflection, and shearing |
rigidtform3d object | 3-D rigid transformation, including translation and rotation |
simtform3d object | 2-D similarity transformation, including translation, rotation, and isotropic scaling |
transltform3d object | 3-D translation transformation |
Overlay
OverlayData
— Overlay data
[]
(default) | numeric array | categorical array | blockedImage
object
Overlay data to blend with the image data, specified as a numeric array, categorical
array, or a blockedImage
object. If Data
is a
blockedImage
, specify OverlayData
as a
blockedImage
with the same Size
,
BlockSize
, SizeInBlocks
,
NumLevels
, WorldStart
, and
WorldEnd
values.
You can modify the appearance of the overlay by changing the OverlayDisplayRange
, OverlayColormap
, OverlayAlpha
, and OverlayAlphamap
properties.
OverlayColormap
— Overlay colormap
n-by-3 numeric matrix
Overlay colormap, specified as an n-by-3 numeric matrix with
values in the range [0, 1]. The maximum number of colors n is 256.
This property affects the visualization only when the OverlayData
property is nonempty. The default colormap
maximizes color differences between adjacent colors in the colormap, which helps
visually distinguish between different values in a label image.
The OverlayDisplayRange
property determines which values of
OverlayData
map to the colormap. Values less than or equal to the
minimum value of OverlayDisplayRange
map to the first color in
OverlayColormap
, and all values greater than or equal to the
maximum value of OverlayDisplayRange
map to the last color in
OverlayColormap
.
OverlayAlpha
— Uniform transparency value for overlay
0.5
(default) | numeric scalar | []
Uniform transparency value for the overlay image, specified as a numeric scalar in
the range [0, 1] or an empty array. Specify a numeric scalar to apply a uniform
transparency to all nonzero pixels in OverlayData
. Zero-valued pixels display fully transparent.
To specify a nonuniform transparency, or to apply a uniform transparency to all
pixels including zero-valued pixels, specify the OverlayAlphamap
property. If you specify
OverlayAlphamap
, then OverlayAlpha
automatically changes to an empty matrix, []
.
OverlayAlphamap
— Nonuniform transparency map for overlay
n-element column vector | "linear"
| "quadratic"
| "cubic"
Nonuniform transparency map for the overlay image, specified as one of the values in
the table. Specify this property to apply a non-uniform transparency to pixels in
OverlayData
. By default, OverlayAlphamap
is a 256-element column vector that reflects the current OverlayAlpha
value.
The OverlayDisplayRange
property determines which values of
OverlayData
map to the transparency range. Values less than or
equal to the minimum value of OverlayDisplayRange
map to the first
value of the transparency map, and all values greater than or equal to the maximum value
of OverlayDisplayRange
map to the last value of the transparency
map.
Value | Description |
---|---|
n-element column vector with values in the range [0, 1] | Values in OverlayData map linearly to the
transparency values in OverlayAlphamap . |
"linear" | Values in OverlayData map linearly to transparencies
in the range [0, 1]. |
"quadratic" | Values in OverlayData map quadratically to
transparencies in the range [0, 1]. |
"cubic" | Values in OverlayData map cubically to
transparencies in the range [0, 1]. |
OverlayDisplayRange
— Overlay display range
[0 255]
(default) | 2-element numeric vector
Overlay display range, specified as a 2-element numeric vector of the form
[low high]
that specifies the minimum and maximum of the display
range. If you specify this property directly, the OverlayDisplayRangeMode
automatically changes to
"manual"
. When the OverlayDisplayRangeMode
property is "data-range"
or "type-range"
, this
property automatically updates to reflect the range of the overlay data or the data
type, respectively.
OverlayDisplayRangeMode
— Overlay display range mode
"8-bit"
(default) | "type-range"
| "data-range"
| "manual"
Overlay display range mode, specified as one of the options in this table.
Value | Description |
---|---|
"8-bit" | Set the overlay display range to [0 255] . |
"type-range" | Set the overlay display range equal to the data type range for
OverlayData . For example, if
OverlayData is of data type double ,
the display range is [0 1] . |
"data-range" | Set the display range equal to the data range of
OverlayData . |
"manual" | Manually set a fixed display range using the OverlayDisplayRange property. Specifying the
OverlayDisplayRange property automatically sets
OverlayDisplayRangeMode to
"manual" . |
Version History
Introduced in R2024b
MATLAB Command
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)