From ad017dc56f5c653d29ecf077d0abf10e0170aade Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 24 Apr 2015 10:10:44 +0100 Subject: [PATCH] add more C++ convenience functions flipver() etc. --- ChangeLog | 4 +-- TODO | 11 ------ cplusplus/include/vips/VImage8.h | 58 ++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5dd748c8..144f813d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ 11/2/15 started 8.0 - remove old doc stuff, lots of doc improvements -- add fliphor(), flipver(), rot90(), rot180(), rot270() convenience methods to - Python +- add fliphor(), flipver(), rot90(), rot180(), rot270(), median(), dilate(), + erode() convenience methods to Python and C++ - python: use [] to index and slice image bands, use () to get a point - c++: use [] to band index, () returns a vector - add shift option to cast diff --git a/TODO b/TODO index f2bd05f7..31b87df5 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,3 @@ -- try: - - vips embed k2.jpg x.jpg 10 10 1000 1000 --vips-cache-trace - - we don't seem to show all ops or images, can we improve this? - - -- does cplusplus need flipver() etc.? - are the mosaic functions calling vips_fastcor()? it must be very slow @@ -22,9 +14,6 @@ then im__chkpair() runs that 20 times, then loops ... oh dear -- make a crappy gir_ffi patch to add unset for GValue, perhaps it will produce - a response - - perhaps im_maxpos_subpel() / im_minpos_subpel() should be undeprecated, useful with vips_fastcor() diff --git a/cplusplus/include/vips/VImage8.h b/cplusplus/include/vips/VImage8.h index ff1e40cd..8edc5312 100644 --- a/cplusplus/include/vips/VImage8.h +++ b/cplusplus/include/vips/VImage8.h @@ -557,6 +557,64 @@ public: std::complex maxpos( VOption *options = 0 ) throw( VError ); + VImage + fliphor( VOption *options = 0 ) + throw( VError ) + { + return( flip( VIPS_DIRECTION_HORIZONTAL, options ) ); + } + + VImage + flipver( VOption *options = 0 ) + throw( VError ) + { + return( flip( VIPS_DIRECTION_VERTICAL, options ) ); + } + + VImage + rot90( VOption *options = 0 ) + throw( VError ) + { + return( rot( VIPS_ANGLE_D90, options ) ); + } + + VImage + rot180( VOption *options = 0 ) + throw( VError ) + { + return( rot( VIPS_ANGLE_D180, options ) ); + } + + VImage + rot270( VOption *options = 0 ) + throw( VError ) + { + return( rot( VIPS_ANGLE_D270, options ) ); + } + + VImage + dilate( VImage mask, VOption *options = 0 ) + throw( VError ) + { + return( morph( mask, VIPS_OPERATION_MORPHOLOGY_DILATE, + options ) ); + } + + VImage + erode( VImage mask, VOption *options = 0 ) + throw( VError ) + { + return( morph( mask, VIPS_OPERATION_MORPHOLOGY_ERODE, + options ) ); + } + + VImage + median( int size = 3, VOption *options = 0 ) + throw( VError ) + { + return( rank( size, size, (size * size) / 2, options ) ); + } + VImage floor( VOption *options = 0 ) throw( VError )