From 21ec53fda9bc565cf105e966f451f35fcb978668 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 9 Sep 2009 16:09:21 +0000 Subject: [PATCH] stuff --- TODO | 5 --- libvips/arithmetic/arith_dispatch.c | 12 +++++- libvips/arithmetic/im_linreg.c | 3 +- libvips/arithmetic/im_maxpos_vec.c | 60 +++++++++++++++++++---------- 4 files changed, 53 insertions(+), 27 deletions(-) diff --git a/TODO b/TODO index 775e6b49..89ff0e04 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,3 @@ -- im_maxpos_vec(), im_minpos_vec(), im_linreg() need gtkdoc - - @@ -12,8 +9,6 @@ > > pngcrush -c 0 -bit_depth 1 *.png - - - rename vipsCC in SWIG as pyvips? diff --git a/libvips/arithmetic/arith_dispatch.c b/libvips/arithmetic/arith_dispatch.c index 877c7c7e..b60395e4 100644 --- a/libvips/arithmetic/arith_dispatch.c +++ b/libvips/arithmetic/arith_dispatch.c @@ -45,7 +45,7 @@ /** * SECTION: arithmetic * @short_description: operations which perform pixel arithmetic, trig, log, - * stats + * statistics * * @see_also: iofuncs * @stability: Stable @@ -62,6 +62,16 @@ * one-band image by joining n copies of the one-band image together, and then * the two n-band images are operated upon. * + * In the same way, for operations that take a constant, such as + * im_remainderconst_vec(), the constant can either a vector with a single + * element (in which case the same constant is used for all image bands) or a + * vector with the same number of elements as there are bandsin the image (in + * which case one element is used for each band). + * + * im_lintra_vec() supports an additional mode where you can use a + * many-element vector with a single-band image to generate a multi-band + * image. No other operations support this yet. + * * Arithmetic operations try to preserve precision by increasing the number of * bits in the output image when necessary. Generally, this follows the ANSI C * conventions for type promotion, so multiplying two diff --git a/libvips/arithmetic/im_linreg.c b/libvips/arithmetic/im_linreg.c index 95bcc5f8..ba3396ec 100644 --- a/libvips/arithmetic/im_linreg.c +++ b/libvips/arithmetic/im_linreg.c @@ -142,7 +142,8 @@ SKIP_ALL_DECL( double ); /** EXPORTED FUNCTION DEFINITION **/ -/** im_linreg: +/** + * im_linreg: * @ins: NULL-terminated array of input images * @out: results of analysis * @xs: X position of each image (pixel value is Y) diff --git a/libvips/arithmetic/im_maxpos_vec.c b/libvips/arithmetic/im_maxpos_vec.c index 5542a091..c8cdaa77 100644 --- a/libvips/arithmetic/im_maxpos_vec.c +++ b/libvips/arithmetic/im_maxpos_vec.c @@ -1,23 +1,4 @@ -/* @(#) Find the coordinates and values of the n maxima of an image. - * @(#) - * @(#) int im_maxpos_vec( - * @(#) IMAGE *im, - * @(#) int *xpos, - * @(#) int *ypos, - * @(#) double *maxima, - * @(#) int n - * @(#) ); - * @(#) - * @(#) Find the coordinates and values of the n minima of an image. - * @(#) - * @(#) int im_minpos_vec( - * @(#) IMAGE *im, - * @(#) int *xpos, - * @(#) int *ypos, - * @(#) double *minima, - * @(#) int n - * @(#) ); - * @(#) +/* im_maxpos_vec.c * * Copyright: 2006, The Nottingham Trent University * Copyright: 2006, Tom Vajzovic @@ -25,6 +6,9 @@ * Author: Tom Vajzovic * * Written on: 2006-09-01 + * + * 9/9/09 + * - gtkdoc comments */ /* @@ -103,6 +87,24 @@ static int minpos_vec_stop( void *seq, void *, void * ); /** EXPORTED FUNCTIONS **/ +/** + * im_maxpos_vec: + * @im: image to scan + * @xpos: array to return x positions + * @ypos: array to return y positions + * @maxima: array to return values + * @n: number of maxima to search for + * + * Find the coordinates and values of the n maxima of an image. + * + * For 8 and 16-bit images, it's much faster to find the histogram and then + * calculate a threshold from that. See im_mpercent(). + * + * See also: im_minpos(), im_min(), im_stats(), im_maxpos_avg(). + * + * Returns: 0 on success, -1 on error + */ + int im_maxpos_vec( IMAGE *im, int *xpos, int *ypos, double *maxima, int n ){ #define FUNCTION_NAME "im_maxpos_vec" /* number of sequences used is beyond my control at this level, but I note that */ @@ -149,6 +151,24 @@ int im_maxpos_vec( IMAGE *im, int *xpos, int *ypos, double *maxima, int n ){ } +/** + * im_minpos_vec: + * @im: image to scan + * @xpos: array to return x positions + * @ypos: array to return y positions + * @maxima: array to return values + * @n: number of minima to search for + * + * Find the coordinates and values of the n minima of an image. + * + * For 8 and 16-bit images, it's much faster to find the histogram and then + * calculate a threshold from that. See im_mpercent(). + * + * See also: im_minpos(), im_min(), im_stats(), im_maxpos_avg(). + * + * Returns: 0 on success, -1 on error + */ + int im_minpos_vec( IMAGE *im, int *xpos, int *ypos, double *minima, int n ){ #define FUNCTION_NAME "im_minpos_vec" /* number of sequences used is beyond my control at this level, but I note that */