changeset 220:df13bd973471

Documentation is now in Texinfo (looks better on the website)
author hauberg
date Tue, 02 Jan 2007 21:58:38 +0000
parents 86749dc087db
children 19e7d0a052f4
files inst/bmpwrite.m inst/bwborder.m inst/bwlabel.m inst/bwselect.m inst/colfilt.m inst/colorgradient.m inst/deriche.m inst/edge.m inst/fftconv2.m inst/flag.m inst/fspecial.m inst/imginfo.m inst/imnoise.m inst/imread.m inst/imwrite.m
diffstat 15 files changed, 529 insertions(+), 302 deletions(-) [+]
line wrap: on
line diff
--- a/inst/bmpwrite.m
+++ b/inst/bmpwrite.m
@@ -1,13 +1,16 @@
-## bmpwrite(X,map,file)
-##   Write the bitmap X into file (8-bit indexed uncompressed).
-##   The values in X are indices into the given RGB colour map.
-## bmpwrite(X,file)
-##   Write the bitmap X into file (24-bit truecolor uncompressed).
-##   X is an m x n x 3 array of R,G,B values.
+## -*- texinfo -*-
+## @deftypefn {Function File} bmpwrite (@var{X}, @var{map}, @var{file})
+## Write the bitmap @var{X} into @var{file} (8-bit indexed uncompressed).
+## The values in @var{X} are indices into the given RGB colour @var{map}.
+## @deftypefnx{Function File} bmpwrite (@var{X}, @var{file})
+## Write the bitmap @var{X} into @var{file} (24-bit truecolor uncompressed).
+## @var{X} is an m x n x 3 array of R,G,B values.
+## @end deftypefn
 
 ## This code is in the public domain.
 ## Author: Paul Kienzle <pkienzle@users.sf.net>
 
+
 function bmpwrite(x,map,file)
   if nargin==2
      bmpwrite_truecolor(x,map);
--- a/inst/bwborder.m
+++ b/inst/bwborder.m
@@ -14,12 +14,13 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-##       b = bwborder(im)
-##
-## b is the borders in the 0-1 matrix im. 4-neighborhood is considered.
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{b} = } bwborder (@var{im})
+## @var{b} is the borders in the 0-1 matrix @var{im}. 4-neighborhood is considered.
 ## 
-## A pixel is on the border if it is set in im, and it has at least one
+## A pixel is on the border if it is set in @var{im}, and it has at least one
 ## neighbor that is not set.
+## @end deftypefn
 
 ## Author:        Etienne Grossmann <etienne@cs.uky.edu>
 ## Last modified: January 2000
--- a/inst/bwlabel.m
+++ b/inst/bwlabel.m
@@ -14,26 +14,39 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-##       [im2,npix,bb] = bwlabel(im, mins, maxs, verbose)
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{im2}, @var{npix} ,@var{bb}] = } bwlabel(@var{im}, @var{mins}, @var{maxs}, @var{verbose})
 ##
 ## Find the connected regions of an image.
 ##  
-## im  : RxC 0-1 matrix
+## @table @code
+## @item @var{im}
+## RxC 0-1 matrix
 ##
-## im2 : RxC int matrix in which the connected regions of im have been
-##       numbered. 4-neighborhoods are considered.
+## @item @var{im2}
+## RxC int matrix in which the connected regions of im have been
+## numbered. 4-neighborhoods are considered.
 ##
-## npix : 1xQ int number of pixel in each region
+## @item @var{npix}
+## 1xQ int number of pixel in each region
 ##
-## bb   : 4xQ int bounding boxes of the regions. Rows are minrow,
-##        maxrow, mincol, maxcol.
+## @item @var{bb}
+## 4xQ int bounding boxes of the regions. Rows are minrow,
+## maxrow, mincol, maxcol.
+## @end table
 ##
 ## Options :
 ##
-## mins     : Minimum size of the regions (set to zero for no minimum)
-## maxs     : Maximum size of the regions (set to zero for no maximum)
-## verbose  : Level of output comments in range 0 to 2.
+## @table @code
+## @item @var{mins}
+## Minimum size of the regions (set to zero for no minimum)
+## @item @var{maxs}
+## Maximum size of the regions (set to zero for no maximum)
+## @item @var{verbose}
+## Level of output comments in range 0 to 2.
+## @end table
 ##
+## @end deftypefn
 
 ## Author:        Etienne Grossmann <etienne@cs.uky.edu>
 ## Last modified: July 2002
--- a/inst/bwselect.m
+++ b/inst/bwselect.m
@@ -1,13 +1,21 @@
-function [imout, idx] = bwselect( im, cols, rows, connect )
-# BWSELECT: select connected regions in a binary image
-# [imout, idx] = bwselect( im, cols, rows, connect )
-#
-#   im          -> binary input image
-#   [cols,rows] -> vectors of starting points (x,y)
-#   connect     -> connectedness 4 or 8. default is 8
-#   imout       -> the image of all objects in image im that overlap
-#                  pixels in (cols,rows)
-#   idx         -> index of pixels in imout
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{imout}, @var{idx}] =} bwselect(@var{im}, @var{cols}, @var{rows}, @var{connect})
+## Select connected regions in a binary image
+##
+## @table @code
+## @item @var{im}
+## binary input image
+## @item [@var{cols}, @var{rows}]
+## vectors of starting points (x,y)
+## @item @var{connect}
+## connectedness 4 or 8. default is 8
+## @item @var{imout}
+## the image of all objects in image im that overlap
+## pixels in (cols,rows)
+## @item @var{idx}
+## index of pixels in imout
+## @end table
+## @end deftypefn
 
 # Copyright (C) 1999 Andy Adler
 # This code has no warrany whatsoever.
