From 73fba1c2ea2146ebb112f89079b38987249278b3 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 13 Nov 2009 12:01:36 +0000 Subject: [PATCH] rename convf to conv_f to help overloading --- ChangeLog | 3 + libvips/convolution/Makefile.am | 4 +- libvips/convolution/convol_dispatch.c | 32 +- .../convolution/{im_convf.c => im_conv_f.c} | 15 +- .../{im_convsepf.c => im_convsep_f.c} | 18 +- libvips/deprecated/deprecated_dispatch.c | 44 + libvips/deprecated/rename.c | 24 + libvips/include/vips/convolution.h | 4 +- libvips/include/vips/deprecated.h | 2 + libvipsCC/Makefile.am | 10 +- libvipsCC/include/vips/Makefile.am | 10 +- libvipsCC/include/vips/vipsc++.h | 158 ++- libvipsCC/vipsc++.cc | 1263 ++++++----------- tools/iofuncs/vips.c | 52 +- 14 files changed, 706 insertions(+), 933 deletions(-) rename libvips/convolution/{im_convf.c => im_conv_f.c} (95%) rename libvips/convolution/{im_convsepf.c => im_convsep_f.c} (94%) diff --git a/ChangeLog b/ChangeLog index 7c5885ab..744f41ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ - im_conv() / im_convf() didn't like all-zero masks - small updates to im_convf() from im_conv() - im_read_imask() produced an incorrect error message if passed a doublemask +- rename im_convf(), im_convsepf() as _f() +- vips.c drops _f suffix when overloading +- regenerate C++ binding, don't make deprecated package 9/11/09 started 7.20.0 - removed vips-7.x.spec.in, shouldn't really have this in SVN diff --git a/libvips/convolution/Makefile.am b/libvips/convolution/Makefile.am index c458173a..c5c2b42c 100644 --- a/libvips/convolution/Makefile.am +++ b/libvips/convolution/Makefile.am @@ -5,9 +5,9 @@ libconvolution_la_SOURCES = \ im_addgnoise.c \ im_compass.c \ im_conv.c \ - im_convf.c \ + im_conv_f.c \ im_convsep.c \ - im_convsepf.c \ + im_convsep_f.c \ im_contrast_surface.c \ im_fastcor.c \ im_gradcor.c \ diff --git a/libvips/convolution/convol_dispatch.c b/libvips/convolution/convol_dispatch.c index a2f9fb23..2ebc7c77 100644 --- a/libvips/convolution/convol_dispatch.c +++ b/libvips/convolution/convol_dispatch.c @@ -197,23 +197,23 @@ static im_function conv_desc = { conv_imask /* Arg list */ }; -/* Call im_convf via arg vector. +/* Call im_conv_f via arg vector. */ static int -convf_vec( im_object *argv ) +conv_f_vec( im_object *argv ) { im_mask_object *mo = argv[2]; - return( im_convf( argv[0], argv[1], mo->mask ) ); + return( im_conv_f( argv[0], argv[1], mo->mask ) ); } -/* Description of im_convf. +/* Description of im_conv_f. */ -static im_function convf_desc = { - "im_convf", /* Name */ +static im_function conv_f_desc = { + "im_conv_f", /* Name */ "convolve, with DOUBLEMASK", IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */ - convf_vec, /* Dispatch function */ + conv_f_vec, /* Dispatch function */ IM_NUMBER( conv_dmask ), /* Size of arg list */ conv_dmask /* Arg list */ }; @@ -239,23 +239,23 @@ static im_function convsep_desc = { conv_imask /* Arg list */ }; -/* Call im_convsepf via arg vector. +/* Call im_convsep_f via arg vector. */ static int -convsepf_vec( im_object *argv ) +convsep_f_vec( im_object *argv ) { im_mask_object *mo = argv[2]; - return( im_convsepf( argv[0], argv[1], mo->mask ) ); + return( im_convsep_f( argv[0], argv[1], mo->mask ) ); } -/* Description of im_convsepf. +/* Description of im_convsep_f. */ -static im_function convsepf_desc = { - "im_convsepf", /* Name */ +static im_function convsep_f_desc = { + "im_convsep_f", /* Name */ "seperable convolution, with DOUBLEMASK", IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */ - convsepf_vec, /* Dispatch function */ + convsep_f_vec, /* Dispatch function */ IM_NUMBER( conv_dmask ), /* Size of arg list */ conv_dmask /* Arg list */ }; @@ -403,9 +403,9 @@ static im_function *convol_list[] = { &compass_desc, &contrast_surface_desc, &conv_desc, - &convf_desc, + &conv_f_desc, &convsep_desc, - &convsepf_desc, + &convsep_f_desc, &fastcor_desc, &gradcor_desc, &gradient_desc, diff --git a/libvips/convolution/im_convf.c b/libvips/convolution/im_conv_f.c similarity index 95% rename from libvips/convolution/im_convf.c rename to libvips/convolution/im_conv_f.c index bb413fe7..7ad76151 100644 --- a/libvips/convolution/im_convf.c +++ b/libvips/convolution/im_conv_f.c @@ -3,7 +3,7 @@ * @(#) except IM_BANDFMT_DOUBLE, which gives IM_BANDFMT_DOUBLE. * @(#) * @(#) int - * @(#) im_convf( in, out, mask ) + * @(#) im_conv_f( in, out, mask ) * @(#) IMAGE *in, *out; * @(#) DOUBLEMASK *mask; * @(#) @@ -40,6 +40,9 @@ * - tiny speedups and cleanups * - add restrict, though it doesn't seem to help gcc * - add mask-all-zero check + * 13/11/09 + * - rename as im_conv_f() to make it easier to vips.c to make the + * overloaded version */ /* @@ -309,7 +312,7 @@ conv_gen( REGION *or, void *vseq, void *a, void *b ) } int -im_convf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) +im_conv_f_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) { Conv *conv; @@ -338,7 +341,7 @@ im_convf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) out->Xsize -= mask->xsize - 1; out->Ysize -= mask->ysize - 1; if( out->Xsize <= 0 || out->Ysize <= 0 ) { - im_error( "im_convf", "%s", _( "image too small for mask" ) ); + im_error( "im_conv_f", "%s", _( "image too small for mask" ) ); return( -1 ); } @@ -360,15 +363,15 @@ im_convf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) /* The above, with a border to make out the same size as in. */ int -im_convf( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) +im_conv_f( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) { - IMAGE *t1 = im_open_local( out, "im_convf intermediate", "p" ); + IMAGE *t1 = im_open_local( out, "im_conv_f intermediate", "p" ); if( !t1 || im_embed( in, t1, 1, mask->xsize / 2, mask->ysize / 2, in->Xsize + mask->xsize - 1, in->Ysize + mask->ysize - 1 ) || - im_convf_raw( t1, out, mask ) ) + im_conv_f_raw( t1, out, mask ) ) return( -1 ); out->Xoffset = 0; diff --git a/libvips/convolution/im_convsepf.c b/libvips/convolution/im_convsep_f.c similarity index 94% rename from libvips/convolution/im_convsepf.c rename to libvips/convolution/im_convsep_f.c index ea4c0f01..4d6c0b4a 100644 --- a/libvips/convolution/im_convsepf.c +++ b/libvips/convolution/im_convsep_f.c @@ -3,7 +3,7 @@ * @(#) except IM_BANDFMT_DOUBLE, which gives IM_BANDFMT_DOUBLE. * @(#) Separable mask of sizes 1xN or Nx1 * @(#) - * @(#) int im_convsepf( in, out, mask ) + * @(#) int im_convsep_f( in, out, mask ) * @(#) IMAGE *in, *out; * @(#) DOUBLEMASK *mask; details in mask.h * @(#) @@ -279,25 +279,25 @@ conv_gen( REGION *or, void *vseq, void *a, void *b ) } int -im_convsepf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) +im_convsep_f_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) { Conv *conv; /* Check parameters. */ if( !in || in->Coding != IM_CODING_NONE || im_iscomplex( in ) ) { - im_error( "im_convsepf", + im_error( "im_convsep_f", "%s", _( "non-complex uncoded only" ) ); return( -1 ); } if( !mask || mask->xsize > 1000 || mask->ysize > 1000 || mask->xsize <= 0 || mask->ysize <= 0 || !mask->coeff || mask->scale == 0 ) { - im_error( "im_convsepf", "%s", _( "bad mask parameters" ) ); + im_error( "im_convsep_f", "%s", _( "bad mask parameters" ) ); return( -1 ); } if( mask->xsize != 1 && mask->ysize != 1 ) { - im_error( "im_convsepf", + im_error( "im_convsep_f", "%s", _( "expect 1xN or Nx1 input mask" ) ); return( -1 ); } @@ -316,7 +316,7 @@ im_convsepf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) out->Xsize -= conv->size - 1; out->Ysize -= conv->size - 1; if( out->Xsize <= 0 || out->Ysize <= 0 ) { - im_error( "im_convsepf", + im_error( "im_convsep_f", "%s", _( "image too small for mask" ) ); return( -1 ); } @@ -336,16 +336,16 @@ im_convsepf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) /* The above, with a border to make out the same size as in. */ int -im_convsepf( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) +im_convsep_f( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) { - IMAGE *t1 = im_open_local( out, "im_convsepf intermediate", "p" ); + IMAGE *t1 = im_open_local( out, "im_convsep_f intermediate", "p" ); int size = mask->xsize * mask->ysize; if( !t1 || im_embed( in, t1, 1, size / 2, size / 2, in->Xsize + size - 1, in->Ysize + size - 1 ) || - im_convsepf_raw( t1, out, mask ) ) + im_convsep_f_raw( t1, out, mask ) ) return( -1 ); out->Xoffset = 0; diff --git a/libvips/deprecated/deprecated_dispatch.c b/libvips/deprecated/deprecated_dispatch.c index db5059bc..21c77a5c 100644 --- a/libvips/deprecated/deprecated_dispatch.c +++ b/libvips/deprecated/deprecated_dispatch.c @@ -1168,6 +1168,48 @@ static im_function dilate_raw_desc = { erode_args /* Arg list */ }; +/* Call im_convsepf via arg vector. + */ +static int +convsepf_vec( im_object *argv ) +{ + im_mask_object *mo = argv[2]; + + return( im_convsepf( argv[0], argv[1], mo->mask ) ); +} + +/* Description of im_convsepf. + */ +static im_function convsepf_desc = { + "im_convsepf", /* Name */ + "seperable convolution, with DOUBLEMASK", + IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */ + convsepf_vec, /* Dispatch function */ + IM_NUMBER( conv_dmask ), /* Size of arg list */ + conv_dmask /* Arg list */ +}; + +/* Call im_convf via arg vector. + */ +static int +convf_vec( im_object *argv ) +{ + im_mask_object *mo = argv[2]; + + return( im_convf( argv[0], argv[1], mo->mask ) ); +} + +/* Description of im_convf. + */ +static im_function convf_desc = { + "im_convf", /* Name */ + "convolve, with DOUBLEMASK", + IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */ + convf_vec, /* Dispatch function */ + IM_NUMBER( conv_dmask ), /* Size of arg list */ + conv_dmask /* Arg list */ +}; + /* Package up all these functions. */ static im_function *deprecated_list[] = { @@ -1186,6 +1228,8 @@ static im_function *deprecated_list[] = { &clip2f_desc, &clip2i_desc, &convsub_desc, + &convf_desc, + &convsepf_desc, &clip2s_desc, &clip2ui_desc, &insertplaceset_desc, diff --git a/libvips/deprecated/rename.c b/libvips/deprecated/rename.c index a2d8530d..153374af 100644 --- a/libvips/deprecated/rename.c +++ b/libvips/deprecated/rename.c @@ -232,3 +232,27 @@ im_segment( IMAGE *test, IMAGE *mask, int *segments ) { return( im_label_regions( test, mask, segments ) ); } + +int +im_convf( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) +{ + return( im_conv_f( in, out, mask ) ); +} + +int +im_convf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) +{ + return( im_conv_f_raw( in, out, mask ) ); +} + +int +im_convsepf( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) +{ + return( im_convsep_f( in, out, mask ) ); +} + +int +im_convsepf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ) +{ + return( im_convsep_f_raw( in, out, mask ) ); +} diff --git a/libvips/include/vips/convolution.h b/libvips/include/vips/convolution.h index bd5367aa..49e7fc6d 100644 --- a/libvips/include/vips/convolution.h +++ b/libvips/include/vips/convolution.h @@ -38,9 +38,9 @@ extern "C" { #endif /*__cplusplus*/ int im_conv( IMAGE *in, IMAGE *out, INTMASK *mask ); -int im_convf( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ); +int im_conv_f( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ); int im_convsep( IMAGE *in, IMAGE *out, INTMASK *mask ); -int im_convsepf( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ); +int im_convsep_f( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ); int im_compass( IMAGE *in, IMAGE *out, INTMASK *mask ); int im_gradient( IMAGE *in, IMAGE *out, INTMASK *mask ); diff --git a/libvips/include/vips/deprecated.h b/libvips/include/vips/deprecated.h index a38ecf6d..df1e5a80 100644 --- a/libvips/include/vips/deprecated.h +++ b/libvips/include/vips/deprecated.h @@ -352,6 +352,8 @@ int im_resize_linear( IMAGE *, IMAGE *, int, int ); int im_line( IMAGE *, int, int, int, int, int ); int im_segment( IMAGE *test, IMAGE *mask, int *segments ); +int im_convf( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ); +int im_convsepf( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ); int im_conv_raw( IMAGE *in, IMAGE *out, INTMASK *mask ); int im_convf_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask ); int im_convsep_raw( IMAGE *in, IMAGE *out, INTMASK *mask ); diff --git a/libvipsCC/Makefile.am b/libvipsCC/Makefile.am index c968c124..8a7bf1ae 100644 --- a/libvipsCC/Makefile.am +++ b/libvipsCC/Makefile.am @@ -21,7 +21,15 @@ libvipsCC_la_LDFLAGS = \ libvipsCC_la_LIBADD = \ $(top_builddir)/libvips/libvips.la @VIPS_LIBS@ +.PHONEY: vipsc++.cc: - vips --cppc all > vipsc++.cc + packages=`vips --list packages | \ + awk '{if($$1!="deprecated") print $$1}'` ; \ + echo > vipsc++.cc ; \ + for name in $$packages; do \ + echo "// bodies for package $$name" >> vipsc++.cc ; \ + vips --cppc $$name >> vipsc++.cc ; \ + echo >> vipsc++.cc ; \ + done EXTRA_DIST = vipsc++.cc diff --git a/libvipsCC/include/vips/Makefile.am b/libvipsCC/include/vips/Makefile.am index 24f06686..2f2e2b52 100644 --- a/libvipsCC/include/vips/Makefile.am +++ b/libvipsCC/include/vips/Makefile.am @@ -7,5 +7,13 @@ pkginclude_HEADERS = \ vips \ vipsc++.h +.PHONEY: vipsc++.h: - vips --cpph all > vipsc++.h + packages=`vips --list packages | \ + awk '{if($$1!="deprecated") print $$1}'` ; \ + echo > vipsc++.h ; \ + for name in $$packages; do \ + echo "// headers for package $$name" >> vipsc++.h ; \ + vips --cpph $$name >> vipsc++.h ; \ + echo >> vipsc++.h ; \ + done diff --git a/libvipsCC/include/vips/vipsc++.h b/libvipsCC/include/vips/vipsc++.h index 369f21de..fd770769 100644 --- a/libvipsCC/include/vips/vipsc++.h +++ b/libvipsCC/include/vips/vipsc++.h @@ -1,5 +1,7 @@ + +// headers for package arithmetic // this file automatically generated from -// VIPS library 7.19.0-Mon Jun 29 15:52:56 BST 2009 +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 VImage abs() throw( VError ); VImage acos() throw( VError ); VImage add( VImage ) throw( VError ); @@ -9,7 +11,6 @@ double avg() throw( VError ); double point_bilinear( double, double, int ) throw( VError ); VImage bandmean() throw( VError ); VImage ceil() throw( VError ); -VImage cmulnorm( VImage ) throw( VError ); VImage cos() throw( VError ); VImage cross_phase( VImage ) throw( VError ); double deviate() throw( VError ); @@ -18,14 +19,11 @@ VImage exp10() throw( VError ); VImage expn( double ) throw( VError ); VImage expn( std::vector ) throw( VError ); VImage exp() throw( VError ); -VImage fav4( VImage, VImage, VImage ) throw( VError ); VImage floor() throw( VError ); -VImage gadd( double, double, VImage, double ) throw( VError ); VImage invert() throw( VError ); VImage lin( double, double ) throw( VError ); static VImage linreg( std::vector, std::vector ) throw( VError ); VImage lin( std::vector, std::vector ) throw( VError ); -VImage litecor( VImage, int, double ) throw( VError ); VImage log10() throw( VError ); VImage log() throw( VError ); double max() throw( VError ); @@ -37,6 +35,7 @@ std::complex minpos() throw( VError ); VImage multiply( VImage ) throw( VError ); VImage pow( double ) throw( VError ); VImage pow( std::vector ) throw( VError ); +VImage recomb( VDMask ) throw( VError ); VImage remainder( VImage ) throw( VError ); VImage remainder( double ) throw( VError ); VImage remainder( std::vector ) throw( VError ); @@ -46,6 +45,10 @@ VImage sin() throw( VError ); VDMask stats() throw( VError ); VImage subtract( VImage ) throw( VError ); VImage tan() throw( VError ); + +// headers for package boolean +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 VImage andimage( VImage ) throw( VError ); VImage andimage( int ) throw( VError ); VImage andimage( std::vector ) throw( VError ); @@ -55,10 +58,20 @@ VImage orimage( std::vector ) throw( VError ); VImage eorimage( VImage ) throw( VError ); VImage eorimage( int ) throw( VError ); VImage eorimage( std::vector ) throw( VError ); +VImage shiftleft( std::vector ) throw( VError ); VImage shiftleft( int ) throw( VError ); +VImage shiftright( std::vector ) throw( VError ); VImage shiftright( int ) throw( VError ); + +// headers for package cimg +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 VImage greyc( int, double, double, double, double, double, double, double, double, int, int ) throw( VError ); VImage greyc_mask( VImage, int, double, double, double, double, double, double, double, double, int, int ) throw( VError ); + +// headers for package colour +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 VImage LCh2Lab() throw( VError ); VImage LCh2UCS() throw( VError ); VImage Lab2LCh() throw( VError ); @@ -94,7 +107,6 @@ VImage disp2Lab( VDisplay ) throw( VError ); VImage disp2XYZ( VDisplay ) throw( VError ); VImage float2rad() throw( VError ); VImage icc_ac2rc( char* ) throw( VError ); -VImage icc_export( char*, int ) throw( VError ); VImage icc_export_depth( int, char*, int ) throw( VError ); VImage icc_import( char*, int ) throw( VError ); VImage icc_import_embedded( int ) throw( VError ); @@ -102,6 +114,12 @@ VImage icc_transform( char*, char*, int ) throw( VError ); VImage lab_morph( VDMask, double, double, double, double ) throw( VError ); VImage rad2float() throw( VError ); VImage sRGB2XYZ() throw( VError ); + +// headers for package conversion +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 +VImage addgnoise( double ) throw( VError ); +static VImage gaussnoise( int, int, double, double ) throw( VError ); VImage bandjoin( VImage ) throw( VError ); static VImage black( int, int, int ) throw( VError ); VImage c2amph() throw( VError ); @@ -109,21 +127,13 @@ VImage c2imag() throw( VError ); VImage c2ps() throw( VError ); VImage c2real() throw( VError ); VImage c2rect() throw( VError ); -VImage clip2c() throw( VError ); -VImage clip2cm() throw( VError ); -VImage clip2d() throw( VError ); -VImage clip2dcm() throw( VError ); -VImage clip2f() throw( VError ); -VImage clip2fmt( int ) throw( VError ); -VImage clip2i() throw( VError ); -VImage clip2s() throw( VError ); -VImage clip2ui() throw( VError ); -VImage clip2us() throw( VError ); VImage clip() throw( VError ); +VImage clip2fmt( int ) throw( VError ); VImage copy() throw( VError ); +VImage copy_file() throw( VError ); VImage copy_morph( int, int, int ) throw( VError ); VImage copy_swap() throw( VError ); -VImage copy_set( int, double, double, int, int ) throw( VError ); +VImage copy_( int, double, double, int, int ) throw( VError ); VImage extract_area( int, int, int, int ) throw( VError ); VImage extract_areabands( int, int, int, int, int, int ) throw( VError ); VImage extract_band( int ) throw( VError ); @@ -135,12 +145,13 @@ VImage flipver() throw( VError ); static VImage gbandjoin( std::vector ) throw( VError ); VImage grid( int, int, int ) throw( VError ); VImage insert( VImage, int, int ) throw( VError ); +VImage insert( VImage, std::vector, std::vector ) throw( VError ); VImage insert_noexpand( VImage, int, int ) throw( VError ); +VImage embed( int, int, int, int, int ) throw( VError ); VImage lrjoin( VImage ) throw( VError ); static VImage mask2vips( VDMask ) throw( VError ); VImage msb() throw( VError ); VImage msb_band( int ) throw( VError ); -VImage recomb( VDMask ) throw( VError ); VImage replicate( int, int ) throw( VError ); VImage ri2c( VImage ) throw( VError ); VImage rot180() throw( VError ); @@ -148,52 +159,35 @@ VImage rot270() throw( VError ); VImage rot90() throw( VError ); VImage scale() throw( VError ); VImage scaleps() throw( VError ); -VImage rightshift_size( int, int, int ) throw( VError ); -VImage slice( double, double ) throw( VError ); VImage subsample( int, int ) throw( VError ); char* system( char* ) throw( VError ); VImage tbjoin( VImage ) throw( VError ); static VImage text( char*, char*, int, int, int ) throw( VError ); -VImage thresh( double ) throw( VError ); VDMask vips2mask() throw( VError ); VImage wrap( int, int ) throw( VError ); VImage zoom( int, int ) throw( VError ); -VImage addgnoise( double ) throw( VError ); + +// headers for package convolution +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 VImage compass( VIMask ) throw( VError ); VImage contrast_surface( int, int ) throw( VError ); -VImage contrast_surface_raw( int, int ) throw( VError ); VImage conv( VIMask ) throw( VError ); -VImage conv_raw( VIMask ) throw( VError ); -VImage convf( VDMask ) throw( VError ); -VImage convf_raw( VDMask ) throw( VError ); +VImage conv( VDMask ) throw( VError ); VImage convsep( VIMask ) throw( VError ); -VImage convsep_raw( VIMask ) throw( VError ); -VImage convsepf( VDMask ) throw( VError ); -VImage convsepf_raw( VDMask ) throw( VError ); -VImage convsub( VIMask, int, int ) throw( VError ); -VImage embed( int, int, int, int, int ) throw( VError ); +VImage convsep( VDMask ) throw( VError ); VImage fastcor( VImage ) throw( VError ); -VImage fastcor_raw( VImage ) throw( VError ); -static VImage gaussnoise( int, int, double, double ) throw( VError ); +VImage gradcor( VImage ) throw( VError ); +VImage gradient( VIMask ) throw( VError ); VImage grad_x() throw( VError ); VImage grad_y() throw( VError ); -VImage gradcor( VImage ) throw( VError ); -VImage gradcor_raw( VImage ) throw( VError ); -VImage gradient( VIMask ) throw( VError ); -static VImage rank_image( std::vector, int ) throw( VError ); VImage lindetect( VIMask ) throw( VError ); -static VImage maxvalue( std::vector ) throw( VError ); -int mpercent( double ) throw( VError ); -VImage phasecor_fft( VImage ) throw( VError ); -VImage rank( int, int, int ) throw( VError ); -VImage rank_raw( int, int, int ) throw( VError ); -VImage resize_linear( int, int ) throw( VError ); VImage sharpen( int, double, double, double, double, double ) throw( VError ); -VImage shrink( double, double ) throw( VError ); VImage spcor( VImage ) throw( VError ); -VImage spcor_raw( VImage ) throw( VError ); -VImage stretch3( double, double ) throw( VError ); -VImage zerox( int ) throw( VError ); + +// headers for package format +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 static VImage csv2vips( char* ) throw( VError ); static VImage jpeg2vips( char* ) throw( VError ); static VImage magick2vips( char* ) throw( VError ); @@ -208,6 +202,10 @@ void vips2mimejpeg( int ) throw( VError ); void vips2png( char* ) throw( VError ); void vips2ppm( char* ) throw( VError ); void vips2tiff( char* ) throw( VError ); + +// headers for package freq_filt +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 static VImage create_fmask( int, int, int, double, double, double, double, double ) throw( VError ); VImage disp_ps() throw( VError ); VImage flt_image_freq( int, double, double, double, double, double ) throw( VError ); @@ -216,12 +214,18 @@ VImage freqflt( VImage ) throw( VError ); VImage fwfft() throw( VError ); VImage rotquad() throw( VError ); VImage invfft() throw( VError ); +VImage phasecor_fft( VImage ) throw( VError ); VImage invfftr() throw( VError ); + +// headers for package histograms_lut +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 VImage gammacorrect( double ) throw( VError ); VImage heq( int ) throw( VError ); VImage hist( int ) throw( VError ); VImage histcum() throw( VError ); VImage histeq() throw( VError ); +VImage hist_indexed( VImage ) throw( VError ); VImage histgr( int ) throw( VError ); VImage histnD( int ) throw( VError ); VImage histnorm() throw( VError ); @@ -232,34 +236,59 @@ static VImage identity( int ) throw( VError ); static VImage identity_ushort( int, int ) throw( VError ); int ismonotonic() throw( VError ); VImage lhisteq( int, int ) throw( VError ); -VImage lhisteq_raw( int, int ) throw( VError ); +int mpercent( double ) throw( VError ); static VImage invertlut( VDMask, int ) throw( VError ); static VImage buildlut( VDMask ) throw( VError ); VImage maplut( VImage ) throw( VError ); VImage project( VImage& ) throw( VError ); VImage stdif( double, double, double, double, int, int ) throw( VError ); -VImage stdif_raw( double, double, double, double, int, int ) throw( VError ); VImage tone_analyse( double, double, double, double, double, double ) throw( VError ); static VImage tone_build( double, double, double, double, double, double, double, double ) throw( VError ); static VImage tone_build_range( int, int, double, double, double, double, double, double, double, double ) throw( VError ); VImage tone_map( VImage ) throw( VError ); + +// headers for package inplace +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 void circle( int, int, int, int ) throw( VError ); VImage flood_blob_copy( int, int, std::vector ) throw( VError ); +VImage flood_other_copy( VImage, int, int, int ) throw( VError ); void insertplace( VImage, int, int ) throw( VError ); -void line( int, int, int, int, int ) throw( VError ); -VImage lineset( VImage, VImage, std::vector, std::vector, std::vector, std::vector ) throw( VError ); +VImage line( VImage, VImage, std::vector, std::vector, std::vector, std::vector ) throw( VError ); + +// headers for package iofuncs +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 static VImage binfile( char*, int, int, int, int ) throw( VError ); VImage cache( int, int, int ) throw( VError ); +char* getext() throw( VError ); int header_get_typeof( char* ) throw( VError ); int header_int( char* ) throw( VError ); double header_double( char* ) throw( VError ); char* header_string( char* ) throw( VError ); +char* history_get() throw( VError ); +void printdesc() throw( VError ); + +// headers for package mask +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 + +// headers for package morphology +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 double cntlines( int ) throw( VError ); VImage dilate( VIMask ) throw( VError ); -VImage dilate_raw( VIMask ) throw( VError ); +VImage rank( int, int, int ) throw( VError ); +static VImage rank_image( std::vector, int ) throw( VError ); +static VImage maxvalue( std::vector ) throw( VError ); +VImage label_regions( int& ) throw( VError ); +VImage zerox( int ) throw( VError ); VImage erode( VIMask ) throw( VError ); -VImage erode_raw( VIMask ) throw( VError ); VImage profile( int ) throw( VError ); + +// headers for package mosaicing +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 VImage align_bands() throw( VError ); double correl( VImage, int, int, int, int, int, int, int&, int& ) throw( VError ); int _find_lroverlap( VImage, int, int, int, int, int, int, int, int&, double&, double&, double&, double& ) throw( VError ); @@ -278,6 +307,10 @@ VImage tbmerge( VImage, int, int, int ) throw( VError ); VImage tbmerge1( VImage, int, int, int, int, int, int, int, int, int ) throw( VError ); VImage tbmosaic( VImage, int, int, int, int, int, int, int, int, int ) throw( VError ); VImage tbmosaic1( VImage, int, int, int, int, int, int, int, int, int, int, int, int, int ) throw( VError ); + +// headers for package other +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 VImage benchmark() throw( VError ); double benchmark2() throw( VError ); VImage benchmarkn( int ) throw( VError ); @@ -288,6 +321,10 @@ static VImage fgrey( int, int ) throw( VError ); static VImage fzone( int ) throw( VError ); static VImage make_xy( int, int ) throw( VError ); static VImage zone( int ) throw( VError ); + +// headers for package relational +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 VImage blend( VImage, VImage ) throw( VError ); VImage equal( VImage ) throw( VError ); VImage equal( std::vector ) throw( VError ); @@ -308,8 +345,17 @@ VImage moreeq( double ) throw( VError ); VImage notequal( VImage ) throw( VError ); VImage notequal( std::vector ) throw( VError ); VImage notequal( double ) throw( VError ); -VImage affine( double, double, double, double, double, double, int, int, int, int ) throw( VError ); -VImage similarity_area( double, double, double, double, int, int, int, int ) throw( VError ); -VImage similarity( double, double, double, double ) throw( VError ); + +// headers for package resample +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 +VImage rightshift_size( int, int, int ) throw( VError ); +VImage shrink( double, double ) throw( VError ); +VImage stretch3( double, double ) throw( VError ); + +// headers for package video +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 static VImage video_test( int, int ) throw( VError ); static VImage video_v4l1( char*, int, int, int, int, int, int ) throw( VError ); + diff --git a/libvipsCC/vipsc++.cc b/libvipsCC/vipsc++.cc index 7267673a..a913b714 100644 --- a/libvipsCC/vipsc++.cc +++ b/libvipsCC/vipsc++.cc @@ -1,5 +1,7 @@ + +// bodies for package arithmetic // this file automatically generated from -// VIPS library 7.19.0-Mon Jun 29 15:52:56 BST 2009 +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_abs: absolute value VImage VImage::abs() throw( VError ) { @@ -147,24 +149,6 @@ VImage VImage::ceil() throw( VError ) return( out ); } -// im_cmulnorm: multiply two complex images, normalising output -VImage VImage::cmulnorm( VImage in2 ) throw( VError ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_cmulnorm" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - // im_costra: cos of image (angles in degrees) VImage VImage::cos() throw( VError ) { @@ -301,24 +285,6 @@ VImage VImage::exp() throw( VError ) return( out ); } -// im_fav4: average of 4 images -VImage VImage::fav4( VImage in2, VImage in3, VImage in4 ) throw( VError ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_fav4" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = in3.image(); - _vec.data(3) = in4.image(); - _vec.data(4) = out.image(); - _vec.call(); - - return( out ); -} - // im_floor: round to largest integal value not greater than VImage VImage::floor() throw( VError ) { @@ -335,25 +301,6 @@ VImage VImage::floor() throw( VError ) return( out ); } -// im_gadd: calculate a*in1 + b*in2 + c = outfile -VImage VImage::gadd( double a, double b, VImage in2, double c ) throw( VError ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_gadd" ); - - *((double*) _vec.data(0)) = a; - _vec.data(1) = in1.image(); - *((double*) _vec.data(2)) = b; - _vec.data(3) = in2.image(); - *((double*) _vec.data(4)) = c; - _vec.data(5) = out.image(); - _vec.call(); - - return( out ); -} - // im_invert: photographic negative VImage VImage::invert() throw( VError ) { @@ -435,24 +382,6 @@ VImage VImage::lin( std::vector a, std::vector b ) throw( VError return( out ); } -// im_litecor: calculate max(white)*factor*(in/white), if clip == 1 -VImage VImage::litecor( VImage white, int clip, double factor ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_litecor" ); - - _vec.data(0) = in.image(); - _vec.data(1) = white.image(); - _vec.data(2) = out.image(); - *((int*) _vec.data(3)) = clip; - *((double*) _vec.data(4)) = factor; - _vec.call(); - - return( out ); -} - // im_log10tra: log10 of image VImage VImage::log10() throw( VError ) { @@ -602,7 +531,7 @@ VImage VImage::multiply( VImage in2 ) throw( VError ) return( out ); } -// im_powtra: pel^x ofbuildimage +// im_powtra: pel^x of image VImage VImage::pow( double x ) throw( VError ) { VImage in = *this; @@ -639,6 +568,23 @@ VImage VImage::pow( std::vector v ) throw( VError ) return( out ); } +// im_recomb: linear recombination with mask +VImage VImage::recomb( VDMask matrix ) throw( VError ) +{ + VImage in = *this; + VImage out; + + Vargv _vec( "im_recomb" ); + + _vec.data(0) = in.image(); + _vec.data(1) = out.image(); + ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; + _vec.call(); + out._ref->addref( in._ref ); + + return( out ); +} + // im_remainder: remainder after integer division VImage VImage::remainder( VImage in2 ) throw( VError ) { @@ -674,13 +620,13 @@ VImage VImage::remainder( double x ) throw( VError ) return( out ); } -// im_remainderconst_vec: remainder after integer division by a vector of constants +// im_remainder_vec: remainder after integer division by a vector of constants VImage VImage::remainder( std::vector x ) throw( VError ) { VImage in = *this; VImage out; - Vargv _vec( "im_remainderconst_vec" ); + Vargv _vec( "im_remainder_vec" ); _vec.data(0) = in.image(); _vec.data(1) = out.image(); @@ -792,6 +738,10 @@ VImage VImage::tan() throw( VError ) return( out ); } + +// bodies for package boolean +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_andimage: bitwise and of two images VImage VImage::andimage( VImage in2 ) throw( VError ) { @@ -957,7 +907,27 @@ VImage VImage::eorimage( std::vector vec ) throw( VError ) return( out ); } -// im_shiftleft: shift integer image n bits to left +// im_shiftleft_vec: shift image array bits to left +VImage VImage::shiftleft( std::vector vec ) throw( VError ) +{ + VImage in = *this; + VImage out; + + Vargv _vec( "im_shiftleft_vec" ); + + _vec.data(0) = in.image(); + _vec.data(1) = out.image(); + ((im_doublevec_object*) _vec.data(2))->n = vec.size(); + ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; + for( unsigned int i = 0; i < vec.size(); i++ ) + ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; + _vec.call(); + out._ref->addref( in._ref ); + + return( out ); +} + +// im_shiftleft: shift image n bits to left VImage VImage::shiftleft( int c ) throw( VError ) { VImage in1 = *this; @@ -974,6 +944,26 @@ VImage VImage::shiftleft( int c ) throw( VError ) return( out ); } +// im_shiftright_vec: shift image array bits to right +VImage VImage::shiftright( std::vector vec ) throw( VError ) +{ + VImage in = *this; + VImage out; + + Vargv _vec( "im_shiftright_vec" ); + + _vec.data(0) = in.image(); + _vec.data(1) = out.image(); + ((im_doublevec_object*) _vec.data(2))->n = vec.size(); + ((im_doublevec_object*) _vec.data(2))->vec = new double[vec.size()]; + for( unsigned int i = 0; i < vec.size(); i++ ) + ((im_doublevec_object*) _vec.data(2))->vec[i] = vec[i]; + _vec.call(); + out._ref->addref( in._ref ); + + return( out ); +} + // im_shiftright: shift integer image n bits to right VImage VImage::shiftright( int c ) throw( VError ) { @@ -991,6 +981,10 @@ VImage VImage::shiftright( int c ) throw( VError ) return( out ); } + +// bodies for package cimg +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_greyc: noise-removing filter VImage VImage::greyc( int iterations, double amplitude, double sharpness, double anisotropy, double alpha, double sigma, double dl, double da, double gauss_prec, int interpolation, int fast_approx ) throw( VError ) { @@ -1047,6 +1041,10 @@ VImage VImage::greyc_mask( VImage mask, int iterations, double amplitude, double return( dst ); } + +// bodies for package colour +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_LCh2Lab: convert LCh to Lab VImage VImage::LCh2Lab() throw( VError ) { @@ -1633,24 +1631,6 @@ VImage VImage::icc_ac2rc( char* profile ) throw( VError ) return( out ); } -// im_icc_export: convert a float LAB to an 8-bit device image with an ICC profile -VImage VImage::icc_export( char* output_profile, int intent ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_icc_export" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.data(2) = (im_object) output_profile; - *((int*) _vec.data(3)) = intent; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - // im_icc_export_depth: convert a float LAB to device space with an ICC profile VImage VImage::icc_export_depth( int depth, char* output_profile, int intent ) throw( VError ) { @@ -1777,6 +1757,44 @@ VImage VImage::sRGB2XYZ() throw( VError ) return( out ); } + +// bodies for package conversion +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 +// im_addgnoise: add gaussian noise with mean 0 and std. dev. sigma +VImage VImage::addgnoise( double sigma ) throw( VError ) +{ + VImage in = *this; + VImage out; + + Vargv _vec( "im_addgnoise" ); + + _vec.data(0) = in.image(); + _vec.data(1) = out.image(); + *((double*) _vec.data(2)) = sigma; + _vec.call(); + out._ref->addref( in._ref ); + + return( out ); +} + +// im_gaussnoise: generate image of gaussian noise with specified statistics +VImage VImage::gaussnoise( int xsize, int ysize, double mean, double sigma ) throw( VError ) +{ + VImage out; + + Vargv _vec( "im_gaussnoise" ); + + _vec.data(0) = out.image(); + *((int*) _vec.data(1)) = xsize; + *((int*) _vec.data(2)) = ysize; + *((double*) _vec.data(3)) = mean; + *((double*) _vec.data(4)) = sigma; + _vec.call(); + + return( out ); +} + // im_bandjoin: bandwise join of two images VImage VImage::bandjoin( VImage in2 ) throw( VError ) { @@ -1891,77 +1909,13 @@ VImage VImage::c2rect() throw( VError ) return( out ); } -// im_clip2c: convert to signed 8-bit integer -VImage VImage::clip2c() throw( VError ) +// im_clip: convert to unsigned 8-bit integer +VImage VImage::clip() throw( VError ) { VImage in = *this; VImage out; - Vargv _vec( "im_clip2c" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2cm: convert to complex -VImage VImage::clip2cm() throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2cm" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2d: convert to double-precision float -VImage VImage::clip2d() throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2d" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2dcm: convert to double complex -VImage VImage::clip2dcm() throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2dcm" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2f: convert to single-precision float -VImage VImage::clip2f() throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2f" ); + Vargv _vec( "im_clip" ); _vec.data(0) = in.image(); _vec.data(1) = out.image(); @@ -1988,86 +1942,6 @@ VImage VImage::clip2fmt( int ofmt ) throw( VError ) return( out ); } -// im_clip2i: convert to signed 32-bit integer -VImage VImage::clip2i() throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2i" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2s: convert to signed 16-bit integer -VImage VImage::clip2s() throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2s" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2ui: convert to unsigned 32-bit integer -VImage VImage::clip2ui() throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2ui" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip2us: convert to unsigned 16-bit integer -VImage VImage::clip2us() throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip2us" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_clip: convert to unsigned 8-bit integer -VImage VImage::clip() throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_clip" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - // im_copy: copy image VImage VImage::copy() throw( VError ) { @@ -2084,6 +1958,22 @@ VImage VImage::copy() throw( VError ) return( out ); } +// im_copy_file: copy image to a file and return that +VImage VImage::copy_file() throw( VError ) +{ + VImage in = *this; + VImage out; + + Vargv _vec( "im_copy_file" ); + + _vec.data(0) = in.image(); + _vec.data(1) = out.image(); + _vec.call(); + out._ref->addref( in._ref ); + + return( out ); +} + // im_copy_morph: copy image, setting pixel layout VImage VImage::copy_morph( int Bands, int BandFmt, int Coding ) throw( VError ) { @@ -2120,7 +2010,7 @@ VImage VImage::copy_swap() throw( VError ) } // im_copy_set: copy image, setting informational fields -VImage VImage::copy_set( int Type, double Xres, double Yres, int Xoffset, int Yoffset ) throw( VError ) +VImage VImage::copy_( int Type, double Xres, double Yres, int Xoffset, int Yoffset ) throw( VError ) { VImage input = *this; VImage output; @@ -2344,6 +2234,30 @@ VImage VImage::insert( VImage sub, int x, int y ) throw( VError ) return( out ); } +// im_insertset: insert sub into main at every position in x, y +VImage VImage::insert( VImage sub, std::vector x, std::vector y ) throw( VError ) +{ + VImage main = *this; + VImage out; + + Vargv _vec( "im_insertset" ); + + _vec.data(0) = main.image(); + _vec.data(1) = sub.image(); + _vec.data(2) = out.image(); + ((im_intvec_object*) _vec.data(3))->n = x.size(); + ((im_intvec_object*) _vec.data(3))->vec = new int[x.size()]; + for( unsigned int i = 0; i < x.size(); i++ ) + ((im_intvec_object*) _vec.data(3))->vec[i] = x[i]; + ((im_intvec_object*) _vec.data(4))->n = y.size(); + ((im_intvec_object*) _vec.data(4))->vec = new int[y.size()]; + for( unsigned int i = 0; i < y.size(); i++ ) + ((im_intvec_object*) _vec.data(4))->vec[i] = y[i]; + _vec.call(); + + return( out ); +} + // im_insert_noexpand: insert sub-image into main image at position, no expansion VImage VImage::insert_noexpand( VImage sub, int x, int y ) throw( VError ) { @@ -2364,6 +2278,27 @@ VImage VImage::insert_noexpand( VImage sub, int x, int y ) throw( VError ) return( out ); } +// im_embed: embed in within a set of borders +VImage VImage::embed( int type, int x, int y, int w, int h ) throw( VError ) +{ + VImage in = *this; + VImage out; + + Vargv _vec( "im_embed" ); + + _vec.data(0) = in.image(); + _vec.data(1) = out.image(); + *((int*) _vec.data(2)) = type; + *((int*) _vec.data(3)) = x; + *((int*) _vec.data(4)) = y; + *((int*) _vec.data(5)) = w; + *((int*) _vec.data(6)) = h; + _vec.call(); + out._ref->addref( in._ref ); + + return( out ); +} + // im_lrjoin: join two images left-right VImage VImage::lrjoin( VImage in2 ) throw( VError ) { @@ -2429,23 +2364,6 @@ VImage VImage::msb_band( int band ) throw( VError ) return( out ); } -// im_recomb: linear recombination with mask -VImage VImage::recomb( VDMask matrix ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_recomb" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - // im_replicate: replicate an image horizontally and vertically VImage VImage::replicate( int across, int down ) throw( VError ) { @@ -2561,42 +2479,6 @@ VImage VImage::scaleps() throw( VError ) return( out ); } -// im_rightshift_size: decrease size by a power-of-two factor -VImage VImage::rightshift_size( int xshift, int yshift, int band_fmt ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rightshift_size" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = xshift; - *((int*) _vec.data(3)) = yshift; - *((int*) _vec.data(4)) = band_fmt; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_slice: slice an image using two thresholds -VImage VImage::slice( double thresh1, double thresh2 ) throw( VError ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_slice" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((double*) _vec.data(2)) = thresh1; - *((double*) _vec.data(3)) = thresh2; - _vec.call(); - - return( output ); -} - // im_subsample: subsample image by integer factors VImage VImage::subsample( int xshrink, int yshrink ) throw( VError ) { @@ -2667,22 +2549,6 @@ VImage VImage::text( char* text, char* font, int width, int alignment, int dpi ) return( out ); } -// im_thresh: slice an image at a threshold -VImage VImage::thresh( double threshold ) throw( VError ) -{ - VImage input = *this; - VImage output; - - Vargv _vec( "im_thresh" ); - - _vec.data(0) = input.image(); - _vec.data(1) = output.image(); - *((double*) _vec.data(2)) = threshold; - _vec.call(); - - return( output ); -} - // im_vips2mask: convert VIPS image to DOUBLEMASK VDMask VImage::vips2mask() throw( VError ) { @@ -2735,23 +2601,10 @@ VImage VImage::zoom( int xfac, int yfac ) throw( VError ) return( output ); } -// im_addgnoise: add gaussian noise with mean 0 and std. dev. sigma -VImage VImage::addgnoise( double sigma ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_addgnoise" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = sigma; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} +// bodies for package convolution +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_compass: convolve with 8-way rotating integer mask VImage VImage::compass( VIMask matrix ) throw( VError ) { @@ -2787,24 +2640,6 @@ VImage VImage::contrast_surface( int half_win_size, int spacing ) throw( VError return( out ); } -// im_contrast_surface_raw: find high-contrast points in an image -VImage VImage::contrast_surface_raw( int half_win_size, int spacing ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_contrast_surface_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = half_win_size; - *((int*) _vec.data(3)) = spacing; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - // im_conv: convolve VImage VImage::conv( VIMask matrix ) throw( VError ) { @@ -2822,47 +2657,13 @@ VImage VImage::conv( VIMask matrix ) throw( VError ) return( out ); } -// im_conv_raw: convolve, no border -VImage VImage::conv_raw( VIMask matrix ) throw( VError ) +// im_conv_f: convolve, with DOUBLEMASK +VImage VImage::conv( VDMask matrix ) throw( VError ) { VImage in = *this; VImage out; - Vargv _vec( "im_conv_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_convf: convolve, with DOUBLEMASK -VImage VImage::convf( VDMask matrix ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convf" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_convf_raw: convolve, with DOUBLEMASK, no border -VImage VImage::convf_raw( VDMask matrix ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convf_raw" ); + Vargv _vec( "im_conv_f" ); _vec.data(0) = in.image(); _vec.data(1) = out.image(); @@ -2890,30 +2691,13 @@ VImage VImage::convsep( VIMask matrix ) throw( VError ) return( out ); } -// im_convsep_raw: seperable convolution, no border -VImage VImage::convsep_raw( VIMask matrix ) throw( VError ) +// im_convsep_f: seperable convolution, with DOUBLEMASK +VImage VImage::convsep( VDMask matrix ) throw( VError ) { VImage in = *this; VImage out; - Vargv _vec( "im_convsep_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_convsepf: seperable convolution, with DOUBLEMASK -VImage VImage::convsepf( VDMask matrix ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convsepf" ); + Vargv _vec( "im_convsep_f" ); _vec.data(0) = in.image(); _vec.data(1) = out.image(); @@ -2924,62 +2708,6 @@ VImage VImage::convsepf( VDMask matrix ) throw( VError ) return( out ); } -// im_convsepf_raw: seperable convolution, with DOUBLEMASK, no border -VImage VImage::convsepf_raw( VDMask matrix ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convsepf_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().dptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_convsub: convolve uchar to uchar, sub-sampling by xskip, yskip -VImage VImage::convsub( VIMask matrix, int xskip, int yskip ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_convsub" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - *((int*) _vec.data(3)) = xskip; - *((int*) _vec.data(4)) = yskip; - _vec.call(); - - return( out ); -} - -// im_embed: embed in within a set of borders -VImage VImage::embed( int type, int x, int y, int w, int h ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_embed" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = type; - *((int*) _vec.data(3)) = x; - *((int*) _vec.data(4)) = y; - *((int*) _vec.data(5)) = w; - *((int*) _vec.data(6)) = h; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - // im_fastcor: fast correlate in2 within in1 VImage VImage::fastcor( VImage in2 ) throw( VError ) { @@ -2998,13 +2726,13 @@ VImage VImage::fastcor( VImage in2 ) throw( VError ) return( out ); } -// im_fastcor_raw: fast correlate in2 within in1, no border -VImage VImage::fastcor_raw( VImage in2 ) throw( VError ) +// im_gradcor: non-normalised correlation of gradient of in2 within in1 +VImage VImage::gradcor( VImage in2 ) throw( VError ) { VImage in1 = *this; VImage out; - Vargv _vec( "im_fastcor_raw" ); + Vargv _vec( "im_gradcor" ); _vec.data(0) = in1.image(); _vec.data(1) = in2.image(); @@ -3016,19 +2744,19 @@ VImage VImage::fastcor_raw( VImage in2 ) throw( VError ) return( out ); } -// im_gaussnoise: generate image of gaussian noise with specified statistics -VImage VImage::gaussnoise( int xsize, int ysize, double mean, double sigma ) throw( VError ) +// im_gradient: convolve with 2-way rotating mask +VImage VImage::gradient( VIMask matrix ) throw( VError ) { + VImage in = *this; VImage out; - Vargv _vec( "im_gaussnoise" ); + Vargv _vec( "im_gradient" ); - _vec.data(0) = out.image(); - *((int*) _vec.data(1)) = xsize; - *((int*) _vec.data(2)) = ysize; - *((double*) _vec.data(3)) = mean; - *((double*) _vec.data(4)) = sigma; + _vec.data(0) = in.image(); + _vec.data(1) = out.image(); + ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; _vec.call(); + out._ref->addref( in._ref ); return( out ); } @@ -3065,79 +2793,6 @@ VImage VImage::grad_y() throw( VError ) return( out ); } -// im_gradcor: non-normalised correlation of gradient of in2 within in1 -VImage VImage::gradcor( VImage in2 ) throw( VError ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_gradcor" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_gradcor_raw: non-normalised correlation of gradient of in2 within in1, no padding -VImage VImage::gradcor_raw( VImage in2 ) throw( VError ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_gradcor_raw" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_gradient: convolve with 2-way rotating mask -VImage VImage::gradient( VIMask matrix ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_gradient" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = matrix.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_rank_image: point-wise pixel rank -VImage VImage::rank_image( std::vector in, int index ) throw( VError ) -{ - VImage out; - - Vargv _vec( "im_rank_image" ); - - ((im_imagevec_object*) _vec.data(0))->n = in.size(); - ((im_imagevec_object*) _vec.data(0))->vec = new IMAGE *[in.size()]; - for( unsigned int i = 0; i < in.size(); i++ ) - ((im_imagevec_object*) _vec.data(0))->vec[i] = in[i].image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = index; - _vec.call(); - for( unsigned int i = 0; i < in.size(); i++ ) - out._ref->addref( in[i]._ref ); - - return( out ); -} - // im_lindetect: convolve with 4-way rotating mask VImage VImage::lindetect( VIMask matrix ) throw( VError ) { @@ -3155,112 +2810,6 @@ VImage VImage::lindetect( VIMask matrix ) throw( VError ) return( out ); } -// im_maxvalue: point-wise maximum value -VImage VImage::maxvalue( std::vector in ) throw( VError ) -{ - VImage out; - - Vargv _vec( "im_maxvalue" ); - - ((im_imagevec_object*) _vec.data(0))->n = in.size(); - ((im_imagevec_object*) _vec.data(0))->vec = new IMAGE *[in.size()]; - for( unsigned int i = 0; i < in.size(); i++ ) - ((im_imagevec_object*) _vec.data(0))->vec[i] = in[i].image(); - _vec.data(1) = out.image(); - _vec.call(); - for( unsigned int i = 0; i < in.size(); i++ ) - out._ref->addref( in[i]._ref ); - - return( out ); -} - -// im_mpercent: find threshold above which there are percent values -int VImage::mpercent( double percent ) throw( VError ) -{ - VImage in = *this; - int thresh; - - Vargv _vec( "im_mpercent" ); - - _vec.data(0) = in.image(); - *((double*) _vec.data(1)) = percent; - _vec.call(); - thresh = *((int*)_vec.data(2)); - - return( thresh ); -} - -// im_phasecor_fft: non-normalised correlation of gradient of in2 within in1 -VImage VImage::phasecor_fft( VImage in2 ) throw( VError ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_phasecor_fft" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - - return( out ); -} - -// im_rank: rank filter nth element of xsize/ysize window -VImage VImage::rank( int xsize, int ysize, int n ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rank" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = xsize; - *((int*) _vec.data(3)) = ysize; - *((int*) _vec.data(4)) = n; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_rank_raw: rank filter nth element of xsize/ysize window, no border -VImage VImage::rank_raw( int xsize, int ysize, int n ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_rank_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = xsize; - *((int*) _vec.data(3)) = ysize; - *((int*) _vec.data(4)) = n; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_resize_linear: resize to X by Y pixels with linear interpolation -VImage VImage::resize_linear( int X, int Y ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_resize_linear" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = X; - *((int*) _vec.data(3)) = Y; - _vec.call(); - - return( out ); -} - // im_sharpen: sharpen high frequencies of L channel of LabQ VImage VImage::sharpen( int mask_size, double x1, double y2, double y3, double m1, double m2 ) throw( VError ) { @@ -3283,24 +2832,6 @@ VImage VImage::sharpen( int mask_size, double x1, double y2, double y3, double m return( out ); } -// im_shrink: shrink image by xfac, yfac times -VImage VImage::shrink( double xfac, double yfac ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_shrink" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = xfac; - *((double*) _vec.data(3)) = yfac; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - // im_spcor: normalised correlation of in2 within in1 VImage VImage::spcor( VImage in2 ) throw( VError ) { @@ -3319,59 +2850,10 @@ VImage VImage::spcor( VImage in2 ) throw( VError ) return( out ); } -// im_spcor_raw: normalised correlation of in2 within in1, no black padding -VImage VImage::spcor_raw( VImage in2 ) throw( VError ) -{ - VImage in1 = *this; - VImage out; - - Vargv _vec( "im_spcor_raw" ); - - _vec.data(0) = in1.image(); - _vec.data(1) = in2.image(); - _vec.data(2) = out.image(); - _vec.call(); - out._ref->addref( in1._ref ); - out._ref->addref( in2._ref ); - - return( out ); -} - -// im_stretch3: stretch 3%, sub-pixel displace by xdisp/ydisp -VImage VImage::stretch3( double xdisp, double ydisp ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_stretch3" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = xdisp; - *((double*) _vec.data(3)) = ydisp; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - -// im_zerox: find +ve or -ve zero crossings in image -VImage VImage::zerox( int flag ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_zerox" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = flag; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} +// bodies for package format +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_csv2vips: read a file in csv format VImage VImage::csv2vips( char* filename ) throw( VError ) { @@ -3550,6 +3032,10 @@ void VImage::vips2tiff( char* out ) throw( VError ) _vec.call(); } + +// bodies for package freq_filt +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_create_fmask: create frequency domain filter mask VImage VImage::create_fmask( int width, int height, int type, double p1, double p2, double p3, double p4, double p5 ) throw( VError ) { @@ -3683,6 +3169,22 @@ VImage VImage::invfft() throw( VError ) return( out ); } +// im_phasecor_fft: non-normalised correlation of gradient of in2 within in1 +VImage VImage::phasecor_fft( VImage in2 ) throw( VError ) +{ + VImage in1 = *this; + VImage out; + + Vargv _vec( "im_phasecor_fft" ); + + _vec.data(0) = in1.image(); + _vec.data(1) = in2.image(); + _vec.data(2) = out.image(); + _vec.call(); + + return( out ); +} + // im_invfftr: real part of inverse fast-fourier transform VImage VImage::invfftr() throw( VError ) { @@ -3698,6 +3200,10 @@ VImage VImage::invfftr() throw( VError ) return( out ); } + +// bodies for package histograms_lut +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_gammacorrect: gamma-correct image VImage VImage::gammacorrect( double exponent ) throw( VError ) { @@ -3781,6 +3287,24 @@ VImage VImage::histeq() throw( VError ) return( out ); } +// im_hist_indexed: make a histogram with an index image +VImage VImage::hist_indexed( VImage value ) throw( VError ) +{ + VImage index = *this; + VImage out; + + Vargv _vec( "im_hist_indexed" ); + + _vec.data(0) = index.image(); + _vec.data(1) = value.image(); + _vec.data(2) = out.image(); + _vec.call(); + out._ref->addref( index._ref ); + out._ref->addref( value._ref ); + + return( out ); +} + // im_histgr: find histogram of image VImage VImage::histgr( int band_number ) throw( VError ) { @@ -3939,22 +3463,20 @@ VImage VImage::lhisteq( int width, int height ) throw( VError ) return( out ); } -// im_lhisteq_raw: local histogram equalisation, no border -VImage VImage::lhisteq_raw( int width, int height ) throw( VError ) +// im_mpercent: find threshold above which there are percent values +int VImage::mpercent( double percent ) throw( VError ) { VImage in = *this; - VImage out; + int thresh; - Vargv _vec( "im_lhisteq_raw" ); + Vargv _vec( "im_mpercent" ); _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((int*) _vec.data(2)) = width; - *((int*) _vec.data(3)) = height; + *((double*) _vec.data(1)) = percent; _vec.call(); - out._ref->addref( in._ref ); + thresh = *((int*)_vec.data(2)); - return( out ); + return( thresh ); } // im_invertlut: generate correction table from set of measures @@ -4042,28 +3564,6 @@ VImage VImage::stdif( double a, double m0, double b, double s0, int xw, int yw ) return( out ); } -// im_stdif_raw: statistical differencing, no border -VImage VImage::stdif_raw( double a, double m0, double b, double s0, int xw, int yw ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_stdif_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = a; - *((double*) _vec.data(3)) = m0; - *((double*) _vec.data(4)) = b; - *((double*) _vec.data(5)) = s0; - *((int*) _vec.data(6)) = xw; - *((int*) _vec.data(7)) = yw; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - // im_tone_analyse: analyse in and create LUT for tone adjustment VImage VImage::tone_analyse( double Ps, double Pm, double Ph, double S, double M, double H ) throw( VError ) { @@ -4147,6 +3647,10 @@ VImage VImage::tone_map( VImage lut ) throw( VError ) return( out ); } + +// bodies for package inplace +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_circle: plot circle on image void VImage::circle( int cx, int cy, int radius, int intensity ) throw( VError ) { @@ -4182,6 +3686,25 @@ VImage VImage::flood_blob_copy( int start_x, int start_y, std::vector in return( out ); } +// im_flood_other_copy: flood mask with serial number from start_x, start_y while pixel == start pixel +VImage VImage::flood_other_copy( VImage test, int start_x, int start_y, int serial ) throw( VError ) +{ + VImage mask = *this; + VImage out; + + Vargv _vec( "im_flood_other_copy" ); + + _vec.data(0) = mask.image(); + _vec.data(1) = test.image(); + _vec.data(2) = out.image(); + *((int*) _vec.data(3)) = start_x; + *((int*) _vec.data(4)) = start_y; + *((int*) _vec.data(5)) = serial; + _vec.call(); + + return( out ); +} + // im_insertplace: draw image sub inside image main at position (x,y) void VImage::insertplace( VImage sub, int x, int y ) throw( VError ) { @@ -4195,23 +3718,8 @@ void VImage::insertplace( VImage sub, int x, int y ) throw( VError ) _vec.call(); } -// im_line: draw line between points (x1,y1) and (x2,y2) -void VImage::line( int x1, int y1, int x2, int y2, int pelval ) throw( VError ) -{ - VImage im = *this; - Vargv _vec( "im_line" ); - - _vec.data(0) = im.image(); - *((int*) _vec.data(1)) = x1; - *((int*) _vec.data(2)) = y1; - *((int*) _vec.data(3)) = x2; - *((int*) _vec.data(4)) = y2; - *((int*) _vec.data(5)) = pelval; - _vec.call(); -} - // im_lineset: draw line between points (x1,y1) and (x2,y2) -VImage VImage::lineset( VImage mask, VImage ink, std::vector x1, std::vector y1, std::vector x2, std::vector y2 ) throw( VError ) +VImage VImage::line( VImage mask, VImage ink, std::vector x1, std::vector y1, std::vector x2, std::vector y2 ) throw( VError ) { VImage in = *this; VImage out; @@ -4243,6 +3751,10 @@ VImage VImage::lineset( VImage mask, VImage ink, std::vector x1, std::vecto return( out ); } + +// bodies for package iofuncs +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_binfile: open a headerless binary file VImage VImage::binfile( char* filename, int width, int height, int bands, int offset ) throw( VError ) { @@ -4279,6 +3791,21 @@ VImage VImage::cache( int tile_width, int tile_height, int max_tiles ) throw( VE return( out ); } +// im_getext: return the image metadata XML as a string +char* VImage::getext() throw( VError ) +{ + VImage image = *this; + char* history; + + Vargv _vec( "im_getext" ); + + _vec.data(0) = image.image(); + _vec.call(); + history = (char*) _vec.data(1); + + return( history ); +} + // im_header_get_typeof: return field type int VImage::header_get_typeof( char* field ) throw( VError ) { @@ -4327,7 +3854,7 @@ double VImage::header_double( char* field ) throw( VError ) return( value ); } -// im_header_string: extract string fields from header +// im_header_string: extract fields from headers as strings char* VImage::header_string( char* field ) throw( VError ) { VImage image = *this; @@ -4343,6 +3870,39 @@ char* VImage::header_string( char* field ) throw( VError ) return( value ); } +// im_history_get: return the image history as a string +char* VImage::history_get() throw( VError ) +{ + VImage image = *this; + char* history; + + Vargv _vec( "im_history_get" ); + + _vec.data(0) = image.image(); + _vec.call(); + history = (char*) _vec.data(1); + + return( history ); +} + +// im_printdesc: print an image header to stdout +void VImage::printdesc() throw( VError ) +{ + VImage image = *this; + Vargv _vec( "im_printdesc" ); + + _vec.data(0) = image.image(); + _vec.call(); +} + + +// bodies for package mask +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 + +// bodies for package morphology +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_cntlines: count horizontal or vertical lines double VImage::cntlines( int direction ) throw( VError ) { @@ -4376,17 +3936,91 @@ VImage VImage::dilate( VIMask mask ) throw( VError ) return( out ); } -// im_dilate_raw: dilate image with mask -VImage VImage::dilate_raw( VIMask mask ) throw( VError ) +// im_rank: rank filter nth element of xsize/ysize window +VImage VImage::rank( int xsize, int ysize, int n ) throw( VError ) { VImage in = *this; VImage out; - Vargv _vec( "im_dilate_raw" ); + Vargv _vec( "im_rank" ); _vec.data(0) = in.image(); _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = mask.mask().iptr; + *((int*) _vec.data(2)) = xsize; + *((int*) _vec.data(3)) = ysize; + *((int*) _vec.data(4)) = n; + _vec.call(); + out._ref->addref( in._ref ); + + return( out ); +} + +// im_rank_image: point-wise pixel rank +VImage VImage::rank_image( std::vector in, int index ) throw( VError ) +{ + VImage out; + + Vargv _vec( "im_rank_image" ); + + ((im_imagevec_object*) _vec.data(0))->n = in.size(); + ((im_imagevec_object*) _vec.data(0))->vec = new IMAGE *[in.size()]; + for( unsigned int i = 0; i < in.size(); i++ ) + ((im_imagevec_object*) _vec.data(0))->vec[i] = in[i].image(); + _vec.data(1) = out.image(); + *((int*) _vec.data(2)) = index; + _vec.call(); + for( unsigned int i = 0; i < in.size(); i++ ) + out._ref->addref( in[i]._ref ); + + return( out ); +} + +// im_maxvalue: point-wise maximum value +VImage VImage::maxvalue( std::vector in ) throw( VError ) +{ + VImage out; + + Vargv _vec( "im_maxvalue" ); + + ((im_imagevec_object*) _vec.data(0))->n = in.size(); + ((im_imagevec_object*) _vec.data(0))->vec = new IMAGE *[in.size()]; + for( unsigned int i = 0; i < in.size(); i++ ) + ((im_imagevec_object*) _vec.data(0))->vec[i] = in[i].image(); + _vec.data(1) = out.image(); + _vec.call(); + for( unsigned int i = 0; i < in.size(); i++ ) + out._ref->addref( in[i]._ref ); + + return( out ); +} + +// im_label_regions: number continuous regions in an image +VImage VImage::label_regions( int& segments ) throw( VError ) +{ + VImage test = *this; + VImage mask; + + Vargv _vec( "im_label_regions" ); + + _vec.data(0) = test.image(); + _vec.data(1) = mask.image(); + _vec.call(); + segments = *((int*)_vec.data(2)); + + return( mask ); +} + +// im_zerox: find +ve or -ve zero crossings in image +VImage VImage::zerox( int flag ) throw( VError ) +{ + VImage in = *this; + VImage out; + + Vargv _vec( "im_zerox" ); + + _vec.data(0) = in.image(); + _vec.data(1) = out.image(); + *((int*) _vec.data(2)) = flag; _vec.call(); out._ref->addref( in._ref ); @@ -4410,23 +4044,6 @@ VImage VImage::erode( VIMask mask ) throw( VError ) return( out ); } -// im_erode_raw: erode image with mask -VImage VImage::erode_raw( VIMask mask ) throw( VError ) -{ - VImage in = *this; - VImage out; - - Vargv _vec( "im_erode_raw" ); - - _vec.data(0) = in.image(); - _vec.data(1) = out.image(); - ((im_mask_object*) _vec.data(2))->mask = mask.mask().iptr; - _vec.call(); - out._ref->addref( in._ref ); - - return( out ); -} - // im_profile: find first horizontal/vertical edge VImage VImage::profile( int direction ) throw( VError ) { @@ -4443,6 +4060,10 @@ VImage VImage::profile( int direction ) throw( VError ) return( out ); } + +// bodies for package mosaicing +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_align_bands: align the bands of an image VImage VImage::align_bands() throw( VError ) { @@ -4872,6 +4493,10 @@ VImage VImage::tbmosaic1( VImage sec, int bandno, int xr1, int yr1, int xs1, int return( out ); } + +// bodies for package other +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_benchmark: do something complicated for testing VImage VImage::benchmark() throw( VError ) { @@ -5025,6 +4650,10 @@ VImage VImage::zone( int size ) throw( VError ) return( out ); } + +// bodies for package relational +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_blend: use cond image to blend between images in1 and in2 VImage VImage::blend( VImage in1, VImage in2 ) throw( VError ) { @@ -5395,76 +5024,69 @@ VImage VImage::notequal( double c ) throw( VError ) return( out ); } -// im_affine: affine transform -VImage VImage::affine( double a, double b, double c, double d, double dx, double dy, int x, int y, int w, int h ) throw( VError ) + +// bodies for package resample +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 +// im_rightshift_size: decrease size by a power-of-two factor +VImage VImage::rightshift_size( int xshift, int yshift, int band_fmt ) throw( VError ) { VImage in = *this; VImage out; - Vargv _vec( "im_affine" ); + Vargv _vec( "im_rightshift_size" ); _vec.data(0) = in.image(); _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = a; - *((double*) _vec.data(3)) = b; - *((double*) _vec.data(4)) = c; - *((double*) _vec.data(5)) = d; - *((double*) _vec.data(6)) = dx; - *((double*) _vec.data(7)) = dy; - *((int*) _vec.data(8)) = x; - *((int*) _vec.data(9)) = y; - *((int*) _vec.data(10)) = w; - *((int*) _vec.data(11)) = h; + *((int*) _vec.data(2)) = xshift; + *((int*) _vec.data(3)) = yshift; + *((int*) _vec.data(4)) = band_fmt; _vec.call(); out._ref->addref( in._ref ); return( out ); } -// im_similarity_area: output area xywh of similarity transformation -VImage VImage::similarity_area( double a, double b, double dx, double dy, int x, int y, int w, int h ) throw( VError ) +// im_shrink: shrink image by xfac, yfac times +VImage VImage::shrink( double xfac, double yfac ) throw( VError ) { VImage in = *this; VImage out; - Vargv _vec( "im_similarity_area" ); + Vargv _vec( "im_shrink" ); _vec.data(0) = in.image(); _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = a; - *((double*) _vec.data(3)) = b; - *((double*) _vec.data(4)) = dx; - *((double*) _vec.data(5)) = dy; - *((int*) _vec.data(6)) = x; - *((int*) _vec.data(7)) = y; - *((int*) _vec.data(8)) = w; - *((int*) _vec.data(9)) = h; + *((double*) _vec.data(2)) = xfac; + *((double*) _vec.data(3)) = yfac; _vec.call(); out._ref->addref( in._ref ); return( out ); } -// im_similarity: similarity transformation -VImage VImage::similarity( double a, double b, double dx, double dy ) throw( VError ) +// im_stretch3: stretch 3%, sub-pixel displace by xdisp/ydisp +VImage VImage::stretch3( double xdisp, double ydisp ) throw( VError ) { VImage in = *this; VImage out; - Vargv _vec( "im_similarity" ); + Vargv _vec( "im_stretch3" ); _vec.data(0) = in.image(); _vec.data(1) = out.image(); - *((double*) _vec.data(2)) = a; - *((double*) _vec.data(3)) = b; - *((double*) _vec.data(4)) = dx; - *((double*) _vec.data(5)) = dy; + *((double*) _vec.data(2)) = xdisp; + *((double*) _vec.data(3)) = ydisp; _vec.call(); out._ref->addref( in._ref ); return( out ); } + +// bodies for package video +// this file automatically generated from +// VIPS library 7.20.1-Fri Nov 13 11:00:09 GMT 2009 // im_video_test: test video grabber VImage VImage::video_test( int brightness, int error ) throw( VError ) { @@ -5500,3 +5122,4 @@ VImage VImage::video_v4l1( char* device, int channel, int brightness, int colour return( out ); } + diff --git a/tools/iofuncs/vips.c b/tools/iofuncs/vips.c index c405aa04..59b8bf95 100644 --- a/tools/iofuncs/vips.c +++ b/tools/iofuncs/vips.c @@ -30,6 +30,8 @@ * - add --list interpolators * 9/2/09 * - and now we just have --list packages/classes/package-name + * 13/11/09 + * - drop _f postfixes, drop many postfixes */ /* @@ -442,38 +444,48 @@ find_ioargs( im_function *fn, int *ia, int *oa ) } } +static gboolean +drop_postfix( char *str, const char *postfix ) +{ + if( ispostfix( postfix, str ) ) { + str[strlen( str ) - strlen( postfix )] = '\0'; + + return( TRUE ); + } + + return( FALSE ); +} + /* Turn a VIPS name into a C++ name. Eg. im_lintra_vec becomes lin. */ static void c2cpp_name( const char *in, char *out ) { - /* chop off "im_" prefix. + static const char *postfix[] = { + "_vec", + "const", + "tra", + "set", + "_f" + }; + + int i; + gboolean changed; + + /* Copy, chopping off "im_" prefix. */ if( isprefix( "im_", in ) ) strcpy( out, in + 3 ); else strcpy( out, in ); - /* Drop "_vec" postfix (eg. so im_lintra_vec becomes lintra). We rely - * on overloading to distinguish conflicts. + /* Repeatedly drop postfixes while we can. */ - if( ispostfix( "_vec", out ) ) - out[strlen( out ) - 4] = '\0'; - - /* Drop "const" postfix (eg. so im_eorimageconst becomes eorimage). - */ - if( ispostfix( "const", out ) ) - out[strlen( out ) - 5] = '\0'; - - /* Drop "tra" postfix (eg. so im_costra becomes cos). - */ - if( ispostfix( "tra", out ) ) - out[strlen( out ) - 3] = '\0'; - - /* Drop "set" postfix (eg. so im_insertset becomes insert). - */ - if( ispostfix( "set", out ) ) - out[strlen( out ) - 3] = '\0'; + do { + changed = FALSE; + for( i = 0; i < IM_NUMBER( postfix ); i++ ) + changed |= drop_postfix( out, postfix[i] ); + } while( changed ); } /* Print prototype for a function (ie. will be followed by code).