GNG

Gaussian Noise Generation


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Example

Back to top

Description


Adds random Gaussian noise to an existing image.
Back to top

Parameters


gng(file, dboc, dbow, mean, stdv, seed)

Name Type Caption Length Value range
FILE * str Input file name 1 -    
DBOC * List[int] Random Noise Layer 1 -    
DBOW List[int] Raster output window 0 - 4 0 -
MEAN * List[float] Mean value 1 - 1  
STDV * List[float] Standard deviation 1 - 1 0 -
SEED List[int] Random number seed (odd) 0 - 1 101 - 32767
Default: 1357

* Required parameter
Back to top

Parameter descriptions

FILE

Specifies the name of the input file that contains the layer(s) to be processed.

DBOC

Specifies the output channel(s) or layer(s) to receive the output results.

Duplicate channels are not allowed.

DBOW

Specifies the raster window (Xoffset, Yoffset, Xsize, Ysize) to be processed. If DBOW is not specified, the entire layer is output by default. Xoffset and Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.

MEAN

Specifies the average gray-level value of Gaussian noise.

Note: When adding noise to an existing image, the desired mean is typically 0.0.

STDV

Specifies the standard deviation in units of gray-level values. The value that the user specifies will correspond to one standard deviation.

SEED

Specifies the random number seed.

This value must be an odd integer, between 101 and 32767.

Back to top

Details

GNG generates Gaussian noise and adds it to a specified set of output image channels (DBOC) in the specified file. GNG is used to test the robustness of various image analysis algorithms, such as classifiers, filters, and transforms, in the presence of noise. The Gaussian noise has a specified mean (MEAN) and standard deviation (STDV), defined in gray-level units. When adding noise to existing image data, the mean is typically set to 0.

Gaussian noise can be added over a specified output window (DBOW), if desired.

A random number seed (SEED) must be specified and must be an odd number. This allows the generation of different Gaussian images (based on different seeds) having the same mean and standard deviation.

Back to top

Example

Add random Gaussian noise (with a mean of 0 and 34% of the additive noise in the gray level range 0-3) to an existing image channel (1-4) from the file 'irvine.pix' in window 16,16,64,64.

from pci.gng import gng

file     = 'irvine.pix'   #Input file name
dboc     = [1,2,3,4]    #add noise to channels 1-4
mean     = [0.0]          #noise has a mean 0.0
stdv     = [3.0]          #1 34% of the additive noise has gray level of 0-3
seed     = [111]          #random number seed 111 used to generate noise
dbow     = []

gng(file, dboc, dbow, mean, stdv, seed)

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.