@@ -15,6 +23,7 @@
 #     leave this copyright in place.
 #
 # $Id$
+function [imout, idx] = bwselect( im, cols, rows, connect )
 
 if nargin<4
    connect= 8;
@@ -27,6 +36,9 @@
 
 # 
 # $Log$
+# Revision 1.2  2007/01/02 21:58:38  hauberg
+# Documentation is now in Texinfo (looks better on the website)
+#
 # Revision 1.1  2006/08/20 12:59:32  hauberg
 # Changed the structure to match the package system
 #
--- a/inst/colfilt.m
+++ b/inst/colfilt.m
@@ -1,27 +1,32 @@
-## COLFILT Apply filter to matrix blocks
-## colfilt(A,[r c],[m n],'sliding',f,...)
-##   For each r x c overlapping subblock of A, add a column in matrix C
-##   f(C,...) should return a row vector which is then reshaped into a
-##   a matrix of size A and returned.  A is processed in chunks of size m x n.
-## colfilt(A,[r c],[m n],'distinct',f,...)
-##   For each r x c non-overlapping subblock of A, add a column in matrix C
-##   f(C,...) should return a matrix of size C each column of which is
-##   placed back into the subblock from whence it came.  A is processed
-##   in chunks of size m x n.
+## -*- texinfo -*-
+## @deftypefn {Function File} colfilt(@var{A}, [@var{r}, @var{c}], [@var{m}, @var{n}], 'sliding', @var{f},...)
+## Apply filter to matrix blocks
+##
+##   For each @var{r} x @var{c} overlapping subblock of @var{A}, add a column in matrix @var{C}
+##   @var{f}(@var{C},...) should return a row vector which is then reshaped into a
+##   a matrix of size @var{A} and returned. @var{A} is processed in chunks of size @var{m} x @var{n}.
+## @deftypefnx{Function File} colfilt(@var{A}, [@var{r}, @var{c}], [@var{m}, @var{n}], 'distinct', @var{f},...)
+##   For each @var{r} x @var{c} non-overlapping subblock of @var{A}, add a column in matrix @var{C}
+##   @var{f}(@var{C},...) should return a matrix of size @var{C} each column of which is
+##   placed back into the subblock from whence it came. @var{A} is processed
+##   in chunks of size @var{m} x @var{n}.
 ##
-## The present version requires [m n], but for compatibility it should
-## be optional.  Use colfilt(A,[r c],size(A),...)
+## The present version requires [@var{m}, @var{n}], but for compatibility it should
+## be optional.  Use colfilt(@var{A},[@var{r}, @var{c}], size(@var{A}),...)
 ##
-## The present version requires that [m n] divide size(A), but for
-## compatibility it should work even if [m n] does not divide A. Use
+## The present version requires that [@var{m}, @var{n}] divide size(@var{A}), but for
+## compatibility it should work even if [@var{m}, @var{n}] does not divide @var{A}. Use
 ## the following instead:
-##    [r c] = size(A);
-##    padA = zeros (m*ceil(r/m),n*ceil(c/n));
-##    padA(1:r,1:c) = A;
-##    B = colfilt(padA,...);
-##    B = B(1:r,1:c);
+## @example
+## [r, c] = size(A);
+## padA = zeros (m*ceil(r/m),n*ceil(c/n));
+## padA(1:r,1:c) = A;
+## B = colfilt(padA,...);
+## B = B(1:r,1:c);
+## @end example
 ##
 ## The present version does not handle 'distinct'
+## @end deftypefn
 
 ## This software is granted to the public domain
 ## Author: Paul Kienzle <pkienzle@users.sf.net>
--- a/inst/colorgradient.m
+++ b/inst/colorgradient.m
@@ -1,14 +1,18 @@
-## M = colorgradient(C,w,n)
+## -*- texinfo -*-
+## @deftypefn {Function File} @var{M} = colorgradient(@var{C}, @var{w}, @var{n})
 ## Define a colour map which smoothly traverses the given colors.
-## C contains the colours, one row per r,g,b value.
-## w(i) is the relative length of the transition from colour i to colour i+1
+## @var{C} contains the colours, one row per r,g,b value.
+## @var{w}(i) is the relative length of the transition from colour i to colour i+1
 ## in the entire gradient.  The default is ones(rows(C)-1,1).
 ## n is the length of the colour map.  The default is rows(colormap).
 ##
