1 /* mask.h 2 * 3 * 20/9/09 4 * - from proto.h 5 */ 6 7 /* All deprecated. 8 */ 9 10 /* 11 12 This file is part of VIPS. 13 14 VIPS is free software; you can redistribute it and/or modify 15 it under the terms of the GNU Lesser General Public License as published by 16 the Free Software Foundation; either version 2 of the License, or 17 (at your option) any later version. 18 19 This program is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU Lesser General Public License for more details. 23 24 You should have received a copy of the GNU Lesser General Public License 25 along with this program; if not, write to the Free Software 26 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 27 02110-1301 USA 28 29 */ 30 31 /* 32 33 These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk 34 35 */ 36 37 #ifndef IM_MASK_H 38 #define IM_MASK_H 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif /*__cplusplus*/ 43 44 typedef struct im__INTMASK { 45 int xsize; 46 int ysize; 47 int scale; 48 int offset; 49 int *coeff; 50 char *filename; 51 } INTMASK; 52 53 typedef struct im__DOUBLEMASK { 54 int xsize; 55 int ysize; 56 double scale; 57 double offset; 58 double *coeff; 59 char *filename; 60 } DOUBLEMASK; 61 62 #define IM_MASK( M, X, Y ) ((M)->coeff[(X) + (Y) * (M)->xsize]) 63 64 INTMASK *im_create_imask( const char *filename, int xsize, int ysize ); 65 INTMASK *im_create_imaskv( const char *filename, int xsize, int ysize, ... ); 66 DOUBLEMASK *im_create_dmask( const char *filename, int xsize, int ysize ); 67 DOUBLEMASK *im_create_dmaskv( const char *filename, int xsize, int ysize, ... ); 68 69 INTMASK *im_read_imask( const char *filename ); 70 DOUBLEMASK *im_read_dmask( const char *filename ); 71 72 void im_print_imask( INTMASK *in ); 73 void im_print_dmask( DOUBLEMASK *in ); 74 75 int im_write_imask( INTMASK *in ); 76 int im_write_dmask( DOUBLEMASK *in ); 77 int im_write_imask_name( INTMASK *in, const char *filename ); 78 int im_write_dmask_name( DOUBLEMASK *in, const char *filename ); 79 80 int im_free_imask( INTMASK *in ); 81 int im_free_dmask( DOUBLEMASK *in ); 82 83 INTMASK *im_log_imask( const char *filename, double sigma, double min_ampl ); 84 DOUBLEMASK *im_log_dmask( const char *filename, double sigma, double min_ampl ); 85 86 INTMASK *im_gauss_imask( const char *filename, double sigma, double min_ampl ); 87 INTMASK *im_gauss_imask_sep( const char *filename, 88 double sigma, double min_ampl ); 89 DOUBLEMASK *im_gauss_dmask( const char *filename, 90 double sigma, double min_ampl ); 91 DOUBLEMASK *im_gauss_dmask_sep( const char *filename, 92 double sigma, double min_ampl ); 93 94 INTMASK *im_dup_imask( INTMASK *in, const char *filename ); 95 DOUBLEMASK *im_dup_dmask( DOUBLEMASK *in, const char *filename ); 96 97 INTMASK *im_scale_dmask( DOUBLEMASK *in, const char *filename ); 98 void im_norm_dmask( DOUBLEMASK *mask ); 99 DOUBLEMASK *im_imask2dmask( INTMASK *in, const char *filename ); 100 INTMASK *im_dmask2imask( DOUBLEMASK *in, const char *filename ); 101 102 INTMASK *im_rotate_imask90( INTMASK *in, const char *filename ); 103 INTMASK *im_rotate_imask45( INTMASK *in, const char *filename ); 104 DOUBLEMASK *im_rotate_dmask90( DOUBLEMASK *in, const char *filename ); 105 DOUBLEMASK *im_rotate_dmask45( DOUBLEMASK *in, const char *filename ); 106 107 DOUBLEMASK *im_mattrn( DOUBLEMASK *in, const char *filename ); 108 DOUBLEMASK *im_matcat( DOUBLEMASK *top, DOUBLEMASK *bottom, 109 const char *filename ); 110 DOUBLEMASK *im_matmul( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *filename ); 111 112 DOUBLEMASK *im_lu_decomp( const DOUBLEMASK *mat, const char *filename ); 113 int im_lu_solve( const DOUBLEMASK *lu, double *vec ); 114 DOUBLEMASK *im_matinv( const DOUBLEMASK *mat, const char *filename ); 115 int im_matinv_inplace( DOUBLEMASK *mat ); 116 117 DOUBLEMASK *im_local_dmask( struct _VipsImage *out, DOUBLEMASK *mask ); 118 INTMASK *im_local_imask( struct _VipsImage *out, INTMASK *mask ); 119 120 #ifdef __cplusplus 121 } 122 #endif /*__cplusplus*/ 123 124 #endif /*IM_MASK_H*/ 125