next up previous contents index
Next: fquant Up: Reference Previous: flgamma   Contents   Index

fnoise

$ \bigcirc$Name


fnoise Put noise on a Fimage




$ \bigcirc$Command Synopsis


fnoise [-g std] [-i p] [-n] in out



-g std : additive Gaussian noise with standard deviation std

-i p : impulse noise (image range), applied to p percent of the pixels

-n : in order NOT to reinitialize the random seed

in : input Fimage

out : output Fimage




$ \bigcirc$Function Summary


void fnoise (u , v , std , p , n_flag )

Fimage u , v ;

float *std , *p ;

char *n_flag ;




$ \bigcirc$Description


This module corrupts a Fimage with additive Gaussian noise or with impulse noise.


$ \bullet$ If the -g option is selected, then the input image u is transformed into v = u + n, where (x, y) $ \mapsto$ n(x, y) is a field of i.i.d; Gaussian random variables with standart deviation std. This means that the law of each n(x, y) is given by the density function

t $\displaystyle \mapsto$ $\displaystyle {\frac{{1}}{{std \sqrt{2 \pi}}}}$e-$\scriptstyle {\frac{{t^2}}{{2 std ^2}}}$.

Such a random variable can be generated by

n = std  $\displaystyle \sqrt{{-2\ln a}}$  cos 2$\displaystyle \pi$b,

where a and b are independant random values uniformely distributed on [0, 1[.


$ \bullet$ If the -i option is selected, then the input image u is transformed into

v : (x, y) $\displaystyle \mapsto$ $\displaystyle \left\{\vphantom{ \begin{array}{l}
i(x,y) \;\quad\mbox{if}\quad n(x,y)=1,\\
u(x,y) \quad\mbox{if}\quad n(x,y)=0,
\end{array} }\right.$$\displaystyle \begin{array}{l}
i(x,y) \;\quad\mbox{if}\quad n(x,y)=1,\\
u(x,y) \quad\mbox{if}\quad n(x,y)=0,
\end{array}$

where n is a field of i.i.d. Bernouilli random variables taking the value 1 with probability p and the value 0 with probability 1 - p, and i is a a field of i.i.d. variables uniformly distributed in [min u, max u].


The random seed used (drand48) is reinitialized with the current time unless the -n option is set.


NB: Calling this C-subroutine with out = in is possible




$ \bigcirc$Version 1.0


Last Modification date : Thu Jun 6 16:40:50 2002


$ \bigcirc$Author


Lionel Moisan






next up previous contents index
Next: fquant Up: Reference Previous: flgamma   Contents   Index
mw 2004-05-05