Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: image.convolve - Function Up: image - Tool Previous: image.adddegaxes - Function


image.addnoise - Function



Package general
Module images
Tool image


Add noise to the image


Synopsis
addnoise(type, pars, region, zero)


Arguments

type in Type of distribution
    Allowed: String - see below
    Default: 'normal'
pars in Parameters of distribution
    Allowed: Numeric vector
    Default: [0,1]
region in Region of interest
    Allowed: Region tool
    Default: Whole image
zero in Zero image first ?
    Allowed: T or F
    Default: F


Returns
T or fail



Description

This function adds noise to the image. You may zero the image first before the noise is added if you wish.

The noise can be drawn from one of many distributions, which are also available in the randomnumbers tool.

For each distribution, you must supply the type via the type argument (minimum match is active) and parameters via the pars argument. Each distribution type is described in detail in the randomnumbers tool. Briefly:

  • binomial - the binomial distribution models successfully drawing items from a pool. Specify two parameters, n and p, respectively. n is the number of items in the pool, and p, is the probability of each item being successfully drawn. It is required that n > 0 and 0$ \le$p$ \le$1.

  • discreteuniform - models a uniform random variable over the closed interval. Specify two parameters, the low and high values, respectively. The low parameter is the lowest possible return value and the high parameter is the highest. It is required that low < high.

  • erlang - Specify two parameters, the mean and variance, respectively. It is required that the mean is non-zero and the variance is positive.

  • geometric - Specify one parameter, the probability. It is required that 0$ \le$mean < 1.

  • hypergeometric - Specify two parameters, the mean and the variance. It is required that the variance is positive and that the mean is non-zero and not bigger than the square-root of the variance.

  • normal - Specify two parameters, the mean and the variance. It is required that the variance is positive.

  • lognormal - Specify two parameters, the mean and the variance. It is required that the supplied variance is positive and that the mean is non-zero.

  • negativeexponential - Supply one parameter, the mean.

  • poisson - Specify one parameter, the mean. It is required that the mean is non-negative.

  • uniform - Model a uniform random variable over a closed interval. Specify two parameters, the low and high values. The low parameter is the lowest possible return value and the high parameter can never be returned. It is required that low < high.

  • weibull - Specify two parameters, alpha and beta. It is required that the alpha parameter is not zero.



Example
- im1 := imagemaketestimage() 
- im1.addnoise(type='normal', pars=[0.5, 1], zero=T)
- im1.statistics()
NORMAL: Starting image::statistics
NORMAL: Selected bounding box [1, 1] to [113, 76]
NORMAL: Creating new statistics storage lattice of shape [9]
NORMAL: 
NORMAL: Number points =   8.588000e+03       Sum      =   4.258988e+03
NORMAL: Flux density  =   1.972103e+02 Jy
NORMAL: Mean          =   4.959231e-01
NORMAL: Variance      =   9.983749e-02       Sigma    =   3.159707e-01
NORMAL: Rms           =   5.880184e-01
NORMAL: 
NORMAL: Minimum value  -6.234988e-01 at [4, 39] (00:00:27.733, +00.00.12.000)
NORMAL: Maximum value   1.664114e+00 at [105, 11] (23:59:33.867, -00.05.24.000)
NORMAL: 
NORMAL: Finished image::statistics
       0.07 real        0.03 user           0 system
T

A test image is created, zeroed, and noise of mean 0.5 and variance 1 from a normal distribution added.



next up previous contents index
Next: image.convolve - Function Up: image - Tool Previous: image.adddegaxes - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01