-## E.g., 
-##    colorgradient([0,0,1; 1,1,0; 1,0,0])  # blue -> yellow -> red
-##    x = linspace(0,1,200);
-##    imagesc(x(:,ones(30,1)))';
+## E.g.,
+## @example 
+## colorgradient([0,0,1; 1,1,0; 1,0,0])  # blue -> yellow -> red
+## x = linspace(0,1,200);
+## imagesc(x(:,ones(30,1)))';
+## @end example
+## @end deftypefn
 
 ## This program is granted to the public domain.
 ## Author: Paul Kienzle <pkienzle@users.sf.net>
--- a/inst/deriche.m
+++ b/inst/deriche.m
@@ -1,30 +1,31 @@
-# $Id$
-function result = deriche(img, alpha, method)
-# OUTPUT
-# method  0 (default)
-#    magnitude of gradient
-# method = 1 
-#    vector gradient (last index 1 for H, 2 for V)
-# 
-# INPUT
-#  img    -> input image (as matrix of doubles) 
-#  alpha  -> filter paramter (scale)
-#
-# Deriche 2D image gradient using recursive filters. Precessing time is 
-# independent of alpha.
-# taken from:
-# Klette, Zamperoni: Handbuch der Operatoren für die Bildverarbeitung, vieweg 
-# 2.Aufl. 1995 pp 224-229
-# algorithm: Deriche R.: Fast algorithms for low-level vision: IEEE Trans. 
-# PAMI-12 (1990) pp 78-87
-#
-# Due to the inherent recursive nature of the algorithms the octave 
-# implementation is rather slow compared to a C implementation although I have
-# vectorized it as far as possible at the expense of memory consuption. As a 
-# side effect the evaluation order had to be modified compared to the Klette / 
-# Zamperoni approach. (A C Implementation can easily process PAL a video stream in 
-# realtime on moderate hardware.)
-#
+## -*- texinfo -*-
+## @deftypefn {Function File} @var{result} = deriche(@var{img}, @var{alpha}, @var{method})
+## Deriche 2D image gradient using recursive filters. Precessing time is 
+## independent of alpha.
+## taken from:
+## Klette, Zamperoni: Handbuch der Operatoren für die Bildverarbeitung, vieweg 
+## 2.Aufl. 1995 pp 224-229
+## algorithm: Deriche R.: Fast algorithms for low-level vision: IEEE Trans. 
+## PAMI-12 (1990) pp 78-87
+##
+## @table @code
+## @item @var{img}
+## Input image (as matrix of doubles).
+## @item @var{alpha}
+## Filter paramter (scale).
+## @item method
+## If 0 (default) magnitude of gradient, and if 1
+## vector gradient (last index 1 for H, 2 for V)
+## @end table
+##
+## Due to the inherent recursive nature of the algorithms the octave 
+## implementation is rather slow compared to a C implementation although I have
+## vectorized it as far as possible at the expense of memory consuption. As a 
+## side effect the evaluation order had to be modified compared to the Klette / 
+## Zamperoni approach. (A C Implementation can easily process PAL a video stream in 
+## realtime on moderate hardware.)
+## @end deftypefn
+
 # (C)opyright Christian Kotz 2006
 # This code has no warrany whatsoever.
 # Do what you like with this code as long as you
@@ -35,6 +36,9 @@
 # version:  0.1
 #
 ## $Log$
+## Revision 1.3  2007/01/02 21:58:38  hauberg
+## Documentation is now in Texinfo (looks better on the website)
+##
 ## Revision 1.2  2006/12/08 06:41:30  cocus
 ## interface changed to match cc implementation. (returns magnitude by default)
 ##
@@ -55,6 +59,7 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+function result = deriche(img, alpha, method)
 
 if nargin < 2
   alpha = 1.0
