Mercurial > hg > octave-image
changeset 221:19e7d0a052f4
Texinfo-fication of the help texts
author | hauberg |
---|---|
date | Thu, 04 Jan 2007 21:58:50 +0000 |
parents | df13bd973471 |
children | 79ff7c116059 |
files | src/__magick_read__.cc src/bwfill.cc src/bwlabel.cc src/cordflt2.cc src/deriche.cc src/graycomatrix.cc src/houghtf.cc src/jpgread.cc src/jpgwrite.cc src/pngwrite.cc src/rotate_scale.cc |
diffstat | 11 files changed, 146 insertions(+), 117 deletions(-) [+] |
line wrap: on
line diff
--- a/src/__magick_read__.cc +++ b/src/__magick_read__.cc @@ -232,15 +232,16 @@ Array<int>, unsigned int depth); -DEFUN_DLD(__magick_read__, args, nargout, -"function m = __imagemagick_read__(fname[, index])\n\ -function [m, colormap] = __imagemagick_read__(fname[, index])\n\ -function [m, colormap, alpha] = __imagemagick_read__(fname[, index])\n\ -\n\ -Read images with ImageMagick++. User interface in imread.m.\n\ -\n\ -") -{ +DEFUN_DLD(__magick_read__, args, nargout, "\ +-*- texinfo -*-\n\ +@deftypefn {Function File} {@var{m} =} __imagemagick_read__(@var{fname}, @var{index})\n\ +@deftypefnx{Function File} {[@var{m}, @var{colormap}] =} __imagemagick_read__(@var{fname}, @var{index})\n\ +@deftypefnx{Function File} {[@var{m}, @var{colormap}, @var{alpha}] =} __imagemagick_read__(@var{fname}, @var{index})\n\ +Read images with ImageMagick++. In general you should not be using this function.\n\ +Instead you should use @code{imread}.\n\ +@seealso{imread}\n\ +@end deftypefn\n\ +") { octave_value_list output; int i; if(args.length() > 2 || args.length() < 1 || !args(0).is_string() \
--- a/src/bwfill.cc +++ b/src/bwfill.cc @@ -33,17 +33,23 @@ (*npoints)++; } -DEFUN_DLD (bwfill, args, , - "[...] = bwfill (...)\n\ - [BW2,IDX] = BWFILL(BW1,Y,X,N) performs a flood-fill on BW1\n\ -\n\ - (X(k), Y(k)) are rows and columns of seed points\n\ +DEFUN_DLD (bwfill, args, ,"\ +-*- texinfo -*-\n\ +@deftypefn {Function File} {[@var{bw2}, @var{idx}] =} bwfill(@var{bw1}, @var{r}, @var{c}, @var{n})\n\ +Perform a flood-fill operation on the binary image @var{bw1}.\n\ +The flood-filling starts in the pixel (@var{r}, @var{c}). If @var{r} and @var{c}\n\ +are vectors of the same length, each pixel pair (@var{r}(i), @var{c}(i)) will\n\ +be a starting point for a flood-fill operation.\n\ +The argument @var{n} changes the neighborhood connectivity for the flood-fill\n\ +operation. @var{n} can be either 4 or 8, and has a default value of 8.\n\ \n\ - [BW2,IDX] = BWFILL(BW1,'holes',N) fills interior holes in BW1\n\ -\n\ - N = 4 or 8(default) for neighborhood connectedness\n\ -\n\ - IDX is the indices of the filled pixels") +The output is the processed image @var{bw2} and the indexes of the filled\n\ +pixels @var{idx}\n\ +@deftypefnx{Function File} {[@var{bw2}, @var{idx}] =} bwfill(@var{bw1}, \"holes\", @var{n})\n\ +If the string \"holes\" is given instead of starting points for the flood-fill\n\ +operation, the function finds interior holes in @var{bw1} and fills them.\n\ +@end deftypefn\n\ +") { octave_value_list retval; octave_value tmp; @@ -180,6 +186,9 @@ /* * $Log$ + * Revision 1.3 2007/01/04 21:58:50 hauberg + * Texinfo-fication of the help texts + * * Revision 1.2 2006/08/23 23:58:45 adb014 * remove cruft of #ifdef *
--- a/src/bwlabel.cc +++ b/src/bwlabel.cc @@ -44,18 +44,23 @@ /* %!assert(bwlabel([0 1 0; 0 0 0; 1 0 1]),[0 1 0; 0 0 0; 2 0 3]); */ -DEFUN_DLD(bwlabel, args, , -"\n\ -[l,num] = bwlabel( bw, n ) - label foreground components of boolean image\n\ +DEFUN_DLD(bwlabel, args, , "\ +-*- texinfo -*-\n\ +@deftypefn {Function File} {[@var{l}, @var{num}] =} bwlabel(@var{bw}, @var{n})\n\ +Labels foreground objects in the binary image @var{bw}.\n\ +The output @var{l} is a matrix where 0 indicates a background pixel,\n\ +1 indicates that the pixel belong to object number 1, 2 that the pixel\n\ +belong to object number 2, etc.\n\ +The total number of objects is @var{num}.\n\ \n\ - bw - boolean image array\n\ - n - neighborhood connectedness (4, 6,or 8)\n\ +To pixels belong to the same object if the are neighbors. By default\n\ +the algorithm uses 6-connectivity to define a neighborhood, but this\n\ +can be changed through the argument @var{n} that can be either 4, 6, or 8.\n\ \n\ - l - label image array\n\ - num - number of components labeled\n\ -\n\ - The algorithm is derived from BKP Horn, Robot Vision, MIT Press,\n\ - 1986, p 65 - 89 \n" ) +The algorithm is derived from BKP Horn, Robot Vision, MIT Press,\n\ +1986, p 65 - 89\n\ +@end deftypefn\n\ +") { if ( any_bad_argument(args) ) return octave_value_list();
--- a/src/cordflt2.cc +++ b/src/cordflt2.cc @@ -172,11 +172,14 @@ //template int compare<Complex>(const Complex, const Complex); template octave_value_list do_filtering<ComplexMatrix, Complex>(ComplexMatrix, int, boolMatrix, ComplexMatrix); -DEFUN_DLD(cordflt2, args, , -"function retval = cordflt2(A, nth, domain, S)\n\ -\n\ - Implementation of two-dimensional ordered filtering. User interface\n\ - in ordfilt2.m") +DEFUN_DLD(cordflt2, args, , "\ +-*- texinfo -*-\n\ +@deftypefn {Function File} cordflt2(@var{A}, @var{nth}, @var{domain}, @var{S})\n\ +Implementation of two-dimensional ordered filtering. In general this function\n\ +should NOT be used. Instead use @code{ordfilt2}.\n\ +@seealso{ordfilt2}\n\ +@end deftypefn\n\ +") { if(args.length() != 4) { print_usage ();
--- a/src/deriche.cc +++ b/src/deriche.cc @@ -13,6 +13,9 @@ * * History: * $Log$ + * Revision 1.2 2007/01/04 21:58:50 hauberg + * Texinfo-fication of the help texts + * * Revision 1.1 2006/12/08 06:43:30 cocus * fast c implementation to replace m file deriche.m * @@ -34,8 +37,8 @@ " */ - static void dericheAbs(const double *p, double *q, unsigned w, unsigned h, unsigned linLen, double alpha); - static void dericheVec(const double *p, double *q, unsigned w, unsigned h, unsigned linLen, double alpha); + static void dericheAbs(const double *p, double *q, int w, int h, int linLen, double alpha); + static void dericheVec(const double *p, double *q, int w, int h, int linLen, double alpha); DEFUN_DLD(deriche, args, , "-*- texinfo -*-\n\ @@ -104,7 +107,7 @@ } // q has to be dense gapless, for w and liLen may differ - static void dericheAbs(const double *p, double *q, unsigned w, unsigned h, unsigned linLen, double alpha){ + static void dericheAbs(const double *p, double *q, int w, int h, int linLen, double alpha){ double a(1.0-exp(-alpha)); a = - (a*a); double b1(-2.0 * exp(-alpha)); @@ -114,7 +117,7 @@ double a2(a1-a0*b1); double a3(-a0*b2); double *tmp = 0; - unsigned const sz = h*w; + //const int sz = h*w; // unused try { tmp = new double[2*h*w + 2*w]; if (!tmp) error("alloc error"); @@ -125,7 +128,7 @@ double* Z2 = Z3 + w; const double *ze; // int8 - double *za; // int8 + //double *za; // int8 // unused double *Ba1; double *Ba2; @@ -206,7 +209,7 @@ } // q has to be dense gapless, for w and liLen may differ - static void dericheVec(const double *p, double *q, unsigned w, unsigned h, unsigned linLen, double alpha){ + static void dericheVec(const double *p, double *q, int w, int h, int linLen, double alpha){ double a(1.0-exp(-alpha)); a = - (a*a); double b1(-2.0 * exp(-alpha)); @@ -217,7 +220,7 @@ double a3(-a0*b2); double *tmp = 0; double *r=q+h*w; - unsigned const sz = h*w; + //const int sz = h*w; // unused try { tmp = new double[2*h*w + 2*w]; if (!tmp) error("alloc error"); @@ -228,7 +231,7 @@ double* Z2 = Z3 + w; const double *ze; // int8 - double *za; // int8 + //double *za; // int8 // unused double *Ba1; double *Ba2;
--- a/src/graycomatrix.cc +++ b/src/graycomatrix.cc @@ -25,20 +25,20 @@ #include <octave/oct.h> DEFUN_DLD(graycomatrix, args, , "\ -\ -usage: P = graycomatrix(I, levels, distances, angles)\n\ -\n\ - Calculate the gray-level co-occurrence matrix P = f(i,j,d,theta)\n\ - of a gray-level image.\n\ +-*- texinfo -*-\n\ +@deftypefn {Function File} {@var{P} =} graycomatrix(@var{im}, @var{levels}, @var{distances}, @var{angles})\n\ +Calculates the gray-level co-occurrence matrix @var{P} of a gray-level image @var{im}.\n\ \n\ - P is a 4-dimensional matrix (histogram). The value P(i,j,d,theta)\n\ - is the number of times that gray-level j occurs at a distance 'd' and\n\ - at an angle 'theta' from gray-level j.\n\ +@var{P} is a 4-dimensional matrix (histogram). The value @var{P}(@var{i},@var{j},@var{d},@var{theta})\n\ +is the number of times that gray-level @var{j} occurs at a distance @var{d} and\n\ +at an angle @var{theta} from gray-level @var{i}.\n\ \n\ - 'I' is the input image which should contain integers in [0, levels-1],\n\ - where 'levels' indicate the number of gray-levels counted (typically\n\ - 256 for an 8-bit image). 'distances' and 'angles' are vectors of\n\ - the different distances and angles to use.\n" ) { +@var{im} is the input image which should contain integers in [0, @var{levels}-1],\n\ +where @var{levels} indicate the number of gray-levels counted (typically\n\ +256 for an 8-bit image). @var{distances} and @var{angles} are vectors of\n\ +the different distances and angles to use.\n\ +@end deftypefn\n\ +" ) { // 4-dimensional histogram // P = f(i, j, d, theta) where i and j are gray levels @@ -71,8 +71,8 @@ NDArray P = NDArray(dim, 0); // Run through image - int d_max = (int)ceil(d.max()); - int cnt = 0; + //int d_max = (int)ceil(d.max()); //unused + //int cnt = 0; //unused for (int r = 0; r < I.rows(); r++) { for (int c = 0; c < I.columns(); c++) {
--- a/src/houghtf.cc +++ b/src/houghtf.cc @@ -25,17 +25,18 @@ #include <octave/oct.h> DEFUN_DLD(houghtf, args, , "\ -\ -usage: [H, R] = houghtf(I[, angles])\n\ +-*- texinfo -*-\n\ +@deftypefn {Function File} {[@var{H}, @var{R}] =} houghtf(@var{I}, @var{angles})\n\ +Calculate the straight line Hough transform of a binary image @var{I}.\n\ \n\ - Calculate the straight line Hough transform of an image.\n\ +The angles are given in degrees and defaults to -90:90.\n\ \n\ - The image, I, should be a binary image in [0,1]. The angles are given\n\ - in degrees and defaults to -90..90.\n\ +@var{H} is the resulting Hough transform, and @var{R} is the radial distances.\n\ \n\ - H is the resulting transform, R the radial distances.\n\ -\n\ - See also: Digital Image Processing by Gonzales & Woods (2nd ed., p. 587)\n") { +The algorithm is described in\n\ +Digital Image Processing by Gonzales & Woods (2nd ed., p. 587)\n\ +@end deftypefn\n\ +") { octave_value_list retval; bool DEF_THETA = false;
--- a/src/jpgread.cc +++ b/src/jpgread.cc @@ -74,18 +74,19 @@ longjmp(octerr->setjmp_buffer, 1); } -DEFUN_DLD (jpgread, args, nargout , -"usage: I = jpgread('filename')\n\ -\n\ - Read a JPEG file from disk.\n\ +DEFUN_DLD (jpgread, args, nargout , "\ +-*- texinfo -*-\n\ +@deftypefn {Function File} {@var{I} =} jpgread(@var{filename})\n\ +Read a JPEG file from disk.\n\ \n\ - For a grey-level image, the output is an MxN matrix. For a\n\ - colour image, three such matrices are returned (MxNx3),\n\ - representing the red, green and blue components. The output\n\ - is of class 'uint8'.\n\ +For a grey-level image, the output is an MxN matrix. For a\n\ +colour image, three such matrices are returned (MxNx3),\n\ +representing the red, green and blue components. The output\n\ +is of class 'uint8'.\n\ \n\ - See also: imread, im2double, im2gray, im2rgb.") -{ +@seealso{imread, im2double, im2gray, im2rgb}\n\ +@end deftypefn\n\ +") { octave_value_list retval; int nargin = args.length(); @@ -162,7 +163,7 @@ coord(0) = j; for (unsigned long i=0; i<cinfo.output_width; i++) { coord(1) = i; - for (unsigned int c = 0; c < cinfo.output_components; c++) { + for (int c = 0; c < cinfo.output_components; c++) { coord(2) = c; out(coord) = buffer[0][i*cinfo.output_components+c]; }
--- a/src/jpgwrite.cc +++ b/src/jpgwrite.cc @@ -43,20 +43,25 @@ * ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6.tar.gz */ -DEFUN_DLD (jpgwrite, args, , -"JPGWRITE Write a JPEG file to disk.\n\ - jpgwrite('filename',R,G,B,quality) writes the specified file\n\ - using the Red, Green, and Blue intensity matrices, at the given quality.\n\ - \n\ - jpgwrite('filename',M,quality) writes a grey-scale image.\n\ - \n\ - Data must be [0 255] or the high bytes will be lost\n\ - \n\ - If specified, quality should be in the range 1-100 and will default to \n\ - 75 if not specified. 100 is best quality, 1 is best compression.\n\ - \n\ - See also JPGREAD") -{ +DEFUN_DLD (jpgwrite, args, , "\ +-*- texinfo -*-\n\ +@deftypefn {Function File} jpgwrite(@var{filename}, @var{R}, @var{G}, @var{B}, @var{quality})\n\ +@deftypefnx{Function File} jpgwrite(@var{filename}, @var{I}, @var{quality})\n\ +Write a JPEG file to disc.\n\ +\n\ +If three matrices @var{R}, @var{G}, and @var{B} are given the function will write\n\ +a color image to the disc, where @var{R} is the red channel, @var{G} the green channel,\n\ +and @var{B} the blue channel of the image.\n\ +\n\ +If only one matrix @var{I} is given the function writes a gray-scale image to the disc.\n\ +\n\ +In all cases the data matrices should have integer values between 0 and 255.\n\ +\n\ +If specified, @var{quality} should be in the range 1-100 and will default to\n\ +75 if not specified. 100 is best quality, and 1 is best compression.\n\ +@seealso{jpgread, imwrite}\n\ +@end deftypefn\n\ +") { octave_value_list retval; int nargin = args.length();
--- a/src/pngwrite.cc +++ b/src/pngwrite.cc @@ -44,12 +44,14 @@ void save_canvas(canvas *can, char *filename); DEFUN_DLD (pngwrite, args, ,"\ -pngwrite writes a png file to the disk.\n\ - pngwrite('filename',R,G,B,A) writes the specified file\n\ - using the Red, Green, Blue and Alpha matrices.\n\ - \n\ - Data must be [0 255] or the high bytes will be lost.") -{ +-*- texinfo -*-\n\ +@deftypefn {Function File} pngwrite(@var{filename}, @var{R}, @var{G}, @var{B}, @var{A})\n\ +Writes a png file to the disk using the Red, Green, Blue and Alpha matrices.\n\ +\n\ +Data must be [0 255] or the high bytes will be lost.\n\ +@seealso{imwrite}\n\ +@end deftypefn\n\ +") { octave_value_list retval; int nargin = args.length();
--- a/src/rotate_scale.cc +++ b/src/rotate_scale.cc @@ -29,28 +29,27 @@ const double * img0, double * img1 ); -DEFUN_DLD (rotate_scale, args, , - "ROTATE_SCALE: arbitrary rotation and scaling of an image\n" - " using fast bilinear interpolation\n" - "im1 = rotate_scale(im0, lm0, lm1, out_size)\n" - " where:\n" - "im0 = input image\n" - "lm0 = landmarks of points in original image [ x1,x2;y1,y2 ]\n" - "im1 = output image, where size(im1) == out_size\n" - "lm1 = landmarks of points in output image [ x1,x2;y1,y2 ]\n" - "\n" - " note1: two landmarks must be specified for lm0 and lm1\n" - " note2: all images have a single component\n" - " to use this for colour images, use:\n" - " r_im1= rotate_scale( red_im0, lm0, lm1, out_size)\n" - " g_im1= rotate_scale( grn_im0, lm0, lm1, out_size)\n" - " b_im1= rotate_scale( blu_im0, lm0, lm1, out_size)\n" - "\n" - " example:\n" - " im0= zeros(100); im0(25:75,25:75)=1;\n" - " im1= rotate_scale( im0, [40,60;50,50],[60,90;60,90],[120,120]);\n" -) -{ +DEFUN_DLD (rotate_scale, args, , "\ +-*- texinfo -*-\n\ +@deftypefn {Function File} {@var{im1} =} rotate_scale(@var{im0}, @var{lm0}, @var{lm1}, @var{out_size})\n\ +Arbitrary rotation and scaling of a gray-scale image using fast bilinear interpolation.\n\ +\n\ +The image @var{im0} will be rotated and scaled such that the landmark points in\n\ +@var{lm0} in the image will be placed in the landmark points in @var{lm1} in\n\ +the output image @var{im1}. The landmark points are given as a 2 by 2 matrix\n\ +where the first row contains the x-coordinates of the landmarks, and the second\n\ +row contains the y-coordinates.\n\ +\n\ +The size of the output image is given in the vector @var{out_size}.\n\ +\n\ +The following example shows basic usage of the function\n\ +@example\n\ +im0 = zeros(100); im0(25:75, 25:75)=1;\n\ +im1 = rotate_scale( im0, [40,60; 50,50], [60,90; 60,90], [120,120]);\n\ +@end example\n\ +@seealso{imrotate, imresize}\n\ +@end deftypefn\n\ +") { octave_value_list retval; if (args.length() < 4 || !args(0).is_matrix_type() ||