数字图像处理实验(10):PROJECT 05-01 [Multiple Uses],Noise Generators
實驗要求:
Objective:
To know how to generate noise images with different probability density functions (distributions). The noise images are useful in simulation for image enhancement and image restoration.
Main requirements:
Ability of programming with C, C++, or Matlab.
Instruction manual:
This is a generic project, in the sense that the programs developed here are used in several of the projects that follow. See Fig. 5.2 for the shapes and parameters of the following noise probability density functions.
(a) Find (or develop) a program to add Gaussian noise to an image. You must be able to specify the noise mean and variance.
(b) Find (or develop) a program to add salt-and-pepper (impulse) noise to an image. You must be able to specify the probabilities of each of the two noise components.
本實驗比較簡單,目的就只是往圖片中添加各種噪聲,比如高斯噪聲或者椒鹽噪聲。還有一點要求就是要能夠向程序指定概率等等的一些參數。
給出原圖像:
實驗代碼:
% PROJECT 05-01 [Multiple Uses] Noise Generators close all; clc; clear all;% 原圖像 img =imread('Fig5.03.jpg'); figure; subplot(1,3,1); imshow(img); title('original image');% 添加高斯噪聲 img_nse1 = imnoise(img, 'gaussian', 0.2, 0.01); subplot(1,3,2); imshow(img_nse1); title('Plus gaussian noise');disp('高斯噪聲'); disp(['mean: ', num2str(0.2), ' variance: ', num2str(0.01)]);% 添加泊松噪聲 % img_nse2 = imnoise(img, 'poisson'); % figure; % imshow(img_nse2); % title('Plus poisson noise');% 添加椒鹽噪聲 img_nse3 = imnoise(img, 'salt & pepper', 0.2); subplot(1,3,3); imshow(img_nse3); title('Plus salt & pepper noise');disp('椒鹽噪聲'); disp(['probability: ', num2str(0.2)]);實驗結果:
注釋主要在代碼中,實驗現象也很明顯,分別顯示了添加高斯噪聲和椒鹽噪聲的圖像。
總結
以上是生活随笔為你收集整理的数字图像处理实验(10):PROJECT 05-01 [Multiple Uses],Noise Generators的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数字图像处理实验(9):PROJECT
- 下一篇: 数字图像处理实验(11):PROJECT