--- a/inst/edge.m
+++ b/inst/edge.m
@@ -1,55 +1,89 @@
-function [imout, thresh] = edge( im, method, thresh, param2 )
-# EDGE: find image edges
-# [imout, thresh] = edge( im, method, thresh, param2 )
-#
-# OUTPUT
-#  imout  -> output image
-#  thresh -> output thresholds
-#
-# INPUT
-#  im     -> input image (greyscale)
-#  thresh -> threshold value (value is estimated if not given)
-#  
-# The following methods are based on high pass filtering the image in
-#   two directions, calculating a combined edge weight from and then thresholding
-#
-# method = 'roberts'
-#     filt1= [1 0 ; 0 -1];   filt2= rot90( filt1 )
-#     combine= sqrt( filt1^2 + filt2^2 )  
-# method = 'sobel'
-#     filt1= [1 2 1;0 0 0;-1 -2 -1];      filt2= rot90( filt1 ) 
-#     combine= sqrt( filt1^2 + filt2^2 )  
-# method = 'prewitt'
-#     filt1= [1 1 1;0 0 0;-1 -1 -1];      filt2= rot90( filt1 ) 
-#     combine= sqrt( filt1^2 + filt2^2 )  
-# method = 'kirsh'
-#     filt1= [1 2 1;0 0 0;-1 -2 -1];  filt2 .. filt8 are 45 degree rotations of filt1
-#     combine= max( filt1 ... filt8 )
-#
-# methods based on filtering the image and finding zero crossings
-#
-# method = 'log' -> Laplacian of Gaussians 
-#      param2 is the standard deviation of the filter, default is 2
-# method = 'zerocross' -> generic zero-crossing filter
-#      param2 is the user supplied filter
-# 
-# method = 'andy' -> my idea
-#      A.Adler's idea (c) 1999. somewhat based on the canny method
-#      Step 1: Do a sobel edge detection and to generate an image at
-#               a high and low threshold
-#      Step 2: Edge extend all edges in the LT image by several pixels,
-#               in the vertical, horizontal, and 45degree directions.
-#               Combine these into edge extended (EE) image
-#      Step 3: Dilate the EE image by 1 step
-#      Step 4: Select all EE features that are connected to features in
-#               the HT image
-#                
-#      Parameters:
-#        param2(1)==0 or 4 or 8 -> perform x connected dilatation (step 3)
-#        param2(2)    dilatation coeficient (threshold) in step 3
-#        param2(3)    length of edge extention convolution (step 2)
-#        param2(4)    coeficient of extention convolution in step 2
-#        defaults = [8 1 3 3]
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{imout}, @var{thresh}] = } edge(@var{im}, @var{method}, @var{thresh}, @var{param2})
+## Find image edges
+##
+## The output is
+## @table @code
+## @item @var{imout}
+## Output image
+## @item @var{thresh}
+## Output thresholds
+## @end table
+##
+## The input is
+## @table @code
+## @item @var{im}
+## Input image (greyscale)
+## @item @var{thresh}
+## Threshold value (value is estimated if not given)
+## @end table
+##
+## The following methods are based on high pass filtering the image in
+## two directions, calculating a combined edge weight from and then thresholding
+##
+## @table @code
+## @item method = 'roberts'
+## @example
+## filt1= [1 0 ; 0 -1];   filt2= rot90( filt1 )
+## combine= sqrt( filt1^2 + filt2^2 )  
+## @end example
+## @item method = 'sobel'
+## @example
+## filt1= [1 2 1;0 0 0;-1 -2 -1];      filt2= rot90( filt1 ) 
+## combine= sqrt( filt1^2 + filt2^2 )  
+## @end example
+## @item method = 'prewitt'
+## @example
+## filt1= [1 1 1;0 0 0;-1 -1 -1];      filt2= rot90( filt1 ) 
+## combine= sqrt( filt1^2 + filt2^2 )
+## @end example
+## @item method = 'kirsh'
+## @example
+## filt1= [1 2 1;0 0 0;-1 -2 -1];  filt2 .. filt8 are 45 degree rotations of filt1
+## combine= max( filt1 ... filt8 )
+## @end example
+## @end table
+##
+## Methods based on filtering the image and finding zero crossings
+##
+## @table @code
+## @item method = 'log'
+## Laplacian of Gaussian.
+## @var{param2} is the standard deviation of the filter, default is 2.
+## @item method = 'zerocross'
+## generic zero-crossing filter.
+## @var{param2} is the user supplied filter.
+## @item method = 'andy'
+## A.Adler's idea (c) 1999. somewhat based on the canny method. The steps are
+## @enumerate
+## @item
+## Do a sobel edge detection and to generate an image at
+## a high and low threshold.
+## @item
+## Edge extend all edges in the LT image by several pixels,
+## in the vertical, horizontal, and 45degree directions.
+## Combine these into edge extended (EE) image.
+## @item
+## Dilate the EE image by 1 step.
+## @item
+## Select all EE features that are connected to features in
+## the HT image.
+## @end enumerate
+## 
+## The parameters for the method are:
+## @table @code
+## @item param2(1)==0 or 4 or 8
+## Perform x connected dilatation (step 3).
+## @item param2(2)
+## Dilatation coeficient (threshold) in step 3.
+## @item param2(3)
+## Length of edge extention convolution (step 2).
+## @item param2(4)
+## Coeficient of extention convolution in step 2.
+## @end table
+## defaults = [8 1 3 3]
+## @end table
+## @end deftypefn
 
 # Copyright (C) 1999 Andy Adler
 # This code has no warrany whatsoever.
@@ -58,6 +92,8 @@
 #
 # $Id$
 
+function [imout, thresh] = edge( im, method, thresh, param2 )
+
 [n,m]= size(im);
 xx= 2:m-1;
 yy= 2:n-1;
@@ -220,6 +256,9 @@
 
 # 
 # $Log$
+# Revision 1.2  2007/01/02 21:58:38  hauberg
+# Documentation is now in Texinfo (looks better on the website)
+#
 # Revision 1.1  2006/08/20 12:59:32  hauberg
 # Changed the structure to match the package system
 #
--- a/inst/fftconv2.m
+++ b/inst/fftconv2.m
@@ -22,16 +22,16 @@
 ## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 ## SUCH DAMAGE.
 
-## FFTCONV2 Convolve 2 dimensional signals using the FFT.
-##
-## usage: fftconv2(a, b[, shape])
-##        fftconv2(v1, v2, a, shape)
+## -*- texinfo -*-
+## @deftypefn {Function File} fftconv2 (@var{a}, @var{b}, @var{shape})
+## @deftypefnx{Function File} fftconv2 (@var{v1}, @var{v2}, @var{a}, @var{shape})
+## Convolve 2 dimensional signals using the FFT.
 ##
