denoiseImage
Denoise image using deep neural network
Syntax
Description
Examples
Remove Image Noise Using Pretrained Neural Network
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.
montage({I,noisyI})
title("Original Image (Left) and Noisy Image (Right)")
Remove noise from the noisy image, then display the result.
denoisedI = denoiseImage(noisyI,net);
imshow(denoisedI)
title("Denoised Image")
Input Arguments
A
— Noisy image
2-D image | stack of 2-D images
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
net
— Denoising deep neural network
dlnetwork
object
Denoising deep neural network, specified as a dlnetwork
(Deep Learning Toolbox) object. The
network should be trained on images with the same number of color channels
as A
. The input size of the network does not need to
match the size of 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
by using the denoisingNetwork
function. For more information
about creating a denoising
network, see
Train and Apply Denoising Neural Networks.
Output Arguments
B
— Denoised image
2-D image | stack of 2-D images
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
.
Version History
Introduced in R2017bR2024a: DAGNetwork
and SeriesNetwork
objects are not recommended
Starting in R2024a, DAGNetwork
(Deep Learning Toolbox) and SeriesNetwork
(Deep Learning Toolbox) objects are not recommended. Instead, specify the
denoising network as a dlnetwork
(Deep Learning Toolbox) object.
There are no plans to remove support for DAGNetwork
and
SeriesNetwork
objects. However, dlnetwork
objects have these advantages:
dlnetwork
objects support a wider range of network architectures which you can then easily train using thetrainnet
(Deep Learning Toolbox) function or import from external platforms.dlnetwork
objects provide more flexibility. They have wider support with current and upcoming Deep Learning Toolbox functionality.dlnetwork
objects provide a unified data type that supports network building, prediction, built-in training, compression, and custom training loops.dlnetwork
training and prediction is typically faster thanDAGNetwork
andSeriesNetwork
training and prediction.
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)