Man Linux: Main Page and Category List

NAME

       im_create_dmask,  im_create_imask,  im_create_dmaskv, im_create_imaskv,
       im_dup_dmask,     im_dup_imask,      im_free_dmask,      im_free_imask,
       im_print_imask,     im_print_dmask,    im_read_dmask,    im_read_imask,
       im_scale_dmask, im_write_dmask, im_write_imask - operations  on  double
       or int masks

SYNOPSIS

       #include <vips/vips.h>

       DOUBLEMASK *im_create_dmask( name, xs, ys )
       char *name;
       int xs, ys;

       INTMASK *im_create_imask( name, xs, ys )
       char *name;
       int xs, ys;

       DOUBLEMASK *im_create_dmaskv( name, xs, ys, ... )
       char *name;
       int xs, ys;

       INTMASK *im_create_imaskv( name, xs, ys, ... )
       char *name;
       int xs, ys;

       DOUBLEMASK *im_dup_dmask( m, name )
       DOUBLEMASK *m;
       char *name;

       INTMASK *im_dup_imask( m, name )
       INTMASK *m;
       char *name;

       void im_free_dmask( mask )
       DOUBLEMASK *mask;

       void im_free_imask( mask )
       INTMASK *mask;

       DOUBLEMASK *im_read_dmask( name )
       char *name;

       INTMASK *im_read_imask( name )
       char *name;

       void im_print_dmask( mask )
       DOUBLEMASK *mask;

       void im_print_imask( mask )
       INTMASK *mask;

       INTMASK im_scale_dmask( mask, name )
       DOUBLEMASK *mask;
       char *name

       void im_norm_dmask( DOUBLEMASK *mask );

       int im_write_imask( m )
       INTMASK *m;

       int im_write_imask_name( m, name )
       INTMASK *m;
       char *name;

       int im_write_dmask_name( m, name )
       DOUBLEMASK *m;
       char *name;

DESCRIPTION

       Masks are (see <vips/vips.h>):

        typedef struct {                 typedef struct {
               int xsize;                    int xsize;
               int ysize;                    int ysize;
               int scale;                    double scale;
               int offset;                   double offset;
               int *coeff;                   double *coeff;
               char *filename;               char *filename;
        } INTMASK ;                      } DOUBLEMASK ;

       By mask files have the following structure:

        x y [scale] [offset]
        a11 a12 ... a1y
        a21 a22 ... a2y]
        ... ... ... ...
        ax1 ax2 ... axy

       The  mask  sizes  x  and y are always integer whereas all the remaining
       coefficients are either int for INTMASK and double for the  DOUBLEMASK.
       All numbers are written in ASCII, for convenience. scale and offset are
       always optional. If missing, they default to 1 and 0 respectively. This
       laxity makes mask files useful for matrix operations, see im_matinv(3),
       etc.

       im_create_dmask() returns an DOUBLEMASK with  the  filename  xsize  and
       ysize  set  to  name  xs  and  ys respectively.  The function allocates
       memory for the coefficients which are all initialised to zero.  In case
       of error the function returns NULL.

       im_create_dmaskv()  operates  exactly as im_create_dmask(), except that
       the mask is initialised by  the  parameters  following  the  width  and
       height. These parameters must all be doubles. For example:

         DOUBLEMASK *m = im_create_dmaskv( "untitled", 3, 3,
           1.0, 0.0, 0.0,
           0.0, 1.0, 0.0,
           0.0, 0.0, 1.0 );

       creates an identity matrix.

       im_create_imask()  returns an INTMASK with the filename xsize and ysize
       set to name xs and ys respectively.  The function allocates memory  for
       the  coefficients  which are all initialised to zero.  In case of error
       the function returns NULL.

       im_create_imaskv() operates exactly as im_create_imask(),  except  that
       the  mask  is  initialised  by  the  parameters following the width and
       height. These parameters must all be ints. For example:

         INTMASK *m = im_create_imaskv( "untitled", 3, 3,
           1, 0, 0,
           0, 1, 0,
           0, 0, 1 );

       creates an identity matrix.

       im_dup_dmask() duplicates the DOUBLEMASK mask pointed by m and  returns
       a pointer to the new mask.  The filename member of the returned mask is
       set to the entered name.  The  function  returns  either  a  DOUBLEMASK
       pointer or NULL on error.

       im_dup_imask()  duplicates  the INTMASK mask pointed by m and returns a
       pointer to the new mask.  The filename member of the returned  mask  is
       set  to  the  entered  name.   The  function  returns either an INTMASK
       pointer or NULL on error.

       im_free_dmask() frees the memory allocated for the DOUBLEMASK mask.

       im_free_imask() frees the memory allocated for the INTMASK mask.

       im_print_dmask() prints at the sterr the DOUBLEMASK pointed by mask.

       im_print_imask() prints at the sterr the INTMASK pointed by mask.

       im_read_dmask() opens the argument name  and  reads  the  mask  into  a
       DOUBLEMASK  structure.  The function returns a pointer to an DOUBLEMASK
       or NULL on error.

       im_read_imask() opens the argument name  and  reads  the  mask  into  a
       INTMASK structure.  If the input file has non-integer coefficients then
       the function im_read_dmask() should be used instead.  There is a built-
       in  checking  for all mask members.  If the mask has coefficients which
       are integers or they are floats with the decimal part  equal  to  zero,
       the   function   reads   the  mask  properly  and  puts  the  resultant
       coefficients in a valid INTMASK.  The function returns a pointer to  an
       INTMASK or NULL on error.

       im_scale_dmask()  returns an INTMASK of the DOUBLE MASK m.  The maximum
       value of the DOUBLEMASK is scaled to 100 in  the  returned  mask.   The
       scale  member  of the INTMASK is scaled accordingly to the scale member
       of m.  The function returns a pointer to an INTMASK or NULL on error.

       im_norm_dmask(3) applies the scale and offset members of mask  to  each
       of its coefficients, and then sets them to 1.0 and zero respectively.

       im_write_imask() writes the INTMASK pointed by m to the filename member
       of m.  The function checks whether the filename is valid and it expects
       only  an  INTMASK.   The function returns 0 on success and -1 on error.
       For writing a DOUBLEMASK use im_write_dmask() instead.

       im_write_imask_name() operates as im_write_imask(),  but  the  mask  is
       written to the named file.

       im_write_dmask()  writes  the  DOUBLEMASK  pointed by m to the filename
       member of m.  The function checks whether the filename is valid and  it
       expects  only  an  DOUBLEMASK.   The mask is written in a file with the
       format given above.  The function  uses  fprintf  with  the  conversion
       character %g, to write the non integer mask coefficients.  It returns 0
       on success and -1 on error.

       im_write_dmask_name() operates as im_write_dmask(),  but  the  mask  is
       written to the named file.

SEE ALSO

       im_lindetect(3), im_compass(3), im_conv(3), im_matinv(3).

COPYRIGHT

       N. Dessipris

AUTHOR

       N. Dessipris - 02/05/1991

                                  2 May 1991                    IM_READMASK(3)