-## This method is faster but less accurate for large a,b.  It
-## also uses more memory. A small complex component will be 
-## introduced even if both a and b are real.
-##
-## see also: conv2
+## This method is faster but less accurate than @var{conv2} for large @var{a} and @var{b}.
+## It also uses more memory. A small complex component will be 
+## introduced even if both @var{a} and @var{b} are real.
+## @seealso{conv2}
+## @end deftypefn
 
 ## Author: Stefan van der Walt <stefan@sun.ac.za>
 ## Date: 2004
--- a/inst/flag.m
+++ b/inst/flag.m
@@ -20,8 +20,8 @@
 ## (cycling through red, white, blue and black)
 ## The argument @var{n} should be a scalar.  If it
 ## is omitted, the length of the current colormap or 64 is assumed.
+## @seealso{colormap}
 ## @end deftypefn
-## @seealso{colormap}
 
 ## Author:  Kai Habel <kai.habel@gmx.de>
 
--- a/inst/fspecial.m
+++ b/inst/fspecial.m
@@ -14,6 +14,56 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{filter} = } fspecial(@var{type}, @var{arg1}, @var{arg2})
+## Create spatial filters for image processing.
+##
+## @var{type} determines the shape of the filter and can be
+## @table @code
+## @item 'average'
+## Rectangular averaging filter.
+## @item 'disk'
+## Circular averaging filter.
+## @item 'gaussian'
+## Gaussian filter.
+## @item 'log'
+## Laplacian of Gaussian.
+## @item 'laplacian'
+## 3x3 approximation of the laplacian.
+## @item 'unsharp'
+## Sharpening filter.
+## @item 'motion'
+## Moion blur filter of width 1 pixel.
+## @item 'sobel'
+## Horizontal Sobel edge filter.
+## @item 'prewitt'
+## Horizontal Prewitt edge filter.
+## @end table
+##
+## The parameters that need to be specified depend on the filtertype.
+##
+## Examples of use and associated default values:
+## @example
+##  f = fspecial('average',sze)           # sze can be a 1 or 2 vector
+##                                        # default is [3, 3].
+##  f = fspecial('disk',radius)           # default radius = 5
+##  f = fspecial('gaussian',sze, sigma)   # default sigma is 0.5
+##  f = fspecial('laplacian',sze, sigma)  # default sze is [5, 5]
+##                                        # default sigma is 0.5
+##  f = fspecial('log');
+##  f = fspecial('motion', length, angle) # default length is 9
+##                                        # default angle is 0 (degrees)
+##  f = fspecial('sobel');
+##  f = fspecial('prewitt');
+## @end example
+## When sze is specified as a single value the filter will be square.
+## @end deftypefn
+
+## Remarks by Søren Hauberg (jan. 2nd 2007)
+## The motion filter and most of the documentation was taken from Peter Kovesi's
+## GPL'ed implementation of fspecial from 
+## http://www.csse.uwa.edu.au/~pk/research/matlabfns/OctaveCode/fspecial.m
+
 function [ f ] = fspecial (type, arg1, arg2)
   if (!ischar(type))
     error("fspecial: first argument must be a string");
--- a/inst/imginfo.m
+++ b/inst/imginfo.m
@@ -11,17 +11,23 @@
 ## for more details.
 ##
 
-## [h,w] = imginfo (filename) - Get image size from file
-##  hw   = imginfo (filename)
-## 
-## filename : string : Name of image file
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{hw} =} imginfo (@var{filename})
+## @deftypefnx{Function File} {[@var{h}, @var{w}] =} imginfo (@var{filename})
+## Get image size from file @var{filename}.
 ##
-## h        : 1      : Height of image, in pixels
-## w        : 1      : Width  of image, in pixels
-##    or
-## hw=[h,w] : 2      : Height and width of image 
+## The output is the size of the image
+## @table @code
+## @item @var{h}
+## Height of image, in pixels.
+## @item @var{w}
+## Width  of image, in pixels.
+## @item @var{hw} = [@var{h}, @var{w}]
+## Height and width of image.
+## @end table
 ##
 ## NOTE : imginfo relies on the 'convert' program.
+## @end deftypefn
 
 ## Author:        Etienne Grossmann <etienne@cs.uky.edu>
 ## Last modified: Setembro 2002
--- a/inst/imnoise.m
+++ b/inst/imnoise.m
@@ -14,21 +14,22 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-## usage: B = imnoise (A, type)
-##
-## Adds noise to image in A.
-##
-## imnoise (A, 'gaussian' [, mean [, var]])
-##    additive gaussian noise: A = A + noise
-##    defaults to mean=0, var=0.01
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{B} =} imnoise (@var{A}, @var{type})
+## Adds noise to image in @var{A}.
 ##
