gtk-doc for mask
This commit is contained in:
parent
13723a1cec
commit
288d8583ac
@ -16,7 +16,7 @@
|
|||||||
- rewritten im_circle as im_draw_circle, im_circle moved to almostdeprecated
|
- rewritten im_circle as im_draw_circle, im_circle moved to almostdeprecated
|
||||||
- added IM_TYPE_RW args for inplace ops --- nip2 uses this to wrap inplace ops
|
- added IM_TYPE_RW args for inplace ops --- nip2 uses this to wrap inplace ops
|
||||||
automatically
|
automatically
|
||||||
- special-case 3x3 makss in im_conv() for a 20% speedup
|
- special-case 3x3 masks in im_conv() for a 20% speedup
|
||||||
- add IM_TYPE_RW flag for im__rw_image, helps nip2 auto-wrap inplace ops
|
- add IM_TYPE_RW flag for im__rw_image, helps nip2 auto-wrap inplace ops
|
||||||
- im_insertplace() casts and bandalikes
|
- im_insertplace() casts and bandalikes
|
||||||
- copy iconv.m4 and friends in bootstrap, thanks Mike
|
- copy iconv.m4 and friends in bootstrap, thanks Mike
|
||||||
@ -36,6 +36,7 @@
|
|||||||
- im_affine() has a larger safety margin
|
- im_affine() has a larger safety margin
|
||||||
- fix gtk-doc warnings
|
- fix gtk-doc warnings
|
||||||
- small mask load/save improvements
|
- small mask load/save improvements
|
||||||
|
- mask gtk-doc done
|
||||||
|
|
||||||
12/5/10 started 7.22.2
|
12/5/10 started 7.22.2
|
||||||
- the conditional image of ifthenelse can be any format, a (!=0) is added if
|
- the conditional image of ifthenelse can be any format, a (!=0) is added if
|
||||||
|
3
TODO
3
TODO
@ -1,6 +1,3 @@
|
|||||||
- started gtk-doc-ing libvips/mask
|
|
||||||
|
|
||||||
check for maths in gtk-doc ... see im_gauss_dmask()
|
|
||||||
|
|
||||||
|
|
||||||
- maybe im_draw_smudge() is too slow :-( also, we had a sanity failure with
|
- maybe im_draw_smudge() is too slow :-( also, we had a sanity failure with
|
||||||
|
@ -42,13 +42,13 @@
|
|||||||
<xi:include href="xml/freq_filt.xml"/>
|
<xi:include href="xml/freq_filt.xml"/>
|
||||||
<xi:include href="xml/histograms_lut.xml"/>
|
<xi:include href="xml/histograms_lut.xml"/>
|
||||||
<xi:include href="xml/inplace.xml"/>
|
<xi:include href="xml/inplace.xml"/>
|
||||||
|
<xi:include href="xml/mask.xml"/>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<chapter>
|
<chapter>
|
||||||
<title>VIPS operation API by section (no gtkdoc comments yet)</title>
|
<title>VIPS operation API by section (no gtkdoc comments yet)</title>
|
||||||
<xi:include href="xml/morphology.xml"/>
|
<xi:include href="xml/morphology.xml"/>
|
||||||
<xi:include href="xml/resample.xml"/>
|
<xi:include href="xml/resample.xml"/>
|
||||||
<xi:include href="xml/mask.xml"/>
|
|
||||||
<xi:include href="xml/mosaicing.xml"/>
|
<xi:include href="xml/mosaicing.xml"/>
|
||||||
<xi:include href="xml/other.xml"/>
|
<xi:include href="xml/other.xml"/>
|
||||||
<xi:include href="xml/video.xml"/>
|
<xi:include href="xml/video.xml"/>
|
||||||
|
@ -428,13 +428,13 @@ conv_gen( REGION *or, void *vseq, void *a, void *b )
|
|||||||
sum = 0; \
|
sum = 0; \
|
||||||
sum += m[0] * p0[0]; \
|
sum += m[0] * p0[0]; \
|
||||||
sum += m[1] * p0[bands]; \
|
sum += m[1] * p0[bands]; \
|
||||||
sum += m[2] * p0[bands * 2]; \
|
sum += m[2] * p0[bands << 1]; \
|
||||||
sum += m[3] * p1[0]; \
|
sum += m[3] * p1[0]; \
|
||||||
sum += m[4] * p1[bands]; \
|
sum += m[4] * p1[bands]; \
|
||||||
sum += m[5] * p1[bands * 2]; \
|
sum += m[5] * p1[bands << 1]; \
|
||||||
sum += m[6] * p2[0]; \
|
sum += m[6] * p2[0]; \
|
||||||
sum += m[7] * p2[bands]; \
|
sum += m[7] * p2[bands]; \
|
||||||
sum += m[8] * p2[bands * 2]; \
|
sum += m[8] * p2[bands << 1]; \
|
||||||
\
|
\
|
||||||
p0 += 1; \
|
p0 += 1; \
|
||||||
p1 += 1; \
|
p1 += 1; \
|
||||||
@ -462,13 +462,13 @@ conv_gen( REGION *or, void *vseq, void *a, void *b )
|
|||||||
sum = 0; \
|
sum = 0; \
|
||||||
sum += m[0] * p0[0]; \
|
sum += m[0] * p0[0]; \
|
||||||
sum += m[1] * p0[bands]; \
|
sum += m[1] * p0[bands]; \
|
||||||
sum += m[2] * p0[bands * 2]; \
|
sum += m[2] * p0[bands << 1]; \
|
||||||
sum += m[3] * p1[0]; \
|
sum += m[3] * p1[0]; \
|
||||||
sum += m[4] * p1[bands]; \
|
sum += m[4] * p1[bands]; \
|
||||||
sum += m[5] * p1[bands * 2]; \
|
sum += m[5] * p1[bands << 1]; \
|
||||||
sum += m[6] * p2[0]; \
|
sum += m[6] * p2[0]; \
|
||||||
sum += m[7] * p2[bands]; \
|
sum += m[7] * p2[bands]; \
|
||||||
sum += m[8] * p2[bands * 2]; \
|
sum += m[8] * p2[bands << 1]; \
|
||||||
\
|
\
|
||||||
p0 += 1; \
|
p0 += 1; \
|
||||||
p1 += 1; \
|
p1 += 1; \
|
||||||
|
@ -269,6 +269,9 @@ void im_free_dmat();
|
|||||||
|
|
||||||
int im_invmat( double **, int );
|
int im_invmat( double **, int );
|
||||||
|
|
||||||
|
int *im_offsets45( int size );
|
||||||
|
int *im_offsets90( int size );
|
||||||
|
|
||||||
int im_conv_f_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask );
|
int im_conv_f_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask );
|
||||||
int im_convsep_f_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask );
|
int im_convsep_f_raw( IMAGE *in, IMAGE *out, DOUBLEMASK *mask );
|
||||||
|
|
||||||
|
@ -63,16 +63,16 @@ DOUBLEMASK *im_create_dmaskv( const char *filename, int xsize, int ysize, ... );
|
|||||||
INTMASK *im_read_imask( const char *filename );
|
INTMASK *im_read_imask( const char *filename );
|
||||||
DOUBLEMASK *im_read_dmask( const char *filename );
|
DOUBLEMASK *im_read_dmask( const char *filename );
|
||||||
|
|
||||||
void im_print_imask( INTMASK *m );
|
void im_print_imask( INTMASK *in );
|
||||||
void im_print_dmask( DOUBLEMASK *m );
|
void im_print_dmask( DOUBLEMASK *in );
|
||||||
|
|
||||||
int im_write_imask( INTMASK *m );
|
int im_write_imask( INTMASK *in );
|
||||||
int im_write_dmask( DOUBLEMASK *m );
|
int im_write_dmask( DOUBLEMASK *in );
|
||||||
int im_write_imask_name( INTMASK *m, const char *filename );
|
int im_write_imask_name( INTMASK *in, const char *filename );
|
||||||
int im_write_dmask_name( DOUBLEMASK *m, const char *filename );
|
int im_write_dmask_name( DOUBLEMASK *in, const char *filename );
|
||||||
|
|
||||||
int im_free_imask( INTMASK *m );
|
int im_free_imask( INTMASK *in );
|
||||||
int im_free_dmask( DOUBLEMASK *m );
|
int im_free_dmask( DOUBLEMASK *in );
|
||||||
|
|
||||||
INTMASK *im_log_imask( const char *filename, double sigma, double min_ampl );
|
INTMASK *im_log_imask( const char *filename, double sigma, double min_ampl );
|
||||||
DOUBLEMASK *im_log_dmask( const char *filename, double sigma, double min_ampl );
|
DOUBLEMASK *im_log_dmask( const char *filename, double sigma, double min_ampl );
|
||||||
@ -83,20 +83,19 @@ INTMASK *im_gauss_imask_sep( const char *filename,
|
|||||||
DOUBLEMASK *im_gauss_dmask( const char *filename,
|
DOUBLEMASK *im_gauss_dmask( const char *filename,
|
||||||
double sigma, double min_ampl );
|
double sigma, double min_ampl );
|
||||||
|
|
||||||
INTMASK *im_dup_imask( INTMASK *m, const char *filename );
|
INTMASK *im_dup_imask( INTMASK *in, const char *filename );
|
||||||
DOUBLEMASK *im_dup_dmask( DOUBLEMASK *m, const char *filename );
|
DOUBLEMASK *im_dup_dmask( DOUBLEMASK *in, const char *filename );
|
||||||
|
|
||||||
INTMASK *im_scale_dmask( DOUBLEMASK *m, const char *filename );
|
INTMASK *im_scale_dmask( DOUBLEMASK *in, const char *filename );
|
||||||
void im_norm_dmask( DOUBLEMASK *mask );
|
void im_norm_dmask( DOUBLEMASK *mask );
|
||||||
int *im_offsets45( int size );
|
INTMASK *im_rotate_imask90( INTMASK *in, const char *filename );
|
||||||
int *im_offsets90( int size );
|
INTMASK *im_rotate_imask45( INTMASK *in, const char *filename );
|
||||||
INTMASK *im_rotate_imask90( INTMASK *m, const char *filename );
|
DOUBLEMASK *im_rotate_dmask90( DOUBLEMASK *in, const char *filename );
|
||||||
INTMASK *im_rotate_imask45( INTMASK *m, const char *filename );
|
DOUBLEMASK *im_rotate_dmask45( DOUBLEMASK *in, const char *filename );
|
||||||
DOUBLEMASK *im_rotate_dmask90( DOUBLEMASK *m, const char *filename );
|
|
||||||
DOUBLEMASK *im_rotate_dmask45( DOUBLEMASK *m, const char *filename );
|
|
||||||
|
|
||||||
DOUBLEMASK *im_mattrn( DOUBLEMASK *in, const char *filename );
|
DOUBLEMASK *im_mattrn( DOUBLEMASK *in, const char *filename );
|
||||||
DOUBLEMASK *im_matcat( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *filename );
|
DOUBLEMASK *im_matcat( DOUBLEMASK *top, DOUBLEMASK *bottom,
|
||||||
|
const char *filename );
|
||||||
DOUBLEMASK *im_matmul( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *filename );
|
DOUBLEMASK *im_matmul( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *filename );
|
||||||
|
|
||||||
DOUBLEMASK *im_lu_decomp( const DOUBLEMASK *mat, const char *filename );
|
DOUBLEMASK *im_lu_decomp( const DOUBLEMASK *mat, const char *filename );
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
/* generate gaussian masks
|
/* generate gaussian masks
|
||||||
*/
|
*
|
||||||
|
* Written on: 30/11/1989 by Nicos
|
||||||
/* Written on: 30/11/1989 by Nicos
|
|
||||||
* Updated on: 6/12/1991
|
* Updated on: 6/12/1991
|
||||||
* 7/8/96 JC
|
* 7/8/96 JC
|
||||||
* - ansified, mem leaks plugged
|
* - ansified, mem leaks plugged
|
||||||
|
@ -1,27 +1,6 @@
|
|||||||
/* @(#) Returns a circularly symmetric difference of Gaussian mask
|
/* laplacian of gaussian
|
||||||
* @(#) min_amplitude should be greater than 0.0 and less than 1.0
|
*
|
||||||
* @(#) min_amplitude determines the size of the mask; if for instance
|
* Written on: 30/11/1989
|
||||||
* @(#) the value .1 is entered this means that the produced mask is clipped
|
|
||||||
* @(#) at values less than 10 percent of the minimum negative amplitude.
|
|
||||||
* @(#) If the value of min_amplitude is too small, then the filter coefficients
|
|
||||||
* @(#) are calculated for masksize equal to the min of 8 * sigma or 256.
|
|
||||||
* @(#) The mask can be directly used with the vasari convolution programs,
|
|
||||||
* @(#) the default offset set is 0
|
|
||||||
* @(#)
|
|
||||||
* @(#) DOUBLEMASK *im_log_dmask( filename, sigma, min_amplitude )
|
|
||||||
* @(#) char *filename;
|
|
||||||
* @(#) double sigma, min_amplitude;
|
|
||||||
* @(#)
|
|
||||||
* @(#) Returns a laplacian of Gaussian square double mask or NULL on error
|
|
||||||
* @(#)
|
|
||||||
* @(#) DOUBLEMASK *im_log_imask( filename, sigma, min_amplitude )
|
|
||||||
* @(#) char *filename;
|
|
||||||
* @(#) double sigma, min_amplitude;
|
|
||||||
* @(#)
|
|
||||||
* @(#) Returns a laplacian of Gaussian square int mask or NULL on error
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Written on: 30/11/1989
|
|
||||||
* Updated on: 6/12/1991
|
* Updated on: 6/12/1991
|
||||||
* 7/8/96 JC
|
* 7/8/96 JC
|
||||||
* - ansified, mem leaks plugged
|
* - ansified, mem leaks plugged
|
||||||
@ -31,6 +10,8 @@
|
|||||||
* - ahem, was broken since '96, thanks matt
|
* - ahem, was broken since '96, thanks matt
|
||||||
* 16/7/03 JC
|
* 16/7/03 JC
|
||||||
* - makes mask out to zero, not out to minimum, thanks again matt
|
* - makes mask out to zero, not out to minimum, thanks again matt
|
||||||
|
* 22/10/10
|
||||||
|
* - gtkdoc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -80,6 +61,34 @@
|
|||||||
|
|
||||||
#define IM_MAXMASK 256
|
#define IM_MAXMASK 256
|
||||||
|
|
||||||
|
/**
|
||||||
|
* im_log_dmask:
|
||||||
|
* @filename: the returned mask has this set as the filename
|
||||||
|
* @sigma: standard deviation of mask
|
||||||
|
* @min_ampl: minimum amplitude
|
||||||
|
*
|
||||||
|
* im_log_dmask() creates a circularly symmetric Laplacian of Gaussian mask
|
||||||
|
* of radius
|
||||||
|
* @sigma. The size of the mask is determined by the variable @min_ampl;
|
||||||
|
* if for instance the value .1 is entered this means that the produced mask
|
||||||
|
* is clipped at values within 10 persent of zero, and where the change
|
||||||
|
* between mask elements is less than 10%.
|
||||||
|
*
|
||||||
|
* The program uses the following equation: (from Handbook of Pattern
|
||||||
|
* Recognition and image processing by Young and Fu, AP 1986 pages 220-221):
|
||||||
|
*
|
||||||
|
* H(r) = (1 / (2 * M_PI * s4)) *
|
||||||
|
* (2 - (r2 / s2)) *
|
||||||
|
* exp(-r2 / (2 * s2))
|
||||||
|
*
|
||||||
|
* where s2 = sigma * sigma, s4 = s2 * s2, r2 = r * r.
|
||||||
|
*
|
||||||
|
* The generated mask has odd size and its maximum value is normalised to 1.0.
|
||||||
|
*
|
||||||
|
* See also: im_log_imask(), im_gauss_dmask(), im_conv().
|
||||||
|
*
|
||||||
|
* Returns: the calculated mask on success, or NULL on error.
|
||||||
|
*/
|
||||||
DOUBLEMASK *
|
DOUBLEMASK *
|
||||||
im_log_dmask( const char *filename, double sigma, double min_ampl )
|
im_log_dmask( const char *filename, double sigma, double min_ampl )
|
||||||
{
|
{
|
||||||
@ -135,8 +144,10 @@ im_log_dmask( const char *filename, double sigma, double min_ampl )
|
|||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
xm2 = x; ym2 = x;
|
xm2 = x;
|
||||||
xm = xm2 * 2 + 1; ym = ym2 * 2 + 1;
|
ym2 = x;
|
||||||
|
xm = xm2 * 2 + 1;
|
||||||
|
ym = ym2 * 2 + 1;
|
||||||
|
|
||||||
if( !(cfs = IM_ARRAY( NULL, (xm2 + 1) * (ym2 + 1), double )) )
|
if( !(cfs = IM_ARRAY( NULL, (xm2 + 1) * (ym2 + 1), double )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
@ -201,6 +212,19 @@ im_log_dmask( const char *filename, double sigma, double min_ampl )
|
|||||||
return( m );
|
return( m );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* im_log_imask:
|
||||||
|
* @filename: the returned mask has this set as the filename
|
||||||
|
* @sigma: standard deviation of mask
|
||||||
|
* @min_ampl: minimum amplitude
|
||||||
|
*
|
||||||
|
* im_log_imask() works exactly as im_log_dmask(), but the returned mask
|
||||||
|
* is scaled so that it's maximum value it set to 100.
|
||||||
|
*
|
||||||
|
* See also: im_log_dmask(), im_gauss_imask(), im_conv().
|
||||||
|
*
|
||||||
|
* Returns: the calculated mask on success, or NULL on error.
|
||||||
|
*/
|
||||||
INTMASK *
|
INTMASK *
|
||||||
im_log_imask( const char *filename, double sigma, double min_ampl )
|
im_log_imask( const char *filename, double sigma, double min_ampl )
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/* @(#) combine two masks. Result mask is made and returned.
|
/* matrix catenate
|
||||||
* @(#) Pass in the name to set in the creation of the mask.
|
|
||||||
* @(#) DOUBLEMASK *
|
|
||||||
* @(#) im_matcat( in1, in2, name );
|
|
||||||
* @(#) DOUBLEMASK *in1, *in2;
|
|
||||||
* @(#) char *name;
|
|
||||||
* @(#)
|
|
||||||
* @(#) return NULL for error.
|
|
||||||
*
|
*
|
||||||
* 1994, K. Martinez
|
* 1994, K. Martinez
|
||||||
|
*
|
||||||
|
* 22/10/10
|
||||||
|
* - gtk-doc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -50,39 +46,49 @@
|
|||||||
#include <dmalloc.h>
|
#include <dmalloc.h>
|
||||||
#endif /*WITH_DMALLOC*/
|
#endif /*WITH_DMALLOC*/
|
||||||
|
|
||||||
/* MATRIX concatenate (join columns ie add mask to bottom of another)
|
/**
|
||||||
|
* im_matcat:
|
||||||
|
* @top: input matrix
|
||||||
|
* @bottom: input matrix
|
||||||
|
* @filename: filename for output
|
||||||
|
*
|
||||||
|
* Matrix catenations. Returns a new matrix which is the two source matrices
|
||||||
|
* joined together top-bottom. They must be the same width.
|
||||||
|
*
|
||||||
|
* See also: im_mattrn(), im_matmul(), im_matinv().
|
||||||
|
*
|
||||||
|
* Returns: the joined mask on success, or NULL on error.
|
||||||
*/
|
*/
|
||||||
DOUBLEMASK *
|
DOUBLEMASK *
|
||||||
im_matcat( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *name )
|
im_matcat( DOUBLEMASK *top, DOUBLEMASK *bottom, const char *filename )
|
||||||
{
|
{
|
||||||
int newxsize, newysize;
|
int newxsize, newysize;
|
||||||
DOUBLEMASK *mat;
|
DOUBLEMASK *mat;
|
||||||
double *out;
|
double *out;
|
||||||
|
|
||||||
/* matrices must be same width
|
/* matrices must be same width
|
||||||
*/
|
*/
|
||||||
if( in1->xsize != in2->xsize ) {
|
if( top->xsize != bottom->xsize ) {
|
||||||
im_error( "im_matcat", "%s", _( "matrices must be same width" ) );
|
im_error( "im_matcat", "%s",
|
||||||
|
_( "matrices must be same width" ) );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
newxsize = in1->xsize;
|
newxsize = top->xsize;
|
||||||
newysize = in1->ysize + in2->ysize;
|
newysize = top->ysize + bottom->ysize;
|
||||||
|
|
||||||
/* Allocate output matrix.
|
/* Allocate output matrix.
|
||||||
*/
|
*/
|
||||||
if( !(mat = im_create_dmask( name, newxsize, newysize )) ) {
|
if( !(mat = im_create_dmask( filename, newxsize, newysize )) )
|
||||||
im_error( "im_matcat", "%s", _( "unable to allocate output matrix" ) );
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
|
||||||
|
|
||||||
/* copy first matrix then add second on the end
|
/* copy first matrix then add second on the end
|
||||||
*/
|
*/
|
||||||
memcpy( mat->coeff, in1->coeff,
|
memcpy( mat->coeff, top->coeff,
|
||||||
in1->xsize * in1->ysize * sizeof( double ) );
|
top->xsize * top->ysize * sizeof( double ) );
|
||||||
out = mat->coeff + in1->xsize * in1->ysize;
|
out = mat->coeff + top->xsize * top->ysize;
|
||||||
memcpy( out, in2->coeff,
|
memcpy( out, bottom->coeff,
|
||||||
in2->xsize * in2->ysize * sizeof( double ) );
|
bottom->xsize * bottom->ysize * sizeof( double ) );
|
||||||
|
|
||||||
return( mat );
|
return( mat );
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,4 @@
|
|||||||
/* @(#) Allocate, and return a pointer to, a DOUBLEMASK representing the LU
|
/* solve and invert matrices
|
||||||
* @(#) decomposition of the matrix in DOUBLEMASK *mat. Give it the filename
|
|
||||||
* @(#) member *name. Returns NULL on error. Scale and offset are ignored.
|
|
||||||
* @(#)
|
|
||||||
* @(#) DOUBLEMASK *im_lu_decomp( const DOUBLEMASK *mat, const char *name );
|
|
||||||
* @(#)
|
|
||||||
* @(#) Solve the system of linear equations Ax=b, where matrix A has already
|
|
||||||
* @(#) been decomposed into LU form in DOUBLEMASK *lu. Input vector b is in
|
|
||||||
* @(#) vec and is overwritten with vector x.
|
|
||||||
* @(#)
|
|
||||||
* @(#) int im_lu_solve( const DOUBLEMASK *lu, double *vec );
|
|
||||||
* @(#)
|
|
||||||
* @(#) Allocate, and return a pointer to, a DOUBLEMASK representing the
|
|
||||||
* @(#) inverse of the matrix represented in mat. Give it the filename
|
|
||||||
* @(#) member *name. Returns NULL on error. Scale and offset are ignored.
|
|
||||||
* @(#)
|
|
||||||
* @(#) DOUBLEMASK *im_matinv( const DOUBLEMASK *mat, const char *name );
|
|
||||||
* @(#)
|
|
||||||
* @(#) Invert the matrix represented by the DOUBLEMASK *mat, and store
|
|
||||||
* @(#) it in the place of *mat. Returns -1 on error. Scale and offset
|
|
||||||
* @(#) are ignored.
|
|
||||||
* @(#)
|
|
||||||
* @(#) int im_matinv_inplace( DOUBLEMASK *mat );
|
|
||||||
*
|
*
|
||||||
* Author: Tom Vajzovic
|
* Author: Tom Vajzovic
|
||||||
* Copyright: 2006, Tom Vajzovic
|
* Copyright: 2006, Tom Vajzovic
|
||||||
@ -31,6 +9,9 @@
|
|||||||
*
|
*
|
||||||
* 2006-09-08 tcv:
|
* 2006-09-08 tcv:
|
||||||
* - complete rewrite; algorithm unchanged
|
* - complete rewrite; algorithm unchanged
|
||||||
|
*
|
||||||
|
* 22/10/10
|
||||||
|
* - gtkdoc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -108,29 +89,41 @@ mat_inv_direct(
|
|||||||
|
|
||||||
/** EXPORTED FUNCTION DEFINITIONS **/
|
/** EXPORTED FUNCTION DEFINITIONS **/
|
||||||
|
|
||||||
DOUBLEMASK *
|
/**
|
||||||
im_lu_decomp(
|
* im_lu_decomp:
|
||||||
const DOUBLEMASK *mat,
|
* @mat: matrix to decompose
|
||||||
const char *name
|
* @filename: name for output matrix
|
||||||
){
|
*
|
||||||
#define FUNCTION_NAME "im_lu_decomp"
|
* This function takes any square NxN #DOUBLEMASK.
|
||||||
/* This function takes any square NxN DOUBLEMASK treats it as a matrix.
|
* It returns a #DOUBLEMASK which is (N+1)xN.
|
||||||
* It allocates a DOUBLEMASK which is (N+1)xN.
|
|
||||||
*
|
*
|
||||||
* It calculates the PLU decomposition, storing the upper and diagonal parts
|
* It calculates the PLU decomposition, storing the upper and diagonal parts
|
||||||
* of U, together with the lower parts of L, as an NxN matrix in the first
|
* of U, together with the lower parts of L, as an NxN matrix in the first
|
||||||
* N rows of the new matrix. The diagonal parts of L are all set to unity
|
* N rows of the new matrix. The diagonal parts of L are all set to unity
|
||||||
* and are not stored.
|
* and are not stored.
|
||||||
*
|
*
|
||||||
* The final row of the new DOUBLEMASK has only integer entries, which
|
* The final row of the new #DOUBLEMASK has only integer entries, which
|
||||||
* represent the row-wise permutations made by the permuatation matrix P.
|
* represent the row-wise permutations made by the permuatation matrix P.
|
||||||
*
|
*
|
||||||
* The scale and offset members of the input DOUBLEMASK are ignored.
|
* The scale and offset members of the input #DOUBLEMASK are ignored.
|
||||||
*
|
*
|
||||||
* See:
|
* See:
|
||||||
* PRESS, W. et al, 1992. Numerical Recipies in C; The Art of Scientific
|
*
|
||||||
* Computing, 2nd ed. Cambridge: Cambridge University Press, pp. 43-50.
|
* PRESS, W. et al, 1992. Numerical Recipies in C; The Art of Scientific
|
||||||
|
* Computing, 2nd ed. Cambridge: Cambridge University Press, pp. 43-50.
|
||||||
|
*
|
||||||
|
* See also: im_mattrn(), im_matinv().
|
||||||
|
*
|
||||||
|
* Returns: the decomposed matrix on success, or NULL on error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DOUBLEMASK *
|
||||||
|
im_lu_decomp(
|
||||||
|
const DOUBLEMASK *mat,
|
||||||
|
const char *name
|
||||||
|
){
|
||||||
|
#define FUNCTION_NAME "im_lu_decomp"
|
||||||
|
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
double *row_scale;
|
double *row_scale;
|
||||||
DOUBLEMASK *lu;
|
DOUBLEMASK *lu;
|
||||||
@ -244,6 +237,25 @@ im_lu_decomp(
|
|||||||
#undef FUNCTION_NAME
|
#undef FUNCTION_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* im_lu_solve:
|
||||||
|
* @lu: matrix to solve
|
||||||
|
* @vec: name for output matrix
|
||||||
|
*
|
||||||
|
* Solve the system of linear equations Ax=b, where matrix A has already
|
||||||
|
* been decomposed into LU form in DOUBLEMASK *lu. Input vector b is in
|
||||||
|
* vec and is overwritten with vector x.
|
||||||
|
*
|
||||||
|
* See:
|
||||||
|
*
|
||||||
|
* PRESS, W. et al, 1992. Numerical Recipies in C; The Art of Scientific
|
||||||
|
* Computing, 2nd ed. Cambridge: Cambridge University Press, pp. 43-50.
|
||||||
|
*
|
||||||
|
* See also: im_mattrn(), im_matinv().
|
||||||
|
*
|
||||||
|
* Returns: the decomposed matrix on success, or NULL on error.
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
im_lu_solve(
|
im_lu_solve(
|
||||||
const DOUBLEMASK *lu,
|
const DOUBLEMASK *lu,
|
||||||
@ -287,10 +299,23 @@ im_lu_solve(
|
|||||||
#undef FUNCTION_NAME
|
#undef FUNCTION_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* im_matinv:
|
||||||
|
* @mat: matrix to invert
|
||||||
|
* @filename: name for output matrix
|
||||||
|
*
|
||||||
|
* Allocate, and return a pointer to, a DOUBLEMASK representing the
|
||||||
|
* inverse of the matrix represented in @mat. Give it the filename
|
||||||
|
* member @filename. Returns NULL on error. Scale and offset are ignored.
|
||||||
|
*
|
||||||
|
* See also: im_mattrn().
|
||||||
|
*
|
||||||
|
* Returns: the inverted matrix on success, or %NULL on error.
|
||||||
|
*/
|
||||||
DOUBLEMASK *
|
DOUBLEMASK *
|
||||||
im_matinv(
|
im_matinv(
|
||||||
const DOUBLEMASK *mat,
|
const DOUBLEMASK *mat,
|
||||||
const char *name
|
const char *filename
|
||||||
){
|
){
|
||||||
#define FUNCTION_NAME "im_matinv"
|
#define FUNCTION_NAME "im_matinv"
|
||||||
|
|
||||||
@ -301,7 +326,7 @@ im_matinv(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#define N ( mat -> xsize )
|
#define N ( mat -> xsize )
|
||||||
inv= im_create_dmask( name, N, N );
|
inv= im_create_dmask( filename, N, N );
|
||||||
if( ! inv )
|
if( ! inv )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -328,6 +353,18 @@ im_matinv(
|
|||||||
#undef FUNCTION_NAME
|
#undef FUNCTION_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* im_matinv_inplace:
|
||||||
|
* @mat: matrix to invert
|
||||||
|
*
|
||||||
|
* Invert the matrix represented by the DOUBLEMASK @mat, and store
|
||||||
|
* it in the place of @mat. Scale and offset
|
||||||
|
* are ignored.
|
||||||
|
*
|
||||||
|
* See also: im_mattrn().
|
||||||
|
*
|
||||||
|
* Returns: 0 on success, or -1 on error.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
im_matinv_inplace(
|
im_matinv_inplace(
|
||||||
DOUBLEMASK *mat
|
DOUBLEMASK *mat
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
/* @(#) Multiplies two DOUBLEMASKs. Result matrix is made and returned.
|
/* Multiply two matrices.
|
||||||
* @(#) Pass the filename to set for the output.
|
|
||||||
* @(#)
|
|
||||||
* @(#) DOUBLEMASK *
|
|
||||||
* @(#) im_matmul( in1, in2, name )
|
|
||||||
* @(#) DOUBLEMASK *in1, *in2;
|
|
||||||
* @(#) char *name;
|
|
||||||
* @(#)
|
|
||||||
* @(#) NULL for error.
|
|
||||||
*
|
*
|
||||||
* Copyright: 1990, K. Martinez and J. Cupitt
|
* Copyright: 1990, K. Martinez and J. Cupitt
|
||||||
*
|
*
|
||||||
|
* 23/10/10
|
||||||
|
* - gtk-doc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -51,7 +45,20 @@
|
|||||||
#include <dmalloc.h>
|
#include <dmalloc.h>
|
||||||
#endif /*WITH_DMALLOC*/
|
#endif /*WITH_DMALLOC*/
|
||||||
|
|
||||||
/* MATRIX MULTIPLY?
|
/**
|
||||||
|
* im_matmul:
|
||||||
|
* @in1: input matrix
|
||||||
|
* @in2: input matrix
|
||||||
|
* @filename: name for output matrix
|
||||||
|
*
|
||||||
|
* Multiplies two DOUBLEMASKs. Result matrix is made and returned.
|
||||||
|
* Pass the filename to set for the output.
|
||||||
|
*
|
||||||
|
* The scale and offset members of @in1 and @in2 are ignored.
|
||||||
|
*
|
||||||
|
* See also: im_mattrn(), im_matinv().
|
||||||
|
*
|
||||||
|
* Returns: the result matrix on success, or %NULL on error.
|
||||||
*/
|
*/
|
||||||
DOUBLEMASK *
|
DOUBLEMASK *
|
||||||
im_matmul( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *name )
|
im_matmul( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *name )
|
||||||
@ -71,10 +78,8 @@ im_matmul( DOUBLEMASK *in1, DOUBLEMASK *in2, const char *name )
|
|||||||
|
|
||||||
/* Allocate output matrix.
|
/* Allocate output matrix.
|
||||||
*/
|
*/
|
||||||
if( !(mat = im_create_dmask( name, in2->xsize, in1->ysize )) ) {
|
if( !(mat = im_create_dmask( name, in2->xsize, in1->ysize )) )
|
||||||
im_error( "im_matmul", "%s", _( "unable to allocate output mask" ) );
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
|
||||||
|
|
||||||
/* Multiply.
|
/* Multiply.
|
||||||
*/
|
*/
|
||||||
|
@ -1,12 +1,4 @@
|
|||||||
/* @(#) Transpose a mask. Result mask is made and returned. Pass in the name
|
/* matrix transpose
|
||||||
* @(#) to set for the output mask.
|
|
||||||
* @(#)
|
|
||||||
* @(#) DOUBLEMASK *
|
|
||||||
* @(#) im_mattrn( in, name );
|
|
||||||
* @(#) DOUBLEMASK *in;
|
|
||||||
* @(#) char *name;
|
|
||||||
* @(#)
|
|
||||||
* @(#) NULL for error.
|
|
||||||
*
|
*
|
||||||
* Copyright: 1990, K. Martinez and J. Cupitt
|
* Copyright: 1990, K. Martinez and J. Cupitt
|
||||||
*
|
*
|
||||||
@ -51,7 +43,17 @@
|
|||||||
#include <dmalloc.h>
|
#include <dmalloc.h>
|
||||||
#endif /*WITH_DMALLOC*/
|
#endif /*WITH_DMALLOC*/
|
||||||
|
|
||||||
/* MATRIX TRANSPOSE??
|
/**
|
||||||
|
* im_mattrn:
|
||||||
|
* @in: input matrix
|
||||||
|
* @filename: name for output matrix
|
||||||
|
*
|
||||||
|
* Transposes the input matrix.
|
||||||
|
* Pass the filename to set for the output.
|
||||||
|
*
|
||||||
|
* See also: im_matmul(), im_matinv().
|
||||||
|
*
|
||||||
|
* Returns: the result matrix on success, or %NULL on error.
|
||||||
*/
|
*/
|
||||||
DOUBLEMASK *
|
DOUBLEMASK *
|
||||||
im_mattrn( DOUBLEMASK *in, const char *name )
|
im_mattrn( DOUBLEMASK *in, const char *name )
|
||||||
@ -62,10 +64,10 @@ im_mattrn( DOUBLEMASK *in, const char *name )
|
|||||||
|
|
||||||
/* Allocate output matrix.
|
/* Allocate output matrix.
|
||||||
*/
|
*/
|
||||||
if( !(mat = im_create_dmask( name, in->ysize, in->xsize )) ) {
|
if( !(mat = im_create_dmask( name, in->ysize, in->xsize )) )
|
||||||
im_error( "im_mattrn", "%s", _( "unable to allocate output matrix" ) );
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
mat->scale = in->scale;
|
||||||
|
mat->offset = in->offset;
|
||||||
|
|
||||||
/* Transpose.
|
/* Transpose.
|
||||||
*/
|
*/
|
||||||
|
@ -182,7 +182,6 @@ im_offsets45( int size )
|
|||||||
return( pnt );
|
return( pnt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Creates the offsets to rotate any mask by 90 degrees.
|
/* Creates the offsets to rotate any mask by 90 degrees.
|
||||||
*/
|
*/
|
||||||
int *
|
int *
|
||||||
@ -275,38 +274,74 @@ rotimask( offset_fn fn, INTMASK *m, const char *name )
|
|||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a mask which is the argument mask rotated by 90 degrees. Filename
|
/**
|
||||||
* of the returned mask is name.
|
* im_rotate_dmask90:
|
||||||
|
* @in: input matrix
|
||||||
|
* @filename: name for output matrix
|
||||||
|
*
|
||||||
|
* Returns a mask which is the argument mask rotated by 90 degrees.
|
||||||
|
* Pass the filename to set for the output.
|
||||||
|
*
|
||||||
|
* See also: im_rotate_dmask45().
|
||||||
|
*
|
||||||
|
* Returns: the result matrix on success, or %NULL on error.
|
||||||
*/
|
*/
|
||||||
DOUBLEMASK *
|
DOUBLEMASK *
|
||||||
im_rotate_dmask90( DOUBLEMASK *m, const char *name )
|
im_rotate_dmask90( DOUBLEMASK *in, const char *filename )
|
||||||
{
|
{
|
||||||
return( rotdmask( im_offsets90, m, name ) );
|
return( rotdmask( im_offsets90, in, filename ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a mask which is the argument mask rotated by 45 degrees. Filename
|
/**
|
||||||
* of the returned mask is name.
|
* im_rotate_dmask45:
|
||||||
|
* @in: input matrix
|
||||||
|
* @filename: name for output matrix
|
||||||
|
*
|
||||||
|
* Returns a mask which is the argument mask rotated by 45 degrees.
|
||||||
|
* Pass the filename to set for the output.
|
||||||
|
*
|
||||||
|
* See also: im_rotate_dmask90().
|
||||||
|
*
|
||||||
|
* Returns: the result matrix on success, or %NULL on error.
|
||||||
*/
|
*/
|
||||||
DOUBLEMASK *
|
DOUBLEMASK *
|
||||||
im_rotate_dmask45( DOUBLEMASK *m, const char *name )
|
im_rotate_dmask45( DOUBLEMASK *in, const char *filename )
|
||||||
{
|
{
|
||||||
return( rotdmask( im_offsets45, m, name ) );
|
return( rotdmask( im_offsets45, in, filename ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a mask which is the argument mask rotated by 90 degrees. Filename
|
/**
|
||||||
* of the returned mask is name.
|
* im_rotate_imask90:
|
||||||
|
* @in: input matrix
|
||||||
|
* @filename: name for output matrix
|
||||||
|
*
|
||||||
|
* Returns a mask which is the argument mask rotated by 90 degrees.
|
||||||
|
* Pass the filename to set for the output.
|
||||||
|
*
|
||||||
|
* See also: im_rotate_imask45().
|
||||||
|
*
|
||||||
|
* Returns: the result matrix on success, or %NULL on error.
|
||||||
*/
|
*/
|
||||||
INTMASK *
|
INTMASK *
|
||||||
im_rotate_imask90( INTMASK *m, const char *name )
|
im_rotate_imask90( INTMASK *in, const char *filename )
|
||||||
{
|
{
|
||||||
return( rotimask( im_offsets90, m, name ) );
|
return( rotimask( im_offsets90, in, filename ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns a mask which is the argument mask rotated by 45 degrees. Filename
|
/**
|
||||||
* of the returned mask is name.
|
* im_rotate_imask45:
|
||||||
|
* @in: input matrix
|
||||||
|
* @filename: name for output matrix
|
||||||
|
*
|
||||||
|
* Returns a mask which is the argument mask rotated by 45 degrees.
|
||||||
|
* Pass the filename to set for the output.
|
||||||
|
*
|
||||||
|
* See also: im_rotate_imask90().
|
||||||
|
*
|
||||||
|
* Returns: the result matrix on success, or %NULL on error.
|
||||||
*/
|
*/
|
||||||
INTMASK *
|
INTMASK *
|
||||||
im_rotate_imask45( INTMASK *m, const char *name )
|
im_rotate_imask45( INTMASK *in, const char *filename )
|
||||||
{
|
{
|
||||||
return( rotimask( im_offsets45, m, name ) );
|
return( rotimask( im_offsets45, in, filename ) );
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* im_free_imask:
|
* im_free_imask:
|
||||||
* @m: mask to free
|
* @in: mask to free
|
||||||
*
|
*
|
||||||
* Free mask structure and any attached arrays. Return zero, so we can use
|
* Free mask structure and any attached arrays. Return zero, so we can use
|
||||||
* these functions as close callbacks.
|
* these functions as close callbacks.
|
||||||
@ -166,23 +166,21 @@
|
|||||||
* Returns: zero.
|
* Returns: zero.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
im_free_imask( INTMASK *m )
|
im_free_imask( INTMASK *in )
|
||||||
{
|
{
|
||||||
if( ! m )
|
if( !in )
|
||||||
return 0;
|
return( 0 );
|
||||||
|
|
||||||
if( m->coeff )
|
IM_FREE( in->coeff );
|
||||||
im_free( m->coeff );
|
IM_FREE( in->filename );
|
||||||
if( m->filename )
|
IM_FREE( in );
|
||||||
im_free( m->filename );
|
|
||||||
im_free( m );
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* im_free_dmask:
|
* im_free_dmask:
|
||||||
* @m: mask to free
|
* @in: mask to free
|
||||||
*
|
*
|
||||||
* Free mask structure and any attached arrays. Return zero, so we can use
|
* Free mask structure and any attached arrays. Return zero, so we can use
|
||||||
* these functions as close callbacks.
|
* these functions as close callbacks.
|
||||||
@ -192,16 +190,14 @@ im_free_imask( INTMASK *m )
|
|||||||
* Returns: zero.
|
* Returns: zero.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
im_free_dmask( DOUBLEMASK *m )
|
im_free_dmask( DOUBLEMASK *in )
|
||||||
{
|
{
|
||||||
if( ! m )
|
if( !in )
|
||||||
return 0;
|
return( 0 );
|
||||||
|
|
||||||
if( m->coeff )
|
IM_FREE( in->coeff );
|
||||||
im_free( m->coeff );
|
IM_FREE( in->filename );
|
||||||
if( m->filename )
|
IM_FREE( in );
|
||||||
im_free( m->filename );
|
|
||||||
im_free( m );
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -221,7 +217,7 @@ im_free_dmask( DOUBLEMASK *m )
|
|||||||
INTMASK *
|
INTMASK *
|
||||||
im_create_imask( const char *filename, int xsize, int ysize )
|
im_create_imask( const char *filename, int xsize, int ysize )
|
||||||
{
|
{
|
||||||
INTMASK *m;
|
INTMASK *out;
|
||||||
int size = xsize * ysize;
|
int size = xsize * ysize;
|
||||||
|
|
||||||
/* Check args.
|
/* Check args.
|
||||||
@ -233,28 +229,28 @@ im_create_imask( const char *filename, int xsize, int ysize )
|
|||||||
|
|
||||||
/* Allocate and initialise structure.
|
/* Allocate and initialise structure.
|
||||||
*/
|
*/
|
||||||
if( !(m = IM_NEW( NULL, INTMASK )) )
|
if( !(out = IM_NEW( NULL, INTMASK )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
m->coeff = NULL;
|
out->coeff = NULL;
|
||||||
m->filename = NULL;
|
out->filename = NULL;
|
||||||
m->scale = 1;
|
out->scale = 1;
|
||||||
m->offset = 0;
|
out->offset = 0;
|
||||||
m->xsize = 0;
|
out->xsize = 0;
|
||||||
m->ysize = 0;
|
out->ysize = 0;
|
||||||
|
|
||||||
if( !(m->coeff = IM_ARRAY( NULL, size, int )) ) {
|
if( !(out->coeff = IM_ARRAY( NULL, size, int )) ) {
|
||||||
im_free_imask( m );
|
im_free_imask( out );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
(void) memset( (char *) m->coeff, 0, size * sizeof( int ) );
|
(void) memset( (char *) out->coeff, 0, size * sizeof( int ) );
|
||||||
if( !(m->filename = im_strdup( NULL, filename )) ) {
|
if( !(out->filename = im_strdup( NULL, filename )) ) {
|
||||||
im_free_imask( m );
|
im_free_imask( out );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
m->xsize = xsize;
|
out->xsize = xsize;
|
||||||
m->ysize = ysize;
|
out->ysize = ysize;
|
||||||
|
|
||||||
return( m );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -275,18 +271,18 @@ im_create_imaskv( const char *filename, int xsize, int ysize, ... )
|
|||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
INTMASK *m;
|
INTMASK *out;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( !(m = im_create_imask( filename, xsize, ysize )) )
|
if( !(out = im_create_imask( filename, xsize, ysize )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
va_start( ap, ysize );
|
va_start( ap, ysize );
|
||||||
for( i = 0; i < xsize * ysize; i++ )
|
for( i = 0; i < xsize * ysize; i++ )
|
||||||
m->coeff[i] = va_arg( ap, int );
|
out->coeff[i] = va_arg( ap, int );
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
return( m );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -304,7 +300,7 @@ im_create_imaskv( const char *filename, int xsize, int ysize, ... )
|
|||||||
DOUBLEMASK *
|
DOUBLEMASK *
|
||||||
im_create_dmask( const char *filename, int xsize, int ysize )
|
im_create_dmask( const char *filename, int xsize, int ysize )
|
||||||
{
|
{
|
||||||
DOUBLEMASK *m;
|
DOUBLEMASK *out;
|
||||||
int size = xsize * ysize;
|
int size = xsize * ysize;
|
||||||
|
|
||||||
/* Check args.
|
/* Check args.
|
||||||
@ -316,28 +312,28 @@ im_create_dmask( const char *filename, int xsize, int ysize )
|
|||||||
|
|
||||||
/* Allocate and initialise structure.
|
/* Allocate and initialise structure.
|
||||||
*/
|
*/
|
||||||
if( !(m = IM_NEW( NULL, DOUBLEMASK )) )
|
if( !(out = IM_NEW( NULL, DOUBLEMASK )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
m->coeff = NULL;
|
out->coeff = NULL;
|
||||||
m->filename = NULL;
|
out->filename = NULL;
|
||||||
m->scale = 1.0;
|
out->scale = 1.0;
|
||||||
m->offset = 0.0;
|
out->offset = 0.0;
|
||||||
m->xsize = 0;
|
out->xsize = 0;
|
||||||
m->ysize = 0;
|
out->ysize = 0;
|
||||||
|
|
||||||
if( !(m->coeff = IM_ARRAY( NULL, size, double )) ) {
|
if( !(out->coeff = IM_ARRAY( NULL, size, double )) ) {
|
||||||
im_free_dmask( m );
|
im_free_dmask( out );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
(void) memset( (char *) m->coeff, 0, size * sizeof( double ) );
|
(void) memset( (char *) out->coeff, 0, size * sizeof( double ) );
|
||||||
if( !(m->filename = im_strdup( NULL, filename )) ) {
|
if( !(out->filename = im_strdup( NULL, filename )) ) {
|
||||||
im_free_dmask( m );
|
im_free_dmask( out );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
m->xsize = xsize;
|
out->xsize = xsize;
|
||||||
m->ysize = ysize;
|
out->ysize = ysize;
|
||||||
|
|
||||||
return( m );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -358,18 +354,18 @@ im_create_dmaskv( const char *filename, int xsize, int ysize, ... )
|
|||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
DOUBLEMASK *m;
|
DOUBLEMASK *out;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( !(m = im_create_dmask( filename, xsize, ysize )) )
|
if( !(out = im_create_dmask( filename, xsize, ysize )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
va_start( ap, ysize );
|
va_start( ap, ysize );
|
||||||
for( i = 0; i < xsize * ysize; i++ )
|
for( i = 0; i < xsize * ysize; i++ )
|
||||||
m->coeff[i] = va_arg( ap, double );
|
out->coeff[i] = va_arg( ap, double );
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
return( m );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a line from a file!
|
/* Read a line from a file!
|
||||||
@ -476,7 +472,7 @@ im_read_dmask( const char *filename )
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
double sc, off;
|
double sc, off;
|
||||||
int xs, ys;
|
int xs, ys;
|
||||||
DOUBLEMASK *m;
|
DOUBLEMASK *out;
|
||||||
int x, y, i, size;
|
int x, y, i, size;
|
||||||
char buf[IM_MAX_LINE];
|
char buf[IM_MAX_LINE];
|
||||||
|
|
||||||
@ -488,30 +484,30 @@ im_read_dmask( const char *filename )
|
|||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !(m = im_create_dmask( filename, xs, ys )) ) {
|
if( !(out = im_create_dmask( filename, xs, ys )) ) {
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
m->scale = sc;
|
out->scale = sc;
|
||||||
m->offset = off;
|
out->offset = off;
|
||||||
size = xs * ys;
|
size = xs * ys;
|
||||||
|
|
||||||
for( i = 0, y = 0; y < ys; y++ ) {
|
for( i = 0, y = 0; y < ys; y++ ) {
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if( get_line( fp, buf ) ) {
|
if( get_line( fp, buf ) ) {
|
||||||
im_free_dmask( m );
|
im_free_dmask( out );
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( p = buf, x = 0; p && x < xs;
|
for( p = buf, x = 0; p && x < xs;
|
||||||
x++, i++, p = im_break_token( p, " \t,\";" ) )
|
x++, i++, p = im_break_token( p, " \t,\";" ) )
|
||||||
m->coeff[i] = g_ascii_strtod( p, NULL );
|
out->coeff[i] = g_ascii_strtod( p, NULL );
|
||||||
}
|
}
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
|
|
||||||
return( m );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -575,7 +571,7 @@ im_read_imask( const char *filename )
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* im_scale_dmask:
|
* im_scale_dmask:
|
||||||
* @m: mask to scale
|
* @in: mask to scale
|
||||||
* @filename: filename for returned mask
|
* @filename: filename for returned mask
|
||||||
*
|
*
|
||||||
* Scale the dmask to make an imask with a maximum value of 100.
|
* Scale the dmask to make an imask with a maximum value of 100.
|
||||||
@ -585,34 +581,34 @@ im_read_imask( const char *filename )
|
|||||||
* Returns: the converted mask, or NULL on error.
|
* Returns: the converted mask, or NULL on error.
|
||||||
*/
|
*/
|
||||||
INTMASK *
|
INTMASK *
|
||||||
im_scale_dmask( DOUBLEMASK *m, const char *filename )
|
im_scale_dmask( DOUBLEMASK *in, const char *filename )
|
||||||
{
|
{
|
||||||
const int size = m->xsize * m->ysize;
|
const int size = in->xsize * in->ysize;
|
||||||
|
|
||||||
INTMASK *out;
|
INTMASK *out;
|
||||||
double maxval, dsum;
|
double maxval, dsum;
|
||||||
int i;
|
int i;
|
||||||
int isum;
|
int isum;
|
||||||
|
|
||||||
if( !filename || m->xsize <= 0 || m->ysize <= 0 ) {
|
if( !filename || in->xsize <= 0 || in->ysize <= 0 ) {
|
||||||
im_error( "im_scale_dmask", "%s", _( "bad arguments" ) );
|
im_error( "im_scale_dmask", "%s", _( "bad arguments" ) );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
if( !(out = im_create_imask( filename, m->xsize, m->ysize )) )
|
if( !(out = im_create_imask( filename, in->xsize, in->ysize )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
/* Find mask max.
|
/* Find mask max.
|
||||||
*/
|
*/
|
||||||
maxval = m->coeff[0];
|
maxval = in->coeff[0];
|
||||||
for( i = 0; i < size; i++ )
|
for( i = 0; i < size; i++ )
|
||||||
if( m->coeff[i] > maxval )
|
if( in->coeff[i] > maxval )
|
||||||
maxval = m->coeff[i];
|
maxval = in->coeff[i];
|
||||||
|
|
||||||
/* Copy and scale, setting max to 100.
|
/* Copy and scale, setting max to 100.
|
||||||
*/
|
*/
|
||||||
for( i = 0; i < size; i++ )
|
for( i = 0; i < size; i++ )
|
||||||
out->coeff[i] = IM_RINT( m->coeff[i] * 100.0 / maxval );
|
out->coeff[i] = IM_RINT( in->coeff[i] * 100.0 / maxval );
|
||||||
out->offset = m->offset;
|
out->offset = in->offset;
|
||||||
|
|
||||||
/* Set the scale to match the adjustment to max.
|
/* Set the scale to match the adjustment to max.
|
||||||
*/
|
*/
|
||||||
@ -620,15 +616,15 @@ im_scale_dmask( DOUBLEMASK *m, const char *filename )
|
|||||||
dsum = 0.0;
|
dsum = 0.0;
|
||||||
for( i = 0; i < size; i++ ) {
|
for( i = 0; i < size; i++ ) {
|
||||||
isum += out->coeff[i];
|
isum += out->coeff[i];
|
||||||
dsum += m->coeff[i];
|
dsum += in->coeff[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dsum == m->scale )
|
if( dsum == in->scale )
|
||||||
out->scale = isum;
|
out->scale = isum;
|
||||||
else if( dsum == 0.0 )
|
else if( dsum == 0.0 )
|
||||||
out->scale = 1.0;
|
out->scale = 1.0;
|
||||||
else
|
else
|
||||||
out->scale = IM_RINT( m->scale * isum / dsum );
|
out->scale = IM_RINT( in->scale * isum / dsum );
|
||||||
|
|
||||||
return( out );
|
return( out );
|
||||||
}
|
}
|
||||||
@ -664,7 +660,7 @@ im_norm_dmask( DOUBLEMASK *mask )
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* im_dup_imask:
|
* im_dup_imask:
|
||||||
* @m: mask to duplicate
|
* @in: mask to duplicate
|
||||||
* @filename: filename to set for the new mask
|
* @filename: filename to set for the new mask
|
||||||
*
|
*
|
||||||
* Duplicate an imask.
|
* Duplicate an imask.
|
||||||
@ -674,26 +670,26 @@ im_norm_dmask( DOUBLEMASK *mask )
|
|||||||
* Returns: the mask copy, or NULL on error.
|
* Returns: the mask copy, or NULL on error.
|
||||||
*/
|
*/
|
||||||
INTMASK *
|
INTMASK *
|
||||||
im_dup_imask( INTMASK *m, const char *filename )
|
im_dup_imask( INTMASK *in, const char *filename )
|
||||||
{
|
{
|
||||||
INTMASK *new;
|
INTMASK *out;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( !(new = im_create_imask( filename, m->xsize, m->ysize )) )
|
if( !(out = im_create_imask( filename, in->xsize, in->ysize )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
new->offset = m->offset;
|
out->offset = in->offset;
|
||||||
new->scale = m->scale;
|
out->scale = in->scale;
|
||||||
|
|
||||||
for( i = 0; i < m->xsize * m->ysize; i++ )
|
for( i = 0; i < in->xsize * in->ysize; i++ )
|
||||||
new->coeff[i] = m->coeff[i];
|
out->coeff[i] = in->coeff[i];
|
||||||
|
|
||||||
return( new );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* im_dup_dmask:
|
* im_dup_dmask:
|
||||||
* @m: mask to duplicate
|
* @in: mask to duplicate
|
||||||
* @filename: filename to set for the new mask
|
* @filename: filename to set for the new mask
|
||||||
*
|
*
|
||||||
* Duplicate a dmask.
|
* Duplicate a dmask.
|
||||||
@ -703,21 +699,21 @@ im_dup_imask( INTMASK *m, const char *filename )
|
|||||||
* Returns: the mask copy, or NULL on error.
|
* Returns: the mask copy, or NULL on error.
|
||||||
*/
|
*/
|
||||||
DOUBLEMASK *
|
DOUBLEMASK *
|
||||||
im_dup_dmask( DOUBLEMASK *m, const char *filename )
|
im_dup_dmask( DOUBLEMASK *in, const char *filename )
|
||||||
{
|
{
|
||||||
DOUBLEMASK *new;
|
DOUBLEMASK *out;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( !(new = im_create_dmask( filename, m->xsize, m->ysize )) )
|
if( !(out = im_create_dmask( filename, in->xsize, in->ysize )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
new->offset = m->offset;
|
out->offset = in->offset;
|
||||||
new->scale = m->scale;
|
out->scale = in->scale;
|
||||||
|
|
||||||
for( i = 0; i < m->xsize * m->ysize; i++ )
|
for( i = 0; i < in->xsize * in->ysize; i++ )
|
||||||
new->coeff[i] = m->coeff[i];
|
out->coeff[i] = in->coeff[i];
|
||||||
|
|
||||||
return( new );
|
return( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open for write. We can't use im__open_write(), we don't want binary mode.
|
/* Open for write. We can't use im__open_write(), we don't want binary mode.
|
||||||
@ -765,7 +761,7 @@ write_double( FILE *fp, double d )
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* im_write_imask_name:
|
* im_write_imask_name:
|
||||||
* @m: mask to write
|
* @in: mask to write
|
||||||
* @filename: filename to write to
|
* @filename: filename to write to
|
||||||
*
|
*
|
||||||
* Write an imask to a file. See im_read_dmask() for a description of the mask
|
* Write an imask to a file. See im_read_dmask() for a description of the mask
|
||||||
@ -776,7 +772,7 @@ write_double( FILE *fp, double d )
|
|||||||
* Returns: 0 on success, or -1 on error.
|
* Returns: 0 on success, or -1 on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
im_write_imask_name( INTMASK *m, const char *filename )
|
im_write_imask_name( INTMASK *in, const char *filename )
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int x, y, i;
|
int x, y, i;
|
||||||
@ -784,17 +780,17 @@ im_write_imask_name( INTMASK *m, const char *filename )
|
|||||||
if( !(fp = open_write( filename )) )
|
if( !(fp = open_write( filename )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( write_line( fp, "%d %d", m->xsize, m->ysize ) ) {
|
if( write_line( fp, "%d %d", in->xsize, in->ysize ) ) {
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
if( m->scale != 1 || m->offset != 0 )
|
if( in->scale != 1 || in->offset != 0 )
|
||||||
write_line( fp, " %d %d", m->scale, m->offset );
|
write_line( fp, " %d %d", in->scale, in->offset );
|
||||||
write_line( fp, "\n" );
|
write_line( fp, "\n" );
|
||||||
|
|
||||||
for( i = 0, y = 0; y < m->ysize; y++ ) {
|
for( i = 0, y = 0; y < in->ysize; y++ ) {
|
||||||
for( x = 0; x < m->xsize; x++, i++ )
|
for( x = 0; x < in->xsize; x++, i++ )
|
||||||
write_line( fp, "%d ", m->coeff[i] );
|
write_line( fp, "%d ", in->coeff[i] );
|
||||||
|
|
||||||
if( write_line( fp, "\n" ) ) {
|
if( write_line( fp, "\n" ) ) {
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
@ -808,7 +804,7 @@ im_write_imask_name( INTMASK *m, const char *filename )
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* im_write_imask:
|
* im_write_imask:
|
||||||
* @m: mask to write
|
* @in: mask to write
|
||||||
*
|
*
|
||||||
* Write an imask to a file.
|
* Write an imask to a file.
|
||||||
*
|
*
|
||||||
@ -817,19 +813,19 @@ im_write_imask_name( INTMASK *m, const char *filename )
|
|||||||
* Returns: 0 on success, or -1 on error.
|
* Returns: 0 on success, or -1 on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
im_write_imask( INTMASK *m )
|
im_write_imask( INTMASK *in )
|
||||||
{
|
{
|
||||||
if( !m->filename ) {
|
if( !in->filename ) {
|
||||||
im_error( "im_write_imask", "%s", _( "filename not set" ) );
|
im_error( "im_write_imask", "%s", _( "filename not set" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( im_write_imask_name( m, m->filename ) );
|
return( im_write_imask_name( in, in->filename ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* im_write_dmask_name:
|
* im_write_dmask_name:
|
||||||
* @m: mask to write
|
* @in: mask to write
|
||||||
* @filename: filename to write to
|
* @filename: filename to write to
|
||||||
*
|
*
|
||||||
* Write a dmask to a file. See im_read_dmask() for a description of the mask
|
* Write a dmask to a file. See im_read_dmask() for a description of the mask
|
||||||
@ -840,7 +836,7 @@ im_write_imask( INTMASK *m )
|
|||||||
* Returns: 0 on success, or -1 on error.
|
* Returns: 0 on success, or -1 on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
im_write_dmask_name( DOUBLEMASK *m, const char *filename )
|
im_write_dmask_name( DOUBLEMASK *in, const char *filename )
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int x, y, i;
|
int x, y, i;
|
||||||
@ -848,21 +844,21 @@ im_write_dmask_name( DOUBLEMASK *m, const char *filename )
|
|||||||
if( !(fp = open_write( filename )) )
|
if( !(fp = open_write( filename )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( write_line( fp, "%d %d", m->xsize, m->ysize ) ) {
|
if( write_line( fp, "%d %d", in->xsize, in->ysize ) ) {
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
if( m->scale != 1.0 || m->offset != 0.0 ) {
|
if( in->scale != 1.0 || in->offset != 0.0 ) {
|
||||||
write_line( fp, " " );
|
write_line( fp, " " );
|
||||||
write_double( fp, m->scale );
|
write_double( fp, in->scale );
|
||||||
write_line( fp, " " );
|
write_line( fp, " " );
|
||||||
write_double( fp, m->offset );
|
write_double( fp, in->offset );
|
||||||
}
|
}
|
||||||
write_line( fp, "\n" );
|
write_line( fp, "\n" );
|
||||||
|
|
||||||
for( i = 0, y = 0; y < m->ysize; y++ ) {
|
for( i = 0, y = 0; y < in->ysize; y++ ) {
|
||||||
for( x = 0; x < m->xsize; x++, i++ )
|
for( x = 0; x < in->xsize; x++, i++ )
|
||||||
write_double( fp, m->coeff[i] );
|
write_double( fp, in->coeff[i] );
|
||||||
write_line( fp, " " );
|
write_line( fp, " " );
|
||||||
|
|
||||||
if( write_line( fp, "\n" ) ) {
|
if( write_line( fp, "\n" ) ) {
|
||||||
@ -877,7 +873,7 @@ im_write_dmask_name( DOUBLEMASK *m, const char *filename )
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* im_write_dmask:
|
* im_write_dmask:
|
||||||
* @m: mask to write
|
* @in: mask to write
|
||||||
*
|
*
|
||||||
* Write a dmask to a file. See im_read_dmask() for a description of the mask
|
* Write a dmask to a file. See im_read_dmask() for a description of the mask
|
||||||
* file format.
|
* file format.
|
||||||
@ -887,14 +883,14 @@ im_write_dmask_name( DOUBLEMASK *m, const char *filename )
|
|||||||
* Returns: 0 on success, or -1 on error.
|
* Returns: 0 on success, or -1 on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
im_write_dmask( DOUBLEMASK *m )
|
im_write_dmask( DOUBLEMASK *in )
|
||||||
{
|
{
|
||||||
if( !m->filename ) {
|
if( !in->filename ) {
|
||||||
im_error( "im_write_dmask", "%s", _( "filename not set" ) );
|
im_error( "im_write_dmask", "%s", _( "filename not set" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( im_write_dmask_name( m, m->filename ) );
|
return( im_write_dmask_name( in, in->filename ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy an imask into a matrix. Only used internally by matrix package for
|
/* Copy an imask into a matrix. Only used internally by matrix package for
|
||||||
@ -953,24 +949,23 @@ im_copy_matrix_dmask( double **matrix, DOUBLEMASK *mask )
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* im_print_imask:
|
* im_print_imask:
|
||||||
* @m: mask to print
|
* @in: mask to print
|
||||||
*
|
*
|
||||||
* Print an imask to stdout.
|
* Print an imask to stdout.
|
||||||
*
|
*
|
||||||
* See also: im_print_dmask().
|
* See also: im_print_dmask().
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
im_print_imask( INTMASK *m )
|
im_print_imask( INTMASK *in )
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
int *pm = m->coeff;
|
|
||||||
|
|
||||||
printf( "%s: %d %d %d %d\n",
|
printf( "%s: %d %d %d %d\n",
|
||||||
m->filename, m->xsize, m->ysize, m->scale, m->offset );
|
in->filename, in->xsize, in->ysize, in->scale, in->offset );
|
||||||
|
|
||||||
for( k = 0, j = 0; j < m->ysize; j++ ) {
|
for( k = 0, j = 0; j < in->ysize; j++ ) {
|
||||||
for( i = 0; i < m->xsize; i++, k++ )
|
for( i = 0; i < in->xsize; i++, k++ )
|
||||||
printf( "%d\t", pm[k] );
|
printf( "%d\t", in->coeff[k] );
|
||||||
|
|
||||||
printf( "\n" );
|
printf( "\n" );
|
||||||
}
|
}
|
||||||
@ -978,24 +973,23 @@ im_print_imask( INTMASK *m )
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* im_print_dmask:
|
* im_print_dmask:
|
||||||
* @m: mask to print
|
* @in: mask to print
|
||||||
*
|
*
|
||||||
* Print a dmask to stdout.
|
* Print a dmask to stdout.
|
||||||
*
|
*
|
||||||
* See also: im_print_imask().
|
* See also: im_print_imask().
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
im_print_dmask( DOUBLEMASK *m )
|
im_print_dmask( DOUBLEMASK *in )
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
double *pm = m->coeff;
|
|
||||||
|
|
||||||
printf( "%s: %d %d %f %f\n",
|
printf( "%s: %d %d %f %f\n",
|
||||||
m->filename, m->xsize, m->ysize, m->scale, m->offset );
|
in->filename, in->xsize, in->ysize, in->scale, in->offset );
|
||||||
|
|
||||||
for( k = 0, j = 0; j < m->ysize; j++ ) {
|
for( k = 0, j = 0; j < in->ysize; j++ ) {
|
||||||
for( i = 0; i < m->xsize; i++, k++ )
|
for( i = 0; i < in->xsize; i++, k++ )
|
||||||
printf( "%f\t", pm[k] );
|
printf( "%f\t", in->coeff[k] );
|
||||||
|
|
||||||
printf( "\n" );
|
printf( "\n" );
|
||||||
}
|
}
|
||||||
@ -1011,7 +1005,7 @@ im_print_dmask( DOUBLEMASK *m )
|
|||||||
*
|
*
|
||||||
* See also: im_local_imask().
|
* See also: im_local_imask().
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, or -1 on error.
|
* Returns: the mask, or NULL on error.
|
||||||
*/
|
*/
|
||||||
DOUBLEMASK *
|
DOUBLEMASK *
|
||||||
im_local_dmask( VipsImage *out, DOUBLEMASK *mask )
|
im_local_dmask( VipsImage *out, DOUBLEMASK *mask )
|
||||||
@ -1038,7 +1032,7 @@ im_local_dmask( VipsImage *out, DOUBLEMASK *mask )
|
|||||||
*
|
*
|
||||||
* See also: im_local_dmask().
|
* See also: im_local_dmask().
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, or -1 on error.
|
* Returns: the mask, or NULL on error.
|
||||||
*/
|
*/
|
||||||
INTMASK *
|
INTMASK *
|
||||||
im_local_imask( VipsImage *out, INTMASK *mask )
|
im_local_imask( VipsImage *out, INTMASK *mask )
|
||||||
|
Loading…
Reference in New Issue
Block a user