redo im_max()/im_maxpos() as classes

This commit is contained in:
John Cupitt 2011-11-06 17:00:44 +00:00
parent 132c962f96
commit 77d386cdaf
15 changed files with 382 additions and 306 deletions

View File

@ -7,7 +7,7 @@
im_lintra(), im_lintra_vec(), im_black(), im_rot90, im_rot180(), im_rot270()
im_sintra(), im_costra(), im_tantra(), im_asintra(), im_acostra(),
im_atantra(), im_exptra(), im_exp10tra(), im_logtra(), im_log10tra(),
im_abs(), im_sign()
im_abs(), im_sign(), im_max(), im_maxpos()
redone as classes
- added argument priorites to help control arg ordering
- generate has a 'stop' param to signal successful early termination

4
TODO
View File

@ -1,3 +1,7 @@
- doing VipsMax
- see: vips_abs_build(), should that set an arithmetic member? ugly

View File

@ -10,7 +10,6 @@ libarithmetic_la_SOURCES = \
im_recomb.c \
im_linreg.c \
im_maxpos_avg.c \
im_maxpos.c \
im_maxpos_vec.c \
im_measure.c \
im_multiply.c \
@ -22,6 +21,7 @@ libarithmetic_la_SOURCES = \
statistic.h \
avg.c \
min.c \
max.c \
subtract.c \
math.c \
arithmetic.c \

View File

