NOISE_IMPULSE Function
Generates an array of impulse noise, also known as salt-and-pepper noise, in a blank array with a specified background; or applies the impulse noise to an existing image array.
Usage
result = NOISE_IMPULSE(probability, d1[, d2, ... , d8])
status = NOISE_IMPULSE(probability, image)
Input Parameters
probability—A floating point scalar, which is the probability of noise in the array. The probability  parameter values are between 0.0 and 1.0.
d1, ..., d8—The dimensions of the noise array.
 
note
The d1, ..., d8 input parameters are ignored for the status usage with the image parameter.
image—An array to corrupt by replacing its pixels with noise values.
Returned Value
result—An array corrupted with salt-and-pepper impulse noise in a solid background. The value of background is set using the Background keyword. The array data type is specified with the Type keyword. (Default: byte).
status—A value indicating the status of the noise corruption of image.
*1—Indicates successful noise corruption.
*0—Indicates a failed attempt.
Keywords
Amp_Seed—A scalar long value used as the seed for generating random-impulse amplitudes.
Background—A scalar setting for the desired background value of the result array. (Default = 127)
 
note
The Background keyword is ignored for the status usage with the image parameter.
Binary—If set and nonzero, the generated noise is binary, containing only the high and low values.
High—A scalar value setting for the high, “salt” noise. (Default: 255)
Index_Seed—A scalar long value used as the seed for generating random-impulse noise locations.
Low—A scalar value setting for the low, “pepper” noise. (Default: 0)
Type—A string indicating the desired data type of result. Valid strings include: 'byte', 'fix', 'float', or 'double'.
 
note
The Type keyword is ignored for the status usage with the image parameter.
Discussion
Impulse noise is often referred to as salt-and-pepper noise, and usually appears as bright and dark spots within an image. The High and Low keywords control the gray-level values for the salt (bright) and pepper (dark) noise, respectively. Salt and pepper noise are generated with equal probabilities, 0.5 each. In other words, one half of the noise is expected to be pepper noise and one half is expected to be salt noise. The probability parameter indicates the probability that a given pixel in the resulting image will be corrupted by noise. Typical values for probability are from 0.05 to 0.3.
Example
; Corrupt the image with impulse noise.
image = IMAGE_READ(!IP_Data + 'airplane.tif')
pixels = image('pixels')
status = NOISE_IMPULSE(0.15, pixels)
image('pixels') = pixels
; Display the corrupted image.
IMAGE_DISPLAY, image
; Attempt to remove the noise with a rank filter.
filt_image = FILT_NONLIN(image('pixels'), 3, 3, /Rankf, $
Rank_Num = 4)
TVSCL, filt_image
See Also