deprecate im_maxpos_avg()

and add wrappers for im_maxpos_vec() / im_minpos_vec()
This commit is contained in:
John Cupitt 2012-12-05 21:44:41 +00:00
parent a4433f1b9f
commit 5b271d16ed
7 changed files with 62 additions and 12 deletions

4
TODO
View File

@ -1,6 +1,6 @@
- im_maxpos_vec()/im_minpos_vec() wrappers need doing
- add vips_band()/vips_bor()
- im_maxpos_avg() should be NaN-avoiding?
- now we've removed round-to-nearest from NN, we need something extra in the
affine transform to displace the input cods

View File

@ -7,7 +7,6 @@ libarithmetic_la_SOURCES = \
deviate.c \
divide.c \
im_linreg.c \
im_maxpos_avg.c \
measure.c \
multiply.c \
im_point_bilinear.c \

View File

@ -6,6 +6,7 @@ libdeprecated_la_SOURCES = \
deprecated_dispatch.c \
colour_dispatch.c \
arith_dispatch.c \
im_maxpos_avg.c \
wrapvips7.c \
lazy.c \
im_dif_std.c \

View File

@ -2810,13 +2810,66 @@ im_quadratic( IMAGE *in, IMAGE *out, IMAGE *coeff )
int
im_maxpos_vec( VipsImage *im, int *xpos, int *ypos, double *maxima, int n )
{
printf( "im_maxpos_vec: fixme\n" );
return( -1 );
double max;
VipsArrayDouble *out_array;
VipsArrayInt *x_array;
VipsArrayInt *y_array;
if( vips_max( im, &max,
"size", n,
"out_array", &out_array,
"x_array", &x_array,
"y_array", &y_array,
NULL ) )
return( -1 );
memcpy( xpos,
vips_area_get_data( x_array, NULL, NULL, NULL, NULL ),
n * sizeof( int ) );
memcpy( ypos,
vips_area_get_data( y_array, NULL, NULL, NULL, NULL ),
n * sizeof( int ) );
memcpy( maxima,
vips_area_get_data( out_array, NULL, NULL, NULL, NULL ),
n * sizeof( double ) );
vips_area_unref( (VipsArea *) out_array );
vips_area_unref( (VipsArea *) x_array );
vips_area_unref( (VipsArea *) y_array );
return( 0 );
}
int
im_minpos_vec( VipsImage *im, int *xpos, int *ypos, double *minima, int n )
{
printf( "im_minpos_vec: fixme\n" );
return( -1 );
double min;
VipsArrayDouble *out_array;
VipsArrayInt *x_array;
VipsArrayInt *y_array;
if( vips_min( im, &min,
"size", n,
"out_array", &out_array,
"x_array", &x_array,
"y_array", &y_array,
NULL ) )
return( -1 );
memcpy( xpos,
vips_area_get_data( x_array, NULL, NULL, NULL, NULL ),
n * sizeof( int ) );
memcpy( ypos,
vips_area_get_data( y_array, NULL, NULL, NULL, NULL ),
n * sizeof( int ) );
memcpy( minima,
vips_area_get_data( out_array, NULL, NULL, NULL, NULL ),
n * sizeof( double ) );
vips_area_unref( (VipsArea *) out_array );
vips_area_unref( (VipsArea *) x_array );
vips_area_unref( (VipsArea *) y_array );
return( 0 );
}

View File

@ -360,11 +360,6 @@ int vips_stats( VipsImage *in, VipsImage **out, ... )
int vips_measure( VipsImage *in, VipsImage **out, int h, int v, ... )
__attribute__((sentinel));
int im_maxpos_avg( VipsImage *im, double *xpos, double *ypos, double *out );
int im_linreg( VipsImage **ins, VipsImage *out, double *xs );
int im_point( VipsImage *im, VipsInterpolate *interpolate,
double x, double y, int band, double *out );

View File

@ -667,6 +667,8 @@ int im_moreeqconst( VipsImage *in, VipsImage *out, double c );
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 );
int im_maxpos_avg( VipsImage *im, double *xpos, double *ypos, double *out );
int im_copy( VipsImage *in, VipsImage *out );
int im_copy_set( VipsImage *in, VipsImage *out,
VipsInterpretation interpretation,