To take advantage of the performance benefits offered by a modern Graphics Processing Unit (GPU), certain Image Processing Toolbox™ functions have been enabled to perform image processing operations on a GPU. This can provide GPU acceleration for complicated image processing workflows. These techniques can be implemented exclusively or in combination to satisfy design requirements and performance goals. To perform an image processing operation on a GPU, follow these steps:
Move the data from the CPU to the GPU. You do this
by creating an object of type gpuArray, using the
Perform the image processing operation on the GPU.
Any toolbox function that accepts a gpuArray object as an input can
work on a GPU. For example, you can pass a gpuArray to the
to perform the filtering operation on a GPU. For a list of all the
toolbox functions that have been GPU-enabled, see List of Supported Functions with Limitations and Other Notes.
Move the data back onto the CPU from the GPU. Applications
typically move the data from the GPU back to the CPU after processing,
For more information:
For general information about using GPUs, see Transfer Arrays Between Workspace and GPU (Parallel Computing Toolbox).
To see an example of performing image processing operations on a GPU, see Perform Thresholding and Morphological Operations on a GPU.
To learn about integrating custom CUDA kernels directly into MATLAB to accelerate complex algorithms, see Run CUDA or PTX Code on GPU (Parallel Computing Toolbox).
Note: To run image processing code on a graphics processing unit (GPU), you must have the Parallel Computing Toolbox™ software.
When working with a GPU, note the following:
Performance improvements can depend on the GPU device.
There may be small differences in the results returned on a GPU from those returned on a CPU.