\HeaderA{denoise}{Noise removal, blurring and smoothing or images}{denoise}
\aliasA{blur}{denoise}{blur}
\aliasA{blur,Image-method}{denoise}{blur,Image.Rdash.method}
\aliasA{denoise,Image-method}{denoise}{denoise,Image.Rdash.method}
\aliasA{despeckle}{denoise}{despeckle}
\aliasA{despeckle,Image-method}{denoise}{despeckle,Image.Rdash.method}
\aliasA{gblur}{denoise}{gblur}
\aliasA{gblur,Image-method}{denoise}{gblur,Image.Rdash.method}
\aliasA{mediansmooth}{denoise}{mediansmooth}
\aliasA{mediansmooth,Image-method}{denoise}{mediansmooth,Image.Rdash.method}
\aliasA{noise}{denoise}{noise}
\aliasA{noise,Image-method}{denoise}{noise,Image.Rdash.method}
\aliasA{sharpen}{denoise}{sharpen}
\aliasA{sharpen,Image-method}{denoise}{sharpen,Image.Rdash.method}
\aliasA{umask}{denoise}{umask}
\aliasA{umask,Image-method}{denoise}{umask,Image.Rdash.method}
\keyword{file}{denoise}
\begin{Description}\relax
This set of functions allows for the removal of noise, blurring and smoothing
of images. The functions operate of images in any image mode. The functions and
the corresponding help descriptions are ported from \emph{ImageMagick}, see
the reference below.
\end{Description}
\begin{Usage}
\begin{verbatim}

  # Noise removal:
  ## S4 method for signature 'Image':
  denoise(x, r=0, ...)
  ## S4 method for signature 'Image':
  mediansmooth(x, r=2, ...)
  ## S4 method for signature 'Image':
  despeckle(x, ...)

  # Sharpening images:
  ## S4 method for signature 'Image':
  sharpen(x, r=0, s=0.5, ...)
  ## S4 method for signature 'Image':
  umask(x, r=0, s=0.5, amount=5, t=2, ...)

  # Blurring images:
  ## S4 method for signature 'Image':
  blur(x, r=0, s=0.5, ...)
  ## S4 method for signature 'Image':
  gblur(x, r=0, s=0.5, ...)

  # Adding noise to images:
  ## S4 method for signature 'Image':
  noise(x, type="G", ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] An object of \code{\LinkA{Image}{Image.Rdash.class}}. 
\item[\code{r}] A numeric value for the radius of the pixel neighbourhood.
Passing 0 enables automatic radius selection, default. 
\item[\code{s}] A numeric value for the standard deviation of the Laplacian
(\code{sharpen}) or Gaussian (\code{umask, blur, gblur}), in pixels. For
reasonable results, in most functions \code{r} must be larger than \code{s}. 
\item[\code{amount}] A numeric value for the percentage difference between
the original and the blurred image that is added back into the original in
the un-sharp mask algorithm. 
\item[\code{t}] A numeric value for the threshold in pixels needed to apply
the \code{amount} in the un-sharp mask algorithm.
\item[\code{type}] The type of noise to add. Supported noise types are:
\code{Uniform, Gaussian} (default), \code{Multi, Impulse,
    Laplace} and \code{Poisson}. The value can be specified by one letter.
Case insensitive. 
\item[\code{...}] Reserved. 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{despeckle} reduces the speckle-type, single-pixel, noise.

\code{mediansmooth} smooths the noisy image by replacing each pixel by
a median of pixel values in taken over the neighbouring as defined by radius.

\code{blur, gblur} produce a blurred image. The \code{blur} method differs from
the Gaussian blur, \code{gblur}, in that it uses a separable kernel which is
faster but mathematically equivalent to the non-separable kernel.

\code{sharpen, umask} sharpen an image. \code{umask} uses the un-sharp mask
algorithm, in which the image is convolved with a Gaussian operator of the given
radius and standard deviation, \code{s}.
\end{Details}
\begin{Value}
A transformed image in an object of \code{\LinkA{Image}{Image.Rdash.class}}.
\end{Value}
\begin{Author}\relax
Oleg Sklyar, \email{osklyar@ebi.ac.uk}, 2005-2007
\end{Author}
\begin{References}\relax
\emph{ImageMagick}: \url{http://www.imagemagick.org}.
\end{References}
\begin{SeeAlso}\relax
\code{
    \LinkA{Image}{Image.Rdash.class}, \LinkA{Image}{Image.Rdash.class}
}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  w <- 120
  a <- Image((0:(w^2))/w^2, c(w,w))
  if ( interactive() ) display(a)
  b <- normalize(noise(a) * 0.1)
  if ( interactive() ) display(b)
  dn <- despeckle(b)
  if ( interactive() ) display(dn)
  bl <- blur(dn, 4, 2)
  if ( interactive() ) display(bl)
\end{ExampleCode}
\end{Examples}

