Choose Approach to Display 2-D and 3-D Images
Image Processing Toolbox™ offers a variety of functions that display 2-D images, frames of image sequences, 2-D slices of 3-D (volumetric) images, and 3-D renderings of volumetric images. You can display images programmatically using functions or interactively using apps.
Display 2-D Images
You can display 2-D images captured by digital cameras in standard file formats such as JPEG, and you can display the images that result from an image processing pipeline. You can also display multiple 2-D images in the same figure.
2-D image display functions, such as imshow
, support RGB, grayscale, and binary images. Nonstandard formats include
RAW data, medical DICOM images, high dynamic range (HDR) images, and hyperspectral images.
For 2-D images in a nonstandard format, you may need to convert the data to a standard
format, depending on the display approach that you choose.
When to Use | Approach | Sample Display |
---|---|---|
You want to display a single 2-D image. | Use the When
viewing images in MATLAB
Online™ or displaying larger images such as 12-Megapixel smartphone or
DSLR camera images, consider using |
|
You want to display a single 2-D image and perform some common image processing tasks interactively. | Use the Image Viewer app. |
|
You want to display multiple 2-D images next to each other. For example, you might want to compare an original image and a processed version of the image. | Use the |
|
You want to display two 2-D images overlaid on each other. For example, you want to check the alignment of two images using falsecolor or alpha blending. | Use the |
|
You want to display the thumbnails of images in an image datastore or a folder. | Use the Image Browser app. See View and Edit Collection of Images in Folder or Datastore. |
|
You want to display:
| Read the image as a Before R2024b, or to display the
image in an axes that can be customized using MATLAB graphics functions, use |
|
You want to display hyperspectral data, including color or false-color representations of hyperspectral images. | Use the Hyperspectral Viewer app (requires Hyperspectral Imaging Library for Image Processing Toolbox.) |
|
Display 2-D Slices and Frames
3-D volumes and image sequences are both collections of related 2-D images. The 2-D images (slices) in a 3-D volume are related along the third spatial dimension, depth. The 2-D images (frames) in an image sequence are related by a nonspatial dimension, such as time.
You can display individual slices of a 3-D volume or frames of an image sequence. To see changes in successive slices or frames, you can display the slices or frames sequentially or alongside each other in a montage. For 3-D volumes, you can also display cross-sections along the three orthogonal spatial planes.
When to Use | Approach | Sample Display |
---|---|---|
You want to display:
| Index into the numeric array representing the image sequence or 3-D
volumetric image, then display the indexed frame or slice by using the |
|
You want to display:
| Use the |
|
You want to display a slice of a 3-D volume and change the selected slice interactively using a slider. | Use the |
|
You want to animate an image sequence or successive slices of a 3-D volume as a video. | Use the Video Viewer app. |
|
You want to display orthogonal slices of a 3-D volume along the x, y, and z dimensions. | Use the |
|
You want to display orthogonal slices of a volumetric image or labeled volumetric image, and adjust the display properties interactively. | Use the Volume Viewer app. See Explore 3-D Volumetric Data with Volume Viewer App and Explore 3-D Labeled Volumetric Data with Volume Viewer. |
|
Display 3-D Renderings of 3-D Volumes
You can display a 3-D volumetric image in 3-D space. To improve the visibility of features within the volume, you can move the camera position within the scene, adjust the transparency of the data, or change rendering styles.
When to Use | Approach | Sample Display |
---|---|---|
You want to display a volumetric image or labeled volumetric image, and adjust the display properties interactively. | Use the Volume Viewer app. See Explore 3-D Volumetric Data with Volume Viewer App and Explore 3-D Labeled Volumetric Data with Volume Viewer. |
|
You want to display a volumetric image using a 3-D rendering. You can optionally:
| Use the See Display Interior Labels by Adjusting Volume Overlay Properties and Display Interior Labels by Clipping Volume Planes. |
|
You want to display:
| Read the image as a See Display Large 3-D Images Using Blocked Volume Visualization. |
|
Related Examples
- Display Volume Using Cinematic Rendering
- Explore Slices from 3-D Image Volume with Anisotropic Voxel Spacing
More About
- Display Different Image Types
- Choose Approach for Medical Image Visualization (Medical Imaging Toolbox)