Routines (alphabetical) > Routines: N > NOISE_HURL

# NOISE_HURL

The NOISE_HURL function introduces noise into an image by changing randomly selected pixels to random colors. Pixel change probability is determined by a parameter that controls the amount of noise introduced into the image.

## Example

This example adds noise to a test image:

; Read an image:
image = BYTSCL(DIST(400))
; Add noise to the image:
image_noisy = NOISE_HURL(image, 0.2)
; Display the images side by side:
IIMAGE, image, VIEW_GRID=[2,1], VIEW_TITLE='Original', $
DIMENSIONS=[850, 550], WINDOW_TITLE='NOISE_HURL Example', $
/NO_SAVEPROMPT
IIMAGE, image_noisy, /VIEW_NEXT, VIEW_TITLE='Noisy'

The resulting images appear:

## Syntax

Result = NOISE_HURL (Image [, Randomization] [, ITERATIONS=value] [, REPLACE_MAX=value] [, REPLACE_MIN=value] [, SEED=value])

## Return Value

Result is an array of the same type and dimensions as Image.

## Arguments

### Image

An array containing the input image. One dimensional and two dimensional arrays are treated as single channel images. Arrays with more than two dimensions are treated as n-channel images, where the number of channels is contained in the first dimension. For example, a 3 x 200 x 200 array is a 3-channel 200 by 200 image. A 4 x 200 x 200 x 5 array is considered as a stack of five 200 by 200 4-channel images.

### Randomization

A floating-point scalar in the range 0.0-1.0 that specifies the probability of replacing each pixel with a random color. 0.0 means there is no chance of replacement and 1.0 means that the pixel is always replaced. The default value is 0.5.

Note: This value specifies the probability of replacement for each pixel. It does not necessarily mean that a particular percentage of the pixels are replaced.

## Keywords

### ITERATIONS

Set this keyword to the number of times to apply the noise generator. A similar effect can also be achieved by increasing the value of Randomization.

### REPLACE_MAX

Set this keyword to the maximum value used for the randomly-generated replacement colors. The default value is 255.

### REPLACE_MIN

Set this keyword to the minimum value used for the randomly-generated replacement colors. The default value is 0.

### SEED

Set this keyword to the seed value for the random number generator. This keyword is used in the same way as the SEED argument for RANDOMU.

## Version History

6.4 | Introduced