1IM_READMASK(3)             Library Functions Manual             IM_READMASK(3)
2
3
4

NAME

6       im_create_dmask,  im_create_imask,  im_create_dmaskv, im_create_imaskv,
7       im_dup_dmask,     im_dup_imask,      im_free_dmask,      im_free_imask,
8       im_print_imask,     im_print_dmask,    im_read_dmask,    im_read_imask,
9       im_scale_dmask, im_write_dmask, im_write_imask - operations  on  double
10       or int masks
11

SYNOPSIS

13       #include <vips/vips.h>
14
15       DOUBLEMASK *im_create_dmask( name, xs, ys )
16       char *name;
17       int xs, ys;
18
19       INTMASK *im_create_imask( name, xs, ys )
20       char *name;
21       int xs, ys;
22
23       DOUBLEMASK *im_create_dmaskv( name, xs, ys, ... )
24       char *name;
25       int xs, ys;
26
27       INTMASK *im_create_imaskv( name, xs, ys, ... )
28       char *name;
29       int xs, ys;
30
31       DOUBLEMASK *im_dup_dmask( m, name )
32       DOUBLEMASK *m;
33       char *name;
34
35       INTMASK *im_dup_imask( m, name )
36       INTMASK *m;
37       char *name;
38
39       void im_free_dmask( mask )
40       DOUBLEMASK *mask;
41
42       void im_free_imask( mask )
43       INTMASK *mask;
44
45       DOUBLEMASK *im_read_dmask( name )
46       char *name;
47
48       INTMASK *im_read_imask( name )
49       char *name;
50
51       void im_print_dmask( mask )
52       DOUBLEMASK *mask;
53
54       void im_print_imask( mask )
55       INTMASK *mask;
56
57       INTMASK im_scale_dmask( mask, name )
58       DOUBLEMASK *mask;
59       char *name
60
61       int im_write_imask( m )
62       INTMASK *m;
63
64       int im_write_imask_name( m, name )
65       INTMASK *m;
66       char *name;
67
68       int im_write_dmask_name( m, name )
69       DOUBLEMASK *m;
70       char *name;
71
72

DESCRIPTION

74       Masks are (see <vips/vips.h>):
75
76        typedef struct {                 typedef struct {
77               int xsize;                    int xsize;
78               int ysize;                    int ysize;
79               int scale;                    double scale;
80               int offset;                   double offset;
81               int *coeff;                   double *coeff;
82               char *filename;               char *filename;
83        } INTMASK ;                      } DOUBLEMASK ;
84
85       By mask files have the following structure:
86
87        x y [scale] [offset]
88        a11 a12 ... a1y
89        a21 a22 ... a2y]
90        ... ... ... ...
91        ax1 ax2 ... axy
92
93       The  mask  sizes  x  and y are always integer whereas all the remaining
94       coefficients are either int for INTMASK and double for the  DOUBLEMASK.
95       All numbers are written in ASCII, for convenience. scale and offset are
96       always optional. If missing, they default to 1 and 0 respectively. This
97       laxity makes mask files useful for matrix operations, see im_matinv(3),
98       etc.
99
100       im_create_dmask() returns an DOUBLEMASK with  the  filename  xsize  and
101       ysize  set to name xs and ys respectively.  The function allocates mem‐
102       ory for the coefficients which are all initialised to zero.  In case of
103       error the function returns NULL.
104
105       im_create_dmaskv()  operates  exactly as im_create_dmask(), except that
106       the mask is initialised by  the  parameters  following  the  width  and
107       height. These parameters must all be doubles. For example:
108
109         DOUBLEMASK *m = im_create_dmaskv( "untitled", 3, 3,
110           1.0, 0.0, 0.0,
111           0.0, 1.0, 0.0,
112           0.0, 0.0, 1.0 );
113
114       creates an identity matrix.
115
116       im_create_imask()  returns an INTMASK with the filename xsize and ysize
117       set to name xs and ys respectively.  The function allocates memory  for
118       the  coefficients  which are all initialised to zero.  In case of error
119       the function returns NULL.
120
121       im_create_imaskv() operates exactly as im_create_imask(),  except  that
122       the  mask  is  initialised  by  the  parameters following the width and
123       height. These parameters must all be ints. For example:
124
125         INTMASK *m = im_create_imaskv( "untitled", 3, 3,
126           1, 0, 0,
127           0, 1, 0,
128           0, 0, 1 );
129
130       creates an identity matrix.
131
132       im_dup_dmask() duplicates the DOUBLEMASK mask pointed by m and  returns
133       a pointer to the new mask.  The filename member of the returned mask is
134       set to the entered name.  The  function  returns  either  a  DOUBLEMASK
135       pointer or NULL on error.
136
137       im_dup_imask()  duplicates  the INTMASK mask pointed by m and returns a
138       pointer to the new mask.  The filename member of the returned  mask  is
139       set  to  the  entered  name.   The  function  returns either an INTMASK
140       pointer or NULL on error.
141
142       im_free_dmask() frees the memory allocated for the DOUBLEMASK mask.
143
144       im_free_imask() frees the memory allocated for the INTMASK mask.
145
146       im_print_dmask() prints at the sterr the DOUBLEMASK pointed by mask.
147
148       im_print_imask() prints at the sterr the INTMASK pointed by mask.
149
150       im_read_dmask() opens the argument name and reads the mask into a  DOU‐
151       BLEMASK  structure.  The function returns a pointer to an DOUBLEMASK or
152       NULL on error.
153
154       im_read_imask() opens the argument name and reads the mask into a  INT‐
155       MASK  structure.   If  the input file has non-integer coefficients then
156       the function im_read_dmask() should be used instead.  There is a built-
157       in  checking  for all mask members.  If the mask has coefficients which
158       are integers or they are floats with the decimal part  equal  to  zero,
159       the  function  reads  the  mask properly and puts the resultant coeffi‐
160       cients in a valid INTMASK.  The function returns a pointer to  an  INT‐
161       MASK or NULL on error.
162
163       im_scale_dmask()  returns an INTMASK of the DOUBLE MASK m.  The maximum
164       value of the DOUBLEMASK is scaled to 100 in  the  returned  mask.   The
165       scale  member  of the INTMASK is scaled accordingly to the scale member
166       of m.  The function returns a pointer to an INTMASK or NULL on error.
167
168       im_write_imask() writes the INTMASK pointed by m to the filename member
169       of m.  The function checks whether the filename is valid and it expects
170       only an INTMASK.  The function returns 0 on success and  -1  on  error.
171       For writing a DOUBLEMASK use im_write_dmask() instead.
172
173       im_write_imask_name()  operates  as  im_write_imask(),  but the mask is
174       written to the named file.
175
176       im_write_dmask() writes the DOUBLEMASK pointed by  m  to  the  filename
177       member  of m.  The function checks whether the filename is valid and it
178       expects only an DOUBLEMASK.  The mask is written in  a  file  with  the
179       format  given  above.   The  function  uses fprintf with the conversion
180       character %g, to write the non integer mask coefficients.  It returns 0
181       on success and -1 on error.
182
183       im_write_dmask_name()  operates  as  im_write_dmask(),  but the mask is
184       written to the named file.
185
186

SEE ALSO

188       im_lindetect(3), im_compass(3), im_conv(3), im_matinv(3).
189
191       N. Dessipris
192

AUTHOR

194       N. Dessipris - 02/05/1991
195
196
197
198                                  2 May 1991                    IM_READMASK(3)
Impressum