-## imnoise (A, 'salt & pepper' [, density])
-##    lost pixels: A = 0 or 1 for density*100% of the pixels
-##    defaults to density=0.05, or 5%
-##
-## imnoise (A, 'speckle' [, var])
-##    multiplicative gaussian noise: A = A + A*noise
-##    defaults to var=0.04
+## @table @code
+## @item imnoise (A, 'gaussian' [, mean [, var]])
+## additive gaussian noise: @var{B} = @var{A} + noise
+## defaults to mean=0, var=0.01
+## @item  imnoise (A, 'salt & pepper' [, density])
+## lost pixels: A = 0 or 1 for density*100% of the pixels
+## defaults to density=0.05, or 5%
+## @item imnoise (A, 'speckle' [, var])
+## multiplicative gaussian noise: @var{B} = @var{A} + @var{A}*noise
+## defaults to var=0.04
+## @end table
+## @end deftypefn
 
 ## Modified: Stefan van der Walt <stefan@sun.ac.za>, 2004-02-24
 
--- a/inst/imread.m
+++ b/inst/imread.m
@@ -5,24 +5,22 @@
 ## the Free Software Foundation; either version 2, or (at your option)
 ## any later version. USE THIS SOFTWARE AT YOUR OWN RISK.
 
-## usage: I = imread(fname)
-##
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{I} =} imread(@var{filename})
 ## Read images from various file formats.
 ##
-##   The size and numeric class of the output depends on the
-##   format of the image.  A colour image is returned as an
-##   MxNx3 matrix.  Grey-level and black-and-white images are
-##   of size MxN.
-##     The colour depth of the image determines the numeric
-##   class of the output: 'uint8' or 'uint16' for grey
-##   and colour, and 'logical' for black and white.
+## The size and numeric class of the output depends on the
+## format of the image.  A colour image is returned as an
+## MxNx3 matrix.  Grey-level and black-and-white images are
+## of size MxN.
+## The colour depth of the image determines the numeric
+## class of the output: 'uint8' or 'uint16' for grey
+## and colour, and 'logical' for black and white.
 ##
-##   Note: For image formats other than jpeg and png, the
-##         ImageMagick "convert" and "identify" utilities
-##         are needed. ImageMagick can be found at
-##
-##         www.imagemagick.org
-##
+## Note: For image formats other than jpeg and png, the
+## ImageMagick "convert" and "identify" utilities
+## are needed. ImageMagick can be found at www.imagemagick.org
+## @end deftypefn
 
 ## Author: Andy Adler
 ##
--- a/inst/imwrite.m
+++ b/inst/imwrite.m
@@ -5,126 +5,213 @@
 ## the Free Software Foundation; either version 2, or (at your option)
 ## any later version. USE THIS SOFTWARE AT YOUR OWN RISK.
 
