Main Content


Denoise image using deep neural network



B = denoiseImage(A,net) estimates denoised image B from noisy image A using a denoising deep neural network specified by net.

This function requires that you have Deep Learning Toolbox™.


collapse all

Load the pretrained denoising convolutional neural network, 'DnCNN'.

net = denoisingNetwork('DnCNN');

Load a grayscale image into the workspace, then create a noisy version of the image.

I = imread('cameraman.tif');
noisyI = imnoise(I,'gaussian',0,0.01);

Display the two images as a montage.

title('Original Image (Left) and Noisy Image (Right)')

Figure contains an axes object. The axes object with title Original Image (Left) and Noisy Image (Right) contains an object of type image.

Remove noise from the noisy image, then display the result.

denoisedI = denoiseImage(noisyI,net);
title('Denoised Image')

Figure contains an axes object. The axes object with title Denoised Image contains an object of type image.

Input Arguments

collapse all

Noisy image, specified as a single 2-D image or a stack of 2-D images. A can be:

  • A 2-D grayscale image with size m-by-n.

  • A 2-D multichannel image with size m-by-n-by-c, where c is the number of image channels. For example, c is 3 for RGB images, and 4 for four-channel images such as RGB images with an infrared channel.

  • A stack of equally-sized 2-D images. In this case, A has size m-by-n-by-c-by-p, where p is the number of images in the stack.

Data Types: single | double | uint8 | uint16

Denoising deep neural network, specified as a SeriesNetwork (Deep Learning Toolbox) object. The network should be trained to handle images with the same channel format as A.

If the noisy image or stack of images A has only one channel and has Gaussian noise, then you can get a pretrained network using the denoisingNetwork function. For more information about creating a denoising network for multichannel images or for a different noise model, see Train and Apply Denoising Neural Networks.

Output Arguments

collapse all

Denoised image, returned as a single 2-D image or a stack of 2-D images. B has the same size and data type as A.


  • The denoiseImage function relies on the activations (Deep Learning Toolbox) function to estimate the noise of the input image, A. The denoiseImage function specifies the OutputAs name-value argument of activations as "channels" so that A can be larger than the network input size. In contrast, the predict (Deep Learning Toolbox) function requires that the image size match the network input size.

Version History

Introduced in R2017b