# 使用预训练的神经网络去除彩色图像中的噪声

```pristineRGB = imread('lighthouse.png'); pristineRGB = im2double(pristineRGB); imshow(pristineRGB) title('Pristine Image')```

```noisyRGB = imnoise(pristineRGB,'gaussian',0,0.01); imshow(noisyRGB) title('Noisy Image')```

`[noisyR,noisyG,noisyB] = imsplit(noisyRGB);`

`net = denoisingNetwork('dncnn');`

```denoisedR = denoiseImage(noisyR,net); denoisedG = denoiseImage(noisyG,net); denoisedB = denoiseImage(noisyB,net);```

```denoisedRGB = cat(3,denoisedR,denoisedG,denoisedB); imshow(denoisedRGB) title('Denoised Image')```

```noisyPSNR = psnr(noisyRGB,pristineRGB); fprintf('\n The PSNR value of the noisy image is %0.4f.',noisyPSNR);```
``` The PSNR value of the noisy image is 20.6395. ```
```denoisedPSNR = psnr(denoisedRGB,pristineRGB); fprintf('\n The PSNR value of the denoised image is %0.4f.',denoisedPSNR);```
``` The PSNR value of the denoised image is 29.6857. ```

```noisySSIM = ssim(noisyRGB,pristineRGB); fprintf('\n The SSIM value of the noisy image is %0.4f.',noisySSIM);```
``` The SSIM value of the noisy image is 0.7393. ```
```denoisedSSIM = ssim(denoisedRGB,pristineRGB); fprintf('\n The SSIM value of the denoised image is %0.4f.',denoisedSSIM);```
``` The SSIM value of the denoised image is 0.9507. ```

## 另请参阅

(Image Processing Toolbox) | (Image Processing Toolbox) | (Image Processing Toolbox) | (Image Processing Toolbox) | (Image Processing Toolbox) | (Image Processing Toolbox) | (Image Processing Toolbox)