Image Batch Processor
Apply function to multiple images
Description
The Image Batch Processor app enables you to process multiple images using the same function. Using this app, you can:
Load images from a folder or from an
imageDatastoreobject in the workspace.Process images using an existing MATLAB® function, or create a custom batch processing function using a code template.
View intermediate and final processed images.
Export processed images to an output folder or the workspace.
Generate a function to process additional images outside the app.
If you have Parallel Computing Toolbox™ you can process the images on a local parallel pool.
To get started, see Process Folder of Images Using Image Batch Processor App.
Specify Batch Processing Function
You can specify the batch processing function as one of these options:
Existing MATLAB function — Specify an existing built-in or user-created function on the MATLAB search path. Type the function name in the Function Name box, or select it from the list. Alternatively, click Open to navigate to the function file you want to use.
Create new function — Create a custom batch processing function using a code template. Click Create in the app toolstrip to open the template.
A batch processing function can accept one or two input arguments.
Image — The first input must be the image array
im.Information structure — The optional second argument is a structure,
info, that contains information about the input image file. Theinfoargument is useful if your batch processing function internally calls one or more functions that require a filename as input, such asimreadorrawinfo. For details, see Access File Information.

Open the Image Batch Processor App
MATLAB Toolstrip: On the Apps tab, under Image Processing and Computer Vision, click the Image Batch Processor app icon.
MATLAB command prompt: Enter
imageBatchProcessor.
Examples
Programmatic Use
imageBatchProcessor opens the Image Batch
Processor app, which enables you to process a folder of images.
imageBatchProcessor(
opens the app and loads the batch of images stored in the folder
folderLocation)folderLocation. (since R2023a)
imageBatchProcessor(
opens the app and loads the images in the
imds)imageDatastore object
imds. (since R2023a)
imageBatchProcessor close closes all open
instances of the Image Batch Processor app.
More About
Access file information within your batch processing function by
including the optional info input argument. To
pass the info input argument to your batch
processing function, select Include Image Info
in the app toolstrip before you process any images. If the batch
processing function expects the info argument,
you must select the Include Image Info check
box or the app returns an error.
The app automatically creates info by using the
datastore read object
function, regardless of whether you load the images into the app
from a folder or an imageDatastore object. The
info structure contains these fields:
Filename— The image source filename, including the path string, name of the file, and file extension.FileSize— Total file size, in bytes.Label— Image label name, if present. Otherwise, theLabelfield contains an empty string.
In the batch processing function code template, access the file
information in info using dot notation. For
example, use this code to access the input image
filename.
filename = info.Filename
imread to read
the colormap from an indexed image file, or read metadata using
functions such as imfinfo,
rawinfo, or dicominfo.Version History
Introduced in R2015aThe Image Batch Processor app includes several new capabilities:
Image datastore support — Load a batch of images by importing an
imageDatastoreobject from the MATLAB workspace.Support for additional file formats — load images from RAW file formats and EXR images.
Additional command Line syntaxes — Open the Image Batch Processor and load images using two new syntaxes.
This syntax opens the app and loads the batch of images stored in the folder
folderLocation.This syntax opens the app and loads the images in theimageBatchProcessor(folderLocation)
imageDatastoreobjectimds.imageBatchProcessor(imds)
You can now optionally pass a second input argument,
info, to your batch processing function. Theinfoargument contains information about the image source, including the image filename. For an example that uses theinfoargument, see Process Images Using Image Batch Processor App with File Metadata.
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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)