View and Edit Collection of Images in Folder or Datastore
This example shows how to use the Image Browser app to view a collection of images, inspect and select images to send to another app, and export a subset of the collection to an image datastore.
Open Images in Image Browser
Open the Image Browser app from the MATLAB® toolstrip. On the Apps tab, in the Image Processing and Computer Vision section, click Image Browser .
Load images into the app by clicking Add. You can add images that are in a folder excluding subfolders, in a folder including subfolders, or in an image datastore in the workspace. This example works with the images in the sample image folder, imdata
, and excludes the images in subfolders of imdata
. Therefore, select Folder of images. The app displays a file explorer window. Navigate to the folder you want to view.
You can also open the app at the command line using the imageBrowser
function, specifying the name of the folder you want to view. For example, to view all the images in the sample image folder, use this command:
imageBrowser(fullfile(matlabroot,'toolbox/images/imdata/'))
Image Browser displays thumbnails of all the images in the folder.
Add images to the collection by using the Add button.
Delete an image from the collection by right-clicking the image and selecting Remove Selected from the context menu. You can select a group of images to delete by using Ctrl+click or Shift+click. Image Browser does not delete images from the file system—it only removes the thumbnails from the display.
Explore Images in the Collection
To adjust the size of the image thumbnails, use the Thumbnail Size slider in the app toolstrip.
To get a closer look at an image, select the image and click Preview. You can also get a preview by double-clicking an image. The app displays the image at a higher resolution in a Preview tab. To explore the image displayed in the Preview tab, use the zoom and pan options visible over the top-right corner of the image when you pause over the image.
You can select more than one image to preview by using Ctrl+click or Shift+click. The first image appears in the preview panel. Advance and backtrack to the other selected images using the navigation arrows under the image.
Launch Another App from Image Browser
You can use Image Browser to open a selected image in another app that supports the image data type and file format:
Image Viewer — Explore details of color, grayscale, and binary images
Color Thresholder — Segment color images according to color values
Image Segmenter — Segment color and grayscale images according to image features
Image Region Analyzer — Measure properties of regions in binary images
For example, in the Image Browser app select the blobs
binary image. In the app toolstrip, click Image Region Analyzer. The Image Region Analyzer app opens with the blobs
image.
Export Images to the Workspace or an Image Datastore
To export the entire collection to an image datastore, click Export > All on the app toolstrip and specify the name of the image datastore.
You can export a subset of the collection to an image datastore. Select the images, click Export > Selected on the app toolstrip, and specify the name of the image datastore. Alternatively, you can right-click one of the selected images and select Export to workspace from the context menu.
To export an individual image from the folder, right-click the image, select Export image to workspace from the context menu, and specify the name of the workspace variable.
See Also
Image Browser
| imageDatastore