-#IMWRITE: write image from octave to various file formats
-#
-# Note: this requires the ImageMagick "convert" utility.
-#       get this from www.imagemagick.org if required
-#       additional documentation of options is available from the
-#       convert man page
-#
-# BASIC USAGE:
-# imwrite( fname, img )
-#                 - img is a greyscale (0-255) of image in fname
-# imwrite( fname, img, map )
-#                 - map is a matrix of [r,g,b], 0-1 triples
-#                 - img is a matrix on indeces into map
-# imwrite( fname, r,g,b );
-#                 - r,g,b are red,green,blue (0-255) compondents
-#
-# Formats for image fname
-#   1. simple guess from extention ie "fig.jpg", "blah.gif"
-#   2. specify explicitly             "jpg:fig.jpg", "gif:blah.gif"
-#   3. specify subimage for multi-image format "tiff:file.tif[3]"
-#   4. raw images (row major format) specify geometry
-#                                      "raw:img[256x180]"
-#
-# IMREAD OPTIONS:
-# imread will support most of the options for convert.1
-#
-# imwrite( fname, img, options )
-# imwrite( fname, img, map, options )
-# imwrite( fname, r,g,b, options );
-#
-# where options is a string matrix (or list) of options
-#
-# example:   options= ["-rotate 25";
-#                      "-crop 200x200+150+150";
-#                      "-sample 200%" ];
-#   will rotate, crop, and then expand the image.
-#   note that the order of operations is important
-#
-# The following options are supported
-#  -antialias           remove pixel-aliasing
-#  -background color    background color
-#  -blur geometry       blur the image
-#  -border geometry     surround image with a border of color
-#  -bordercolor color   border color
-#  -box color           color for annotation bounding box
-#  -charcoal radius     simulate a charcoal drawing
-#  -colorize value      colorize the image with the fill color
-#  -colors value        preferred number of colors in the image
-#  -colorspace type     alternate image colorspace
-#  -comment string      annotate image with comment
-#  -compress type       type of image compression
-#  -contrast            enhance or reduce the image contrast
-#  -crop geometry       preferred size and location of the cropped image
-#  -density geometry    vertical and horizontal density of the image
-#  -depth value         depth of the image
-#  -despeckle           reduce the speckles within an image
-#  -dispose method      GIF disposal method
-#  -dither              apply Floyd/Steinberg error diffusion to image
-#  -draw string         annotate the image with a graphic primitive
-#  -edge radius         apply a filter to detect edges in the image
-#  -emboss radius       emboss an image
-#  -enhance             apply a digital filter to enhance a noisy image
-#  -equalize            perform histogram equalization to an image
-#  -fill color          color to use when filling a graphic primitive
-#  -filter type         use this filter when resizing an image
-#  -flip                flip image in the vertical direction
-#  -flop                flop image in the horizontal direction
-#  -font name           font for rendering text
-#  -frame geometry      surround image with an ornamental border
-#  -fuzz distance       colors within this distance are considered equal
-#  -gamma value         level of gamma correction
-#  -geometry geometry   perferred size or location of the image
-#  -gaussian geometry   gaussian blur an image
-#  -gravity type        vertical and horizontal text placement
-#  -implode amount      implode image pixels about the center
-#  -intent type         Absolute, Perceptual, Relative, or Saturation
-#  -interlace type      None, Line, Plane, or Partition
-#  -label name          assign a label to an image
-#  -level value         adjust the level of image contrast
-#  -list type           Color, Delegate, Format, Magic, Module, or Type
-#  -map filename        transform image colors to match this set of colors
-#  -matte               store matte channel if the image has one
-#  -median radius       apply a median filter to the image
-#  -modulate value      vary the brightness, saturation, and hue
-#  -monochrome          transform image to black and white
-#  -morph value         morph an image sequence
-#  -negate              replace every pixel with its complementary color 
-#  -noise radius        add or reduce noise in an image
-#  -normalize           transform image to span the full range of colors
-#  -opaque color        change this color to the fill color
-#  -page geometry       size and location of an image canvas
-#  -paint radius        simulate an oil painting
-#  -profile filename    add ICM or IPTC information profile to image
-#  -quality value       JPEG/MIFF/PNG compression level
-#  -raise value         lighten/darken image edges to create a 3-D effect
-#  -region geometry     apply options to a portion of the image
-#  -roll geometry       roll an image vertically or horizontally
-#  -rotate degrees      apply Paeth rotation to the image
-#  -sample geometry     scale image with pixel sampling
-#  -scale geometry      resize image
-#  -segment values      segment an image
-#  -seed value          pseudo-random number generator seed value
-#  -shade degrees       shade the image using a distant light source
-#  -sharpen geometry    sharpen the image
-#  -shave geometry      shave pixels from the image edges
-#  -shear geometry      slide one edge of the image along the X or Y axis
-#  -size geometry       width and height of image
-#  -solarize threshold  negate all pixels above the threshold level
-#  -spread amount       displace image pixels by a random amount
-#  -stroke color        color to use when stoking a graphic primitive
-#  -strokewidth value   width of stroke
-#  -swirl degrees       swirl image pixels about the center
-#  -texture filename    name of texture to tile onto the image background
-#  -threshold value     threshold the image
-#  -tile filename       tile image when filling a graphic primitive
-#  -transparent color   make this color transparent within the image
-#  -treedepth value     depth of the color tree
-#  -type type           image type
-#  -units type          PixelsPerInch, PixelsPerCentimeter, or Undefined
-#  -unsharp geometry    sharpen the image
+## -*- texinfo -*-
+## @deftypefn {Function File} imwrite(@var{fname}, @var{img})
+## Write image from octave to various file formats
+##
+## Note: this requires the ImageMagick "convert" utility.
+## get this from www.imagemagick.org if required
+## additional documentation of options is available from the
+## convert man page.
+##
+## @deftypefnx{Function File} imwrite(@var{fname}, @var{img})
+## @var{img} is a greyscale (0-255) of image in fname.
+## @deftypefnx{Function File} imwrite(@var{fname}, @var{img}, @var{map})
+## @var{map} is a matrix of [r,g,b], 0-1 triplesm and
+## @var{img} is a matrix on indeces into map.
+## @deftypefnx{Function File} imwrite(@var{fname}, @var{r}, @var{g}, @var{b});
+## @var{r}, @var{g}, @var{b} are red, green, blue (0-255) compondents.
+##
+## Formats for image fname
+## @enumerate
+## @item
+## Simple guess from extention, i.e. "fig.jpg", "blah.gif".
+## @item
+## Specify explicitly, i.e. "jpg:fig.jpg", "gif:blah.gif".
+## @item
+## Specify subimage for multi-image format: "tiff:file.tif[3]".
+## @item
+## Raw images (row major format) specify geometry: "raw:img[256x180]".
+## @end enumerate
+##
+## @deftypefnx{Function File} imwrite(@var{fname}, @var{img}, @var{options})
+## @deftypefnx{Function File} imwrite(@var{fname}, @var{img}, @var{map}, @var{options})
+## @deftypefnx{Function File} imwrite(@var{fname}, @var{r}, @var{g}, @var{b}, @var{options});
+## It is possible to give extra options to imwrite, for example:
+## @example
+## options= ["-rotate 25";
+##           "-crop 200x200+150+150";
+##           "-sample 200%" ];
+## @end example
+## will rotate, crop, and then expand the image.
+## note that the order of operations is important
+##
+## The following options are supported
+## @table @code
+## @item -antialias
+## remove pixel-aliasing
+## @item  -background color
+## background color
+## @item  -blur geometry
+## blur the image
+## @item  -border geometry
+## surround image with a border of color
+## @item  -bordercolor color
+## border color
+## @item  -box color
+## color for annotation bounding box
+## @item  -charcoal radius
+## simulate a charcoal drawing
+## @item  -colorize value
+## colorize the image with the fill color
+## @item  -colors value
+## preferred number of colors in the image
+## @item  -colorspace type
+## alternate image colorspace
+## @item  -comment string
+## annotate image with comment
+## @item  -compress type
+## type of image compression
+## @item  -contrast
+## enhance or reduce the image contrast
+## @item  -crop geometry
+## preferred size and location of the cropped image
+## @item  -density geometry
+## vertical and horizontal density of the image
+## @item  -depth value
+## depth of the image
+## @item  -despeckle
+## reduce the speckles within an image
+## @item  -dispose method
+## GIF disposal method
+## @item  -dither
+## apply Floyd/Steinberg error diffusion to image
+## @item  -draw string
+## annotate the image with a graphic primitive
+## @item  -edge radius
+## apply a filter to detect edges in the image
+## @item  -emboss radius
+## emboss an image
+## @item  -enhance
+## apply a digital filter to enhance a noisy image
+## @item  -equalize
+## perform histogram equalization to an image
+## @item  -fill color
+## color to use when filling a graphic primitive
+## @item  -filter type
+## use this filter when resizing an image
+## @item  -flip
+## flip image in the vertical direction
+## @item  -flop
+## flop image in the horizontal direction
+## @item  -font name
+## font for rendering text
+## @item  -frame geometry
+## surround image with an ornamental border
+## @item  -fuzz distance
+## colors within this distance are considered equal
+## @item  -gamma value
+## level of gamma correction
+## @item  -geometry geometry
+## perferred size or location of the image
+## @item  -gaussian geometry
+## gaussian blur an image
+## @item  -gravity type
+## vertical and horizontal text placement
+## @item  -implode amount
+## implode image pixels about the center
+## @item  -intent type
+## Absolute, Perceptual, Relative, or Saturation
+## @item  -interlace type
+## None, Line, Plane, or Partition
+## @item  -label name
+## assign a label to an image
+## @item  -level value
+## adjust the level of image contrast
+## @item  -list type
+## Color, Delegate, Format, Magic, Module, or Type
+## @item  -map filename
+## transform image colors to match this set of colors
+## @item  -matte
+## store matte channel if the image has one
+## @item  -median radius
+## apply a median filter to the image
+## @item  -modulate value
+## vary the brightness, saturation, and hue
+## @item  -monochrome
+## transform image to black and white
+## @item  -morph value
+## morph an image sequence
+## @item  -negate
+## replace every pixel with its complementary color 
+## @item  -noise radius
+## add or reduce noise in an image
+## @item  -normalize
+## transform image to span the full range of colors
+## @item  -opaque color
+## change this color to the fill color
+## @item  -page geometry
+## size and location of an image canvas
+## @item  -paint radius
+## simulate an oil painting
+## @item  -profile filename
+## add ICM or IPTC information profile to image
+## @item  -quality value
+## JPEG/MIFF/PNG compression level
+## @item  -raise value
+## lighten/darken image edges to create a 3-D effect
+## @item  -region geometry
+## apply options to a portion of the image
+## @item  -roll geometry
+## roll an image vertically or horizontally
+## @item  -rotate degrees
+## apply Paeth rotation to the image
+## @item  -sample geometry
+## scale image with pixel sampling
+## @item  -scale geometry
+## resize image
+## @item  -segment values
+## segment an image
+## @item  -seed value
+## pseudo-random number generator seed value
+## @item  -shade degrees
+## shade the image using a distant light source
+## @item  -sharpen geometry
+## sharpen the image
+## @item  -shave geometry
+## shave pixels from the image edges
+## @item  -shear geometry
+## slide one edge of the image along the X or Y axis
+## @item  -size geometry
+## width and height of image
+## @item  -solarize threshold
+## negate all pixels above the threshold level
+## @item  -spread amount
+## displace image pixels by a random amount
+## @item  -stroke color
+## color to use when stoking a graphic primitive
+## @item  -strokewidth value
+## width of stroke
+## @item  -swirl degrees
+## swirl image pixels about the center
+## @item  -texture filename
+## name of texture to tile onto the image background
+## @item  -threshold value
+## threshold the image
+## @item  -tile filename
+## tile image when filling a graphic primitive
+## @item  -transparent color
+## make this color transparent within the image
+## @item  -treedepth value
+## depth of the color tree
+## @item  -type type
+## image type
+## @item  -units type
+## PixelsPerInch, PixelsPerCentimeter, or Undefined
+## @item  -unsharp geometry
+## sharpen the image
+## @end table
+## @end deftypefn
 
 function imwrite(fname, p2, p3 ,p4 ,p5 );
 
@@ -255,6 +342,9 @@
 
 #
 # $Log$
+# Revision 1.3  2007/01/02 21:58:38  hauberg
+# Documentation is now in Texinfo (looks better on the website)
+#
 # Revision 1.2  2006/11/26 10:47:39  hauberg
 # Compatibility changes
 #