SALT_PEPPER_NOISE_CVIP

salt_pepper_noise_cvip() - add speckle(Salt & Pepper) noise to an image.

Contents

SYNTAX

outImage = salt_pepper_cvip(inImage, noiseArgs, noiseImgSize)

Input Parameters include :

Output Parameter includes:

Description

The function performs morphological hit-miss transform on a binary image.If input image color or gray-scale image, binary thresholding is performed before the hit-miss operation.The hit-miss filter is a structuring element containing 0's, 1's and NaN's or "don't care". Don't care element is represented by NaN value in this case. And, don't care elements in the structuring element match with either 0s or 1s.

Reference

1. Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.

Example

% Read image

 I = imread('butterfly.tif');

% Call function using default parameters

 O1 = salt_pepper_noise_cvip(I);

% Call function using user specified parameters Salt & Pepper noise added image

 noise_parameter = [0.03 0.2];       %Prob. of Salt = 0.03, Prob. of Pepper = 0

 O2 = salt_pepper_noise_cvip(I,noise_parameter);

% Call function using user specified parameters Salt noise added image

 image_size = [300 400];    %  height = 300, width = 400

 noise_parameter = [0.03 0];

 O3 = salt_pepper_noise_cvip([],noise_parameter, image_size);

% Call function using user specified parameters Pepper noise added image

 image_size = [300 400];

 noise_parameter = [0 0.03];

 O4 = salt_pepper_noise_cvip(I,noise_parameter, image_size);

% Display input image

 figure;imshow(I);title('Input image');

% Display output image

 figure; imshow(O1,[]); title('Salt & Pepper noise added image using default parameters');

 figure; imshow(O2,[]);title('Salt & Pepper noise added image using user specified parameters') ;

 figure; imshow(O3,[]);title('Salt noise added image using user specified parameters') ;

 figure; imshow(O4,[]);title('Pepper noise added image using user specified parameters') ;

CREDITS

Author: Norsang Lama, June 2017
Copyright © 2017-2018 Scott E Umbaugh
For updates visit CVIP Toolbox Website