@ -192,12 +192,11 @@ vips_abs_build( VipsObject *object )
static void
vips_abs_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
{
VipsImage *im = arithmetic->ready[0];
int sz = width * im->Bands;
VipsUnary *unary = VIPS_UNARY( arithmetic );
const int bands = vips_image_get_bands( unary->in );
int sz = width * bands;
/* Abs all input types.
*/
switch( im->BandFmt ) {
switch( vips_image_get_format( unary->in ) ) {
case VIPS_FORMAT_CHAR: ABS_INT( signed char ); break;
case VIPS_FORMAT_SHORT: ABS_INT( signed short ); break;
case VIPS_FORMAT_INT: ABS_INT( signed int ); break;

View File

@ -506,6 +506,7 @@ vips_arithmetic_operation_init( void )
extern GType vips_subtract_get_type( void );
extern GType vips_avg_get_type( void );
extern GType vips_min_get_type( void );
extern GType vips_max_get_type( void );
extern GType vips_linear_get_type( void );
extern GType vips_math_get_type( void );
extern GType vips_abs_get_type( void );
@ -515,6 +516,7 @@ vips_arithmetic_operation_init( void )
vips_subtract_get_type();
vips_avg_get_type();
vips_min_get_type();
vips_max_get_type();
vips_linear_get_type();
vips_math_get_type();
vips_abs_get_type();

View File

@ -101,7 +101,6 @@ static int
vips_avg_build( VipsObject *object )
{
VipsStatistic *statistic = VIPS_STATISTIC( object );
VipsImage *in = statistic->input;
VipsAvg *avg = (VipsAvg *) object;
gint64 vals, pels;
@ -113,11 +112,11 @@ vips_avg_build( VipsObject *object )
/* Calculate average. For complex, we accumulate re*re +
* im*im, so we need to sqrt.
*/
pels = (gint64) vips_image_get_width( in ) *
vips_image_get_height( in );
vals = pels * vips_image_get_bands( in );
pels = (gint64) vips_image_get_width( statistic->in ) *
vips_image_get_height( statistic->in );
vals = pels * vips_image_get_bands( statistic->in );
average = avg->sum / vals;
if( vips_bandfmt_iscomplex( vips_image_get_format( in ) ) )
if( vips_bandfmt_iscomplex( vips_image_get_format( statistic->in ) ) )
average = sqrt( average );
g_object_set( object, "out", average, NULL );
@ -181,8 +180,7 @@ static int
vips_avg_scan( VipsStatistic *statistic, void *seq,
int x, int y, void *in, int n )
{
const VipsImage *input = statistic->input;
const int sz = n * vips_image_get_bands( input );
const int sz = n * vips_image_get_bands( statistic->in );
double *sum = (double *) seq;
@ -193,7 +191,7 @@ vips_avg_scan( VipsStatistic *statistic, void *seq,
/* Now generate code for all types.
*/
switch( vips_image_get_format( input ) ) {
switch( vips_image_get_format( statistic->in ) ) {
case VIPS_FORMAT_UCHAR: LOOP( unsigned char ); break;
case VIPS_FORMAT_CHAR: LOOP( signed char ); break;
case VIPS_FORMAT_USHORT: LOOP( unsigned short ); break;

View File

@ -1,275 +0,0 @@
/* im_maxpos.c
*
* Copyright: 1990, J. Cupitt
*
* Author: J. Cupitt
* Written on: 02/05/1990
* Modified on : 18/03/1991, N. Dessipris
* 23/11/92: J.Cupitt - correct result for more than 1 band now.
* 23/7/93 JC
* - im_incheck() call added
* 20/6/95 JC
* - now returns double for value, like im_max()
* 4/9/09
* - gtkdoc comment
* 8/9/09
* - rewrite based on im_max() to get partial
* - move im_max() in here as a convenience function
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
/*
#define DEBUG
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vips/vips.h>
#include <vips/internal.h>
/* Get the value of pixel (0, 0). Use this to init the min/max value for
* im_max()/im_stats()/etc.
*/
int
im__value( IMAGE *im, double *value )
{
IMAGE *t;
if( !(t = im_open_local( im, "im__value", "p" )) ||
im_extract_areabands( im, t, 0, 0, 1, 1, 0, 1 ) ||
im_avg( t, value ) )
return( -1 );
return( 0 );
}
/* A position and maximum.
*/
typedef struct _Maxpos {
int xpos;
int ypos;
double max;
} Maxpos;
/* New sequence value.
*/
static void *
maxpos_start( IMAGE *in, void *a, void *b )
{
Maxpos *global_maxpos = (Maxpos *) b;
Maxpos *maxpos;
if( !(maxpos = IM_NEW( NULL, Maxpos )) )
return( NULL );
*maxpos = *global_maxpos;
return( (void *) maxpos );
}
/* Merge the sequence value back into the per-call state.
*/
static int
maxpos_stop( void *seq, void *a, void *b )
{
Maxpos *global_maxpos = (Maxpos *) b;
Maxpos *maxpos = (Maxpos *) seq;
/* Merge.
*/
if( maxpos->max > global_maxpos->max )
*global_maxpos = *maxpos;
im_free( seq );
return( 0 );
}
#define LOOP( TYPE ) { \
TYPE *p = (TYPE *) in; \
TYPE m; \
\
m = max; \
\
for( x = 0; x < sz; x++ ) { \
TYPE v = p[x]; \
\
if( v > m ) { \
m = v; \
xpos = r->left + x / reg->im->Bands; \
ypos = r->top + y; \
} \
} \
\
max = m; \
}
#define CLOOP( TYPE ) { \
TYPE *p = (TYPE *) in; \
\
for( x = 0; x < sz; x++ ) { \
double mod, re, im; \
\
re = p[0]; \
im = p[1]; \
p += 2; \
mod = re * re + im * im; \
\
if( mod > max ) { \
max = mod; \
xpos = r->left + x / reg->im->Bands; \
ypos = r->top + y; \
} \
} \
}
/* Loop over region, adding to seq.
*/
static int
maxpos_scan( REGION *reg, void *seq, void *a, void *b, gboolean *stop )
{
const Rect *r = &reg->valid;
const int sz = IM_REGION_N_ELEMENTS( reg );
Maxpos *maxpos = (Maxpos *) seq;
int x, y;
double max;
int xpos, ypos;
xpos = maxpos->xpos;
ypos = maxpos->ypos;
max = maxpos->max;
for( y = 0; y < r->height; y++ ) {
PEL *in = (PEL *) IM_REGION_ADDR( reg, r->left, r->top + y );
switch( reg->im->BandFmt ) {
case IM_BANDFMT_UCHAR: LOOP( unsigned char ); break;
case IM_BANDFMT_CHAR: LOOP( signed char ); break;
case IM_BANDFMT_USHORT: LOOP( unsigned short ); break;
case IM_BANDFMT_SHORT: LOOP( signed short ); break;
case IM_BANDFMT_UINT: LOOP( unsigned int ); break;
case IM_BANDFMT_INT: LOOP( signed int ); break;
case IM_BANDFMT_FLOAT: LOOP( float ); break;
case IM_BANDFMT_DOUBLE: LOOP( double ); break;
case IM_BANDFMT_COMPLEX: CLOOP( float ); break;
case IM_BANDFMT_DPCOMPLEX: CLOOP( double ); break;
default:
g_assert( 0 );
}
}
maxpos->xpos = xpos;
maxpos->ypos = ypos;
maxpos->max = max;
return( 0 );
}
/**
* im_maxpos:
* @in: image to search
* @xpos: returned x position of maximum
* @ypos: returned y position of maximum
* @out: returned pixel value at that position
*
* Function to find the maximum of an image. Works for any
* image type. Returns a double and the location of max. For complex images,
* finds the pixel with the highest modulus.
*
* See also: im_minpos(), im_min(), im_stats(), im_maxpos_avg(),
* im_maxpos_subpel(), im_maxpos_vec().
*
* Returns: 0 on success, -1 on error
*/
int
im_maxpos( IMAGE *in, int *xpos, int *ypos, double *out )
{
Maxpos *global_maxpos;
if( im_pincheck( in ) ||
im_check_uncoded( "im_maxpos", in ) )
return( -1 );
if( !(global_maxpos = IM_NEW( in, Maxpos )) )
return( -1 );
if( im__value( in, &global_maxpos->max ) )
return( -1 );
global_maxpos->xpos = 0;
global_maxpos->ypos = 0;
/* We use square mod for scanning, for speed.
*/
if( vips_bandfmt_iscomplex( in->BandFmt ) )
global_maxpos->max *= global_maxpos->max;
if( vips_sink( in, maxpos_start, maxpos_scan, maxpos_stop,
in, global_maxpos ) )
return( -1 );
/* Back to modulus.
*/
if( vips_bandfmt_iscomplex( in->BandFmt ) )
global_maxpos->max = sqrt( global_maxpos->max );
if( xpos )
*xpos = global_maxpos->xpos;
if( ypos )
*ypos = global_maxpos->ypos;
if( out )
*out = global_maxpos->max;
return( 0 );
}
/**
* im_max:
* @in: input #IMAGE
* @out: output double
*
* Finds the the maximum value of image #in and returns it at the
* location pointed by out. If input is complex, the max modulus
* is returned. im_max() finds the maximum of all bands: if you
* want to find the maximum of each band separately, use im_stats().
*
* See also: im_maxpos(), im_min(), im_stats().
*
* Returns: 0 on success, -1 on error
*/
int
im_max( IMAGE *in, double *out )
{
return( im_maxpos( in, NULL, NULL, out ) );
}

333
libvips/arithmetic/max.c Normal file
View File

@ -0,0 +1,333 @@
/* find image maximum
*
* Copyright: 1990, J. Cupitt
*
* Author: J. Cupitt
* Written on: 02/05/1990
* Modified on : 18/03/1991, N. Dessipris
* 23/11/92: J.Cupitt - correct result for more than 1 band now.
* 23/7/93 JC
* - im_incheck() call added
* 20/6/95 JC
* - now returns double for value, like im_max()
* 4/9/09
* - gtkdoc comment
* 8/9/09
* - rewrite based on im_max() to get partial
* - move im_max() in here as a convenience function
* 6/11/11
* - rewrite as a class
* - abandon scan if we find maximum possible value
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
/*
#define DEBUG
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <vips/intl.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <vips/vips.h>
#include <vips/internal.h>
#include "statistic.h"
/**
* VipsMax:
* @in: input #VipsImage
* @out: output pixel maximum
*
* This operation finds the maximum value in an image.
*
* If the image contains several maximum values, only the first one found is
* returned.
*
* It operates on all
* bands of the input image: use im_stats() if you need to find an
* maximum for each band. For complex images, find the maximum modulus.
*
* See also: #VipsAvg, #VipsMin, im_stats(), im_bandmean(), im_deviate(), im_rank()
*/
typedef struct _VipsMax {
VipsStatistic parent_instance;
gboolean set; /* FALSE means no value yet */
/* The current maximum. When scanning complex images, we keep the
* square of the modulus here and do a single sqrt() right at the end.
*/
double max;
/* And its position.
*/
int x, y;
} VipsMax;
typedef VipsStatisticClass VipsMaxClass;
G_DEFINE_TYPE( VipsMax, vips_max, VIPS_TYPE_STATISTIC );
static int
vips_max_build( VipsObject *object )
{
VipsStatistic *statistic = VIPS_STATISTIC( object );
VipsMax *max = (VipsMax *) object;
double m;
if( VIPS_OBJECT_CLASS( vips_max_parent_class )->build( object ) )
return( -1 );
/* For speed we accumulate max^2 for complex.
*/
m = max->max;
if( vips_bandfmt_iscomplex( vips_image_get_format( statistic->in ) ) )
m = sqrt( m );
/* We have to set the props via g_object_set() to stop vips
* complaining they are unset.
*/
g_object_set( max,
"out", m,
"x", max->x,
"y", max->y,
NULL );
return( 0 );
}
/* New sequence value. Make a private VipsMax for this thread.
*/
static void *
vips_max_start( VipsStatistic *statistic )
{
VipsMax *global = (VipsMax *) statistic;
VipsMax *max;
max = g_new( VipsMax, 1 );
*max = *global;
return( (void *) max );
}
/* Merge the sequence value back into the per-call state.
*/
static int
vips_max_stop( VipsStatistic *statistic, void *seq )
{
VipsMax *global = (VipsMax *) statistic;
VipsMax *max = (VipsMax *) seq;
if( !global->set ||
max->max < global->max ) {
global->max = max->max;
global->x = max->x;
global->y = max->y;
global->set = TRUE;
}
g_free( max );
return( 0 );
}
/* real max with no limits.
*/
#define LOOP( TYPE ) { \
TYPE *p = (TYPE *) in; \
TYPE m; \
\
if( max->set ) \
m = max->max; \
else \
m = p[0]; \
\
for( i = 0; i < sz; i++ ) { \
if( p[i] > m ) { \
m = p[i]; \
max->x = x + i / bands; \
max->y = y; \
} \
} \
\
max->max = m; \
max->set = TRUE; \
}
/* real max with an upper bound.
*/
#define LOOPL( TYPE, UPPER ) { \
TYPE *p = (TYPE *) in; \
TYPE m; \
\
if( max->set ) \
m = max->max; \
else \
m = p[0]; \
\
for( i = 0; i < sz; i++ ) { \
if( p[i] > m ) { \
m = p[i]; \
max->x = x + i / bands; \
max->y = y; \
if( m >= UPPER ) { \
statistic->stop = TRUE; \
break; \
} \
} \
} \
\
max->max = m; \
max->set = TRUE; \
}
#define CLOOP( TYPE ) { \
TYPE *p = (TYPE *) in; \
double m; \
\
if( max->set ) \
m = max->max; \
else \
m = p[0] * p[0] + p[1] * p[1]; \
\
for( i = 0; i < sz; i++ ) { \
double mod; \
\
mod = p[0] * p[0] + p[1] * p[1]; \
p += 2; \
\
if( mod > m ) { \
m = mod; \
max->x = x + i / bands; \
max->y = y; \
} \
} \
\
max->max = m; \
max->set = TRUE; \
}
/* Loop over region, adding to seq.
*/
static int
vips_max_scan( VipsStatistic *statistic, void *seq,
int x, int y, void *in, int n )
{
VipsMax *max = (VipsMax *) seq;
const int bands = vips_image_get_bands( statistic->in );
const int sz = n * bands;
int i;
switch( vips_image_get_format( statistic->in ) ) {
case IM_BANDFMT_UCHAR: LOOPL( unsigned char, 0 ); break;
case IM_BANDFMT_CHAR: LOOPL( signed char, SCHAR_MAX ); break;
case IM_BANDFMT_USHORT: LOOPL( unsigned short, 0 ); break;
case IM_BANDFMT_SHORT: LOOPL( signed short, SHRT_MAX ); break;
case IM_BANDFMT_UINT: LOOPL( unsigned int, 0 ); break;
case IM_BANDFMT_INT: LOOPL( signed int, INT_MAX ); break;
case IM_BANDFMT_FLOAT: LOOP( float ); break;
case IM_BANDFMT_DOUBLE: LOOP( double ); break;
case IM_BANDFMT_COMPLEX: CLOOP( float ); break;
case IM_BANDFMT_DPCOMPLEX: CLOOP( double ); break;
default:
g_assert( 0 );
}
return( 0 );
}
static void
vips_max_class_init( VipsMaxClass *class )
{
GObjectClass *gobject_class = (GObjectClass *) class;
VipsObjectClass *object_class = (VipsObjectClass *) class;
VipsStatisticClass *sclass = VIPS_STATISTIC_CLASS( class );
gobject_class->set_property = vips_object_set_property;
gobject_class->get_property = vips_object_get_property;
object_class->nickname = "max";
object_class->description = _( "find image maximum" );
object_class->build = vips_max_build;
sclass->start = vips_max_start;
sclass->scan = vips_max_scan;
sclass->stop = vips_max_stop;
VIPS_ARG_DOUBLE( class, "out", 1,
_( "Output" ),
_( "Output value" ),
VIPS_ARGUMENT_REQUIRED_OUTPUT,
G_STRUCT_OFFSET( VipsMax, max ),
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0 );
VIPS_ARG_INT( class, "x", 2,
_( "x" ),
_( "Horizontal position of maximum" ),
VIPS_ARGUMENT_OPTIONAL_OUTPUT,
G_STRUCT_OFFSET( VipsMax, x ),
0, 1000000, 0 );
VIPS_ARG_INT( class, "y", 2,
_( "y" ),
_( "Vertical position of maximum" ),
VIPS_ARGUMENT_OPTIONAL_OUTPUT,
G_STRUCT_OFFSET( VipsMax, y ),
0, 1000000, 0 );
}
static void
vips_max_init( VipsMax *max )
{
}
int
vips_max( VipsImage *in, double *out, ... )
{
va_list ap;
int result;
va_start( ap, out );
result = vips_call_split( "max", ap, in, out );
va_end( ap );
return( result );
}

View File

@ -106,7 +106,6 @@ static int
vips_min_build( VipsObject *object )
{
VipsStatistic *statistic = VIPS_STATISTIC( object );
VipsImage *input = statistic->input;
VipsMin *min = (VipsMin *) object;
double m;
@ -117,7 +116,7 @@ vips_min_build( VipsObject *object )
/* For speed we accumulate min^2 for complex.
*/
m = min->min;
if( vips_bandfmt_iscomplex( vips_image_get_format( input ) ) )
if( vips_bandfmt_iscomplex( vips_image_get_format( statistic->in ) ) )
m = sqrt( m );
/* We have to set the props via g_object_set() to stop vips
@ -206,8 +205,10 @@ vips_min_stop( VipsStatistic *statistic, void *seq )
m = p[i]; \
min->x = x + i / bands; \
min->y = y; \
if( m <= LOWER ) \
if( m <= LOWER ) { \
statistic->stop = TRUE; \
break; \
} \
} \
} \
\
@ -248,13 +249,12 @@ vips_min_scan( VipsStatistic *statistic, void *seq,
int x, int y, void *in, int n )
{
VipsMin *min = (VipsMin *) seq;
const VipsImage *input = statistic->input;
const int bands = vips_image_get_bands( input );
const int bands = vips_image_get_bands( statistic->in );
const int sz = n * bands;
int i;
switch( vips_image_get_format( input ) ) {
switch( vips_image_get_format( statistic->in ) ) {
case IM_BANDFMT_UCHAR: LOOPL( unsigned char, 0 ); break;
case IM_BANDFMT_CHAR: LOOPL( signed char, SCHAR_MIN ); break;
case IM_BANDFMT_USHORT: LOOPL( unsigned short, 0 ); break;

View File

@ -115,10 +115,11 @@ G_DEFINE_TYPE( VipsSign, vips_sign, VIPS_TYPE_UNARY );
static void
vips_sign_buffer( VipsArithmetic *arithmetic, PEL *out, PEL **in, int width )
{
VipsImage *im = arithmetic->ready[0];
int sz = width * im->Bands;
VipsUnary *unary = VIPS_UNARY( arithmetic );
const int bands = vips_image_get_bands( unary->in );
int sz = width * bands;
switch( im->BandFmt ) {
switch( vips_image_get_format( unary->in ) ) {
case VIPS_FORMAT_UCHAR: SIGN( unsigned char ); break;
case VIPS_FORMAT_CHAR: SIGN( signed char ); break;
case VIPS_FORMAT_USHORT: SIGN( unsigned short ); break;

View File

@ -120,11 +120,11 @@ vips_statistic_build( VipsObject *object )
if( VIPS_OBJECT_CLASS( vips_statistic_parent_class )->build( object ) )
return( -1 );
if( vips_image_pio_input( statistic->input ) ||
vips_check_uncoded( domain, statistic->input ) )
if( vips_image_pio_input( statistic->in ) ||
vips_check_uncoded( domain, statistic->in ) )
return( -1 );
if( vips_sink( statistic->input,
if( vips_sink( statistic->in,
vips_statistic_scan_start,
vips_statistic_scan,
vips_statistic_scan_stop,
@ -151,7 +151,7 @@ vips_statistic_class_init( VipsStatisticClass *class )
_( "Input" ),
_( "Input image" ),
VIPS_ARGUMENT_REQUIRED_INPUT,
G_STRUCT_OFFSET( VipsStatistic, input ) );
G_STRUCT_OFFSET( VipsStatistic, in ) );
}
static void

View File

@ -64,7 +64,7 @@ struct _VipsStatistic {
/* All have an input image.
*/
VipsImage *input;
VipsImage *in;
/* Set this to stop computation early.
*/

View File

@ -954,6 +954,18 @@ im_min( IMAGE *in, double *out )
return( im_minpos( in, NULL, NULL, out ) );
}
int
im_maxpos( IMAGE *in, int *xpos, int *ypos, double *out )
{
return( vips_max( in, out, "x", xpos, "y", ypos, NULL ) );
}
int
im_max( IMAGE *in, double *out )
{
return( im_maxpos( in, NULL, NULL, out ) );
}
#define MAX_IMAGES 100
int
im_demand_hint (IMAGE * im, VipsDemandStyle hint, ...)

View File

@ -74,6 +74,8 @@ int vips_avg( VipsImage *in, double *out, ... )
__attribute__((sentinel));
int vips_min( VipsImage *in, double *out, ... )
__attribute__((sentinel));
int vips_max( VipsImage *in, double *out, ... )
__attribute__((sentinel));
int vips_invert( VipsImage *in, VipsImage **out, ... )
__attribute__((sentinel));
int vips_linear( VipsImage *in, VipsImage **out,
@ -97,9 +99,7 @@ DOUBLEMASK *im_measure_area( VipsImage *im,
int h, int v,
int *sel, int nsel, const char *name );
DOUBLEMASK *im_stats( VipsImage *in );
int im_max( VipsImage *in, double *out );
int im_deviate( VipsImage *in, double *out );
int im_maxpos( VipsImage *in, int *xpos, int *ypos, double *out );
int im_maxpos_avg( VipsImage *im, double *xpos, double *ypos, double *out );
int im_maxpos_vec( VipsImage *im, int *xpos, int *ypos, double *maxima, int n );
int im_minpos_vec( VipsImage *im, int *xpos, int *ypos, double *minima, int n );

View File

@ -524,6 +524,8 @@ int im_add( VipsImage *in1, VipsImage *in2, VipsImage *out );
int im_subtract( VipsImage *in1, VipsImage *in2, VipsImage *out );
int im_min( VipsImage *in, double *out );
int im_minpos( VipsImage *in, int *xpos, int *ypos, double *out );
int im_max( VipsImage *in, double *out );
int im_maxpos( VipsImage *in, int *xpos, int *ypos, double *out );
int im_avg( VipsImage *in, double *out );
int im_invert( VipsImage *in, VipsImage *out );
int im_lintra( double a, VipsImage *in, double b, VipsImage *out );