more gtkdoc
This commit is contained in:
parent
4d204a3062
commit
ec73347f59
19
TODO
19
TODO
@ -37,12 +37,6 @@
|
||||
- need a separate section in ref docs for vips, vipsCC (and python?)
|
||||
|
||||
|
||||
- try the new liboil thing:
|
||||
|
||||
http://www.schleef.org/orc/
|
||||
|
||||
pick something like abs and time it
|
||||
|
||||
|
||||
- im__cast_and_call() no longer does
|
||||
|
||||
@ -63,19 +57,6 @@
|
||||
|
||||
- split proto.h into headers for arithmetic etc.
|
||||
|
||||
- move headers into libsrc/arithmetic, can we get them installed into the
|
||||
right prefix?
|
||||
|
||||
- move VImage.h into libsrcCC
|
||||
|
||||
- rename libsrc as libvips
|
||||
|
||||
- rename src as vipstools
|
||||
|
||||
- rename libsrcCC as libvipsCC
|
||||
|
||||
- rename python as SWIG
|
||||
|
||||
- rename vipsCC in SWIG as pyvips
|
||||
|
||||
|
||||
|
@ -57,9 +57,9 @@
|
||||
* of bands.
|
||||
*
|
||||
* For binary operations, if the number of bands differs, one of the images
|
||||
* must have one band. So you can add a 1 band image to a 3 band image, for
|
||||
* example, and the 1 band image will be added 3 times, but you can't add a
|
||||
* 2 band image to a 3 band image.
|
||||
* must have one band. In this case, an n-band image is formed from the
|
||||
* one-band image by joining n copies of the one-band image together, and then
|
||||
* the two n-band images are operated upon.
|
||||
*
|
||||
* Arithmetic operations try to preserve precision by increasing the number of
|
||||
* bits in the output image when necessary. Generally, this follows the ANSI C
|
||||
|
@ -68,33 +68,31 @@
|
||||
|
||||
/* Integer abs operation: just test and negate.
|
||||
*/
|
||||
#define intabs(TYPE) \
|
||||
{ \
|
||||
TYPE *p = (TYPE *) in; \
|
||||
TYPE *q = (TYPE *) out; \
|
||||
int x; \
|
||||
#define intabs(TYPE) { \
|
||||
TYPE *p = (TYPE *) in; \
|
||||
TYPE *q = (TYPE *) out; \
|
||||
int x; \
|
||||
\
|
||||
for( x = 0; x < sz; x++ ) { \
|
||||
TYPE v = p[x]; \
|
||||
\
|
||||
for( x = 0; x < sz; x++ ) { \
|
||||
TYPE v = p[x]; \
|
||||
\
|
||||
if( v < 0 ) \
|
||||
q[x] = 0 - v; \
|
||||
else \
|
||||
q[x] = v; \
|
||||
} \
|
||||
}
|
||||
if( v < 0 ) \
|
||||
q[x] = 0 - v; \
|
||||
else \
|
||||
q[x] = v; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Float abs operation: call fabs().
|
||||
*/
|
||||
#define floatabs(TYPE)\
|
||||
{\
|
||||
TYPE *p = (TYPE *) in;\
|
||||
TYPE *q = (TYPE *) out;\
|
||||
int x; \
|
||||
\
|
||||
for( x = 0; x < sz; x++ )\
|
||||
q[x] = fabs( p[x] );\
|
||||
}
|
||||
#define floatabs(TYPE) { \
|
||||
TYPE *p = (TYPE *) in; \
|
||||
TYPE *q = (TYPE *) out; \
|
||||
int x; \
|
||||
\
|
||||
for( x = 0; x < sz; x++ ) \
|
||||
q[x] = fabs( p[x] ); \
|
||||
}
|
||||
|
||||
/* Complex abs operation: calculate modulus.
|
||||
*/
|
||||
@ -102,39 +100,43 @@
|
||||
#ifdef HAVE_HYPOT
|
||||
|
||||
#define complexabs(TYPE) { \
|
||||
TYPE *p = (TYPE *) in; \
|
||||
TYPE *q = (TYPE *) out; \
|
||||
int i; \
|
||||
\
|
||||
for( i = 0; i < sz; i++ ) { \
|
||||
q[i] = hypot( p[0], p[1] ); \
|
||||
p += 2; \
|
||||
} \
|
||||
}
|
||||
TYPE *p = (TYPE *) in; \
|
||||
TYPE *q = (TYPE *) out; \
|
||||
int x; \
|
||||
\
|
||||
for( x = 0; x < sz; x++ ) { \
|
||||
q[x] = hypot( p[0], p[1] ); \
|
||||
p += 2; \
|
||||
} \
|
||||
}
|
||||
|
||||
#else /*HAVE_HYPOT*/
|
||||
|
||||
#define complexabs(TYPE) { \
|
||||
TYPE *p = (TYPE *) in; \
|
||||
TYPE *q = (TYPE *) out; \
|
||||
TYPE *q_stop = q + sz; \
|
||||
\
|
||||
while( q < q_stop ){ \
|
||||
double rp = *p++; \
|
||||
double ip = *p++; \
|
||||
double abs_rp= fabs( rp ); \
|
||||
double abs_ip= fabs( ip ); \
|
||||
\
|
||||
if( abs_rp > abs_ip ){ \
|
||||
double temp= ip / rp; \
|
||||
*q++= abs_rp * sqrt( 1.0 + temp * temp ); \
|
||||
} \
|
||||
else { \
|
||||
double temp= rp / ip; \
|
||||
*q++= abs_ip * sqrt( 1.0 + temp * temp ); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
#define complexabs(TYPE) { \
|
||||
TYPE *p = (TYPE *) in; \
|
||||
TYPE *q = (TYPE *) out; \
|
||||
int x; \
|
||||
\
|
||||
for( x = 0; x < sz; x++ ) { \
|
||||
double rp = p[0]; \
|
||||
double ip = p[1]; \
|
||||
double abs_rp = fabs( rp ); \
|
||||
double abs_ip = fabs( ip ); \
|
||||
\
|
||||
if( abs_rp > abs_ip ) { \
|
||||
double temp = ip / rp; \
|
||||
\
|
||||
q[x]= abs_rp * sqrt( 1.0 + temp * temp ); \
|
||||
} \
|
||||
else { \
|
||||
double temp = rp / ip; \
|
||||
\
|
||||
q[x]= abs_ip * sqrt( 1.0 + temp * temp ); \
|
||||
} \
|
||||
\
|
||||
p += 2; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif /*HAVE_HYPOT*/
|
||||
|
||||
|
@ -1,11 +1,4 @@
|
||||
/* @(#) Function to find the maximim of an image. Works for any
|
||||
* @(#) image type. Returns a double.
|
||||
* @(#)
|
||||
* @(#) int im_max(in, max)
|
||||
* @(#) IMAGE *in;
|
||||
* @(#) double *max;
|
||||
* @(#)
|
||||
* @(#) Returns 0 on success and -1 on error
|
||||
/* im_max.c
|
||||
*
|
||||
* Copyright: 1990, J. Cupitt
|
||||
*
|
||||
@ -224,6 +217,20 @@ max_scan( REGION *reg, void *vseq, void *a, void *b )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* im_max:
|
||||
* @in: input #IMAGE
|
||||
* @out: output double
|
||||
*
|
||||
* Finds the the maximum value of image #in and returns it at the
|
||||
* location pointed by out. If input is complex, the max square amplitude
|
||||
* (re*re+im*im) is returned. im_max() finds the maximum of all bands: if you
|
||||
* want to find the maximum of each band separately, use im_stats().
|
||||
*
|
||||
* See also: im_maxpos(), im_min(), im_stats().
|
||||
*
|
||||
* Returns: 0 on success, -1 on error
|
||||
*/
|
||||
int
|
||||
im_max( IMAGE *in, double *out )
|
||||
{
|
||||
|
@ -1,21 +1,4 @@
|
||||
/* Analyse a grid of colour patches, producing a DOUBLEMASK of averages.
|
||||
* Pass an IMAGE, an IMAGE_BOX, the number of horizontal and vertical
|
||||
* patches, an array giving the numbers of the patches to measure (patches are
|
||||
* numbered left-to-right, top-to-bottom) and the name we should give the
|
||||
* output mask. Return a DOUBLEMASK in which rows are patches and columns are
|
||||
* bands.
|
||||
*
|
||||
* Example: 6 band image of 4x2 block of colour patches.
|
||||
*
|
||||
* +---+---+---+---+
|
||||
* | 1 | 2 | 3 | 4 |
|
||||
* +---+---+---+---+
|
||||
* | 5 | 6 | 7 | 8 |
|
||||
* +---+---+---+---+
|
||||
*
|
||||
* Then call im_measure( im, box, 4, 2, { 2, 4 }, 2, "fred" ) makes a mask
|
||||
* "fred" which has 6 columns, two rows. The first row contains the averages
|
||||
* for patch 2, the second for patch 4.
|
||||
/* im_measure.c
|
||||
*
|
||||
* Modified:
|
||||
* 19/8/94 JC
|
||||
@ -158,7 +141,36 @@ measure_patches( IMAGE *im, double *coeff, IMAGE_BOX *box,
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Measure up image.
|
||||
/**
|
||||
* im_measure:
|
||||
* @im: image to measure
|
||||
* @box: box containing chart
|
||||
* @h: patches across chart
|
||||
* @v: patches down chart
|
||||
* @sel: array of patch numbers to measure (numbered from 1 in row-major order)
|
||||
* @nsel: length of patch number array
|
||||
* @name: name to give to returned @DOUBLEMASK
|
||||
*
|
||||
* Analyse a grid of colour patches, producing a #DOUBLEMASK of patch averages.
|
||||
* The operations issues a warning if any patch has a deviation more than 20% of
|
||||
* the mean. Only the central 50% of each patch is averaged.
|
||||
*
|
||||
* Example: 6 band image of 4x2 block of colour patches.
|
||||
*
|
||||
* +---+---+---+---+
|
||||
* | 1 | 2 | 3 | 4 |
|
||||
* +---+---+---+---+
|
||||
* | 5 | 6 | 7 | 8 |
|
||||
* +---+---+---+---+
|
||||
*
|
||||
* Then call im_measure( im, box, 4, 2, { 2, 4 }, 2, "fred" ) makes a mask
|
||||
* "fred" which has 6 columns, two rows. The first row contains the averages
|
||||
* for patch 2, the second for patch 4.
|
||||
*
|
||||
* Returns: #DOUBLEMASK with a row for each selected patch, a column for each
|
||||
* image band.
|
||||
*
|
||||
* Related: im_avg(), im_deviate(), im_stats().
|
||||
*/
|
||||
DOUBLEMASK *
|
||||
im_measure( IMAGE *im, IMAGE_BOX *box, int h, int v,
|
||||
|
@ -152,50 +152,50 @@ scan_fn( REGION *reg, void *seq, void *a, void *b )
|
||||
* Use temp variables of same type for min/max for faster comparisons.
|
||||
* Use double to sum bands.
|
||||
*/
|
||||
#define non_complex_loop(TYPE) \
|
||||
{ TYPE *p, *q; \
|
||||
TYPE value, small, big; \
|
||||
double *row; \
|
||||
\
|
||||
/* Have min and max been initialised? \
|
||||
#define non_complex_loop(TYPE) { \
|
||||
TYPE *p, *q; \
|
||||
TYPE value, small, big; \
|
||||
double *row; \
|
||||
\
|
||||
/* Have min and max been initialised? \
|
||||
*/ \
|
||||
if( tmp->offset == 42 ) { \
|
||||
/* Init min and max for each band. \
|
||||
*/ \
|
||||
if( tmp->offset == 42 ) { \
|
||||
/* Init min and max for each band. \
|
||||
*/ \
|
||||
p = (TYPE *) IM_REGION_ADDR( reg, le, to ); \
|
||||
for( z = 1; z < bands + 1; z++ ) { \
|
||||
row = tmp->coeff + z * 6; \
|
||||
row[0] = p[z - 1]; \
|
||||
row[1] = p[z - 1]; \
|
||||
} \
|
||||
tmp->offset = 0; \
|
||||
p = (TYPE *) IM_REGION_ADDR( reg, le, to ); \
|
||||
for( z = 1; z < bands + 1; z++ ) { \
|
||||
row = tmp->coeff + z * 6; \
|
||||
row[0] = p[z - 1]; \
|
||||
row[1] = p[z - 1]; \
|
||||
} \
|
||||
\
|
||||
for( y = to; y < bo; y++ ) { \
|
||||
p = (TYPE *) IM_REGION_ADDR( reg, le, y ); \
|
||||
\
|
||||
for( z = 0; z < bands; z++ ) { \
|
||||
q = p + z; \
|
||||
row = tmp->coeff + (z + 1)*6; \
|
||||
small = row[0]; \
|
||||
big = row[1]; \
|
||||
\
|
||||
for( x = le; x < ri; x++ ) { \
|
||||
value = *q; \
|
||||
q += bands; \
|
||||
row[2] += value;\
|
||||
row[3] += (double)value*(double)value;\
|
||||
if( value > big ) \
|
||||
big = value; \
|
||||
else if( value < small ) \
|
||||
small = value;\
|
||||
}\
|
||||
\
|
||||
row[0] = small; \
|
||||
row[1] = big; \
|
||||
tmp->offset = 0; \
|
||||
} \
|
||||
\
|
||||
for( y = to; y < bo; y++ ) { \
|
||||
p = (TYPE *) IM_REGION_ADDR( reg, le, y ); \
|
||||
\
|
||||
for( z = 0; z < bands; z++ ) { \
|
||||
q = p + z; \
|
||||
row = tmp->coeff + (z + 1)*6; \
|
||||
small = row[0]; \
|
||||
big = row[1]; \
|
||||
\
|
||||
for( x = le; x < ri; x++ ) { \
|
||||
value = *q; \
|
||||
q += bands; \
|
||||
row[2] += value;\
|
||||
row[3] += (double)value*(double)value;\
|
||||
if( value > big ) \
|
||||
big = value; \
|
||||
else if( value < small ) \
|
||||
small = value;\
|
||||
}\
|
||||
\
|
||||
row[0] = small; \
|
||||
row[1] = big; \
|
||||
}\
|
||||
}
|
||||
}\
|
||||
}
|
||||
|
||||
/* Now generate code for all types.
|
||||
*/
|
||||
@ -216,11 +216,20 @@ scan_fn( REGION *reg, void *seq, void *a, void *b )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/* Find the statistics of an image. Take any non-complex format. Write the
|
||||
* stats to a DOUBLEMASK of size 6 by (in->Bands+1). We hold a row for each
|
||||
* band, plus one row for all bands. Row n has 6 elements, which are, in
|
||||
* order, (minimum, maximum, sum, sum^2, mean, deviation) for band n. Row 0 has
|
||||
* the figures for all bands together.
|
||||
/**
|
||||
* im_stats:
|
||||
* @in: image to analyze
|
||||
*
|
||||
* Find many image statistics in a single pass through the image. Works for
|
||||
* any uncoded, non-complex image. Returns a
|
||||
* #DOUBLEMASK of 6 columns by n+1 (where n is number of bands in image @in)
|
||||
* rows.
|
||||
*
|
||||
* Columns are statistics, and are, in order: minimum, maximum, sum, sum of
|
||||
* squares, mean, standard deviation. Row 0 has statistics for all bands
|
||||
* together, row 1 has stats for band 1, and so on.
|
||||
*
|
||||
* Returns: a #DOUBLEMASK holding the image statistics
|
||||
*/
|
||||
DOUBLEMASK *
|
||||
im_stats( IMAGE *in )
|
||||
|
@ -39,9 +39,9 @@ extern "C" {
|
||||
|
||||
/* arithmetic
|
||||
*/
|
||||
DOUBLEMASK *im_measure( IMAGE *, IMAGE_BOX *,
|
||||
int, int, int *, int, const char * );
|
||||
DOUBLEMASK *im_stats( IMAGE * );
|
||||
DOUBLEMASK *im_measure( IMAGE *im, IMAGE_BOX *box, int h, int v,
|
||||
int *sel, int nsel, const char *name );
|
||||
DOUBLEMASK *im_stats( IMAGE *in );
|
||||
int im_abs( IMAGE *in, IMAGE *out );
|
||||
int im_max( IMAGE *in, double *out );
|
||||
int im_min( IMAGE *in, double *out );
|
||||
|
Loading…
Reference in New Issue
Block a user