libvips/man/im_create_dmask.3

225 lines
6.1 KiB
Groff

.TH IM_READMASK 3 "2 May 1991"
.SH 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
.SH SYNOPSIS
#include <vips/vips.h>
DOUBLEMASK *im_create_dmask( name, xs, ys )
.br
char *name;
.br
int xs, ys;
INTMASK *im_create_imask( name, xs, ys )
.br
char *name;
.br
int xs, ys;
DOUBLEMASK *im_create_dmaskv( name, xs, ys, ... )
.br
char *name;
.br
int xs, ys;
INTMASK *im_create_imaskv( name, xs, ys, ... )
.br
char *name;
.br
int xs, ys;
DOUBLEMASK *im_dup_dmask( m, name )
.br
DOUBLEMASK *m;
.br
char *name;
INTMASK *im_dup_imask( m, name )
.br
INTMASK *m;
.br
char *name;
void im_free_dmask( mask )
.br
DOUBLEMASK *mask;
void im_free_imask( mask )
.br
INTMASK *mask;
DOUBLEMASK *im_read_dmask( name )
.br
char *name;
INTMASK *im_read_imask( name )
.br
char *name;
void im_print_dmask( mask )
.br
DOUBLEMASK *mask;
void im_print_imask( mask )
.br
INTMASK *mask;
INTMASK im_scale_dmask( mask, name )
.br
DOUBLEMASK *mask;
.br
char *name
void im_norm_dmask( DOUBLEMASK *mask );
int im_write_imask( m )
.br
INTMASK *m;
int im_write_imask_name( m, name )
.br
INTMASK *m;
.br
char *name;
int im_write_dmask_name( m, name )
.br
DOUBLEMASK *m;
.br
char *name;
.SH 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.
.B im_norm_dmask(3)
applies the scale and offset members of
.I 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.
.SH SEE ALSO
im_lindetect(3), im_compass(3), im_conv(3), im_matinv(3).
.SH COPYRIGHT
N. Dessipris
.SH AUTHOR
N. Dessipris \- 02/05/1991