stuff
This commit is contained in:
parent
20d83b9af2
commit
5415dd700c
@ -1,8 +1,8 @@
|
|||||||
28/9/07 started 7.13.1
|
28/9/07 started 7.13.1
|
||||||
- vips2dj can print RGB images
|
- vips2dj can print RGB images
|
||||||
- oop, include <stdexcept> missing
|
- oop, include <stdexcept> missing
|
||||||
- add protos for generate/iterate function args, started fixing warnings
|
- add protos for generate/iterate function args, fix warnings
|
||||||
- add cimg package
|
- add cimg package, we now have C++ source inside VIPS, sigh
|
||||||
|
|
||||||
29/8/07 started 7.13.0
|
29/8/07 started 7.13.0
|
||||||
- we now have a trunk and the version is 7.13.x, woo!
|
- we now have a trunk and the version is 7.13.x, woo!
|
||||||
|
@ -217,6 +217,10 @@ int im_grad_x( IMAGE *in, IMAGE *out ){
|
|||||||
#endif
|
#endif
|
||||||
#undef RETURN_GENERATE
|
#undef RETURN_GENERATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Keep gcc happy.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
#undef FUNCTION_NAME
|
#undef FUNCTION_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,6 +281,10 @@ int im_grad_y( IMAGE *in, IMAGE *out ){
|
|||||||
#endif
|
#endif
|
||||||
#undef RETURN_GENERATE
|
#undef RETURN_GENERATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Keep gcc happy.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
#undef FUNCTION_NAME
|
#undef FUNCTION_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ zerox_gen( REGION *or, void *seq, void *a, void *b )
|
|||||||
{
|
{
|
||||||
REGION *ir = (REGION *) seq;
|
REGION *ir = (REGION *) seq;
|
||||||
IMAGE *in = (IMAGE *) a;
|
IMAGE *in = (IMAGE *) a;
|
||||||
int flag = (int) b;
|
int flag = GPOINTER_TO_INT( b );
|
||||||
Rect irect;
|
Rect irect;
|
||||||
Rect *r = &or->valid;
|
Rect *r = &or->valid;
|
||||||
|
|
||||||
|
@ -109,8 +109,10 @@ build_hist( IMAGE *out, int bands, int which, int size )
|
|||||||
/* Build a sub-hist, based on the main hist.
|
/* Build a sub-hist, based on the main hist.
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
build_subhist( IMAGE *out, Histogram *mhist )
|
build_subhist( IMAGE *out, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Histogram *mhist = (Histogram *) a;
|
||||||
|
|
||||||
return( (void *)
|
return( (void *)
|
||||||
build_hist( out, mhist->bands, mhist->which, mhist->size ) );
|
build_hist( out, mhist->bands, mhist->which, mhist->size ) );
|
||||||
}
|
}
|
||||||
@ -118,8 +120,10 @@ build_subhist( IMAGE *out, Histogram *mhist )
|
|||||||
/* Join a sub-hist onto the main hist.
|
/* Join a sub-hist onto the main hist.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
merge_subhist( Histogram *shist, Histogram *mhist )
|
merge_subhist( void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Histogram *shist = (Histogram *) seq;
|
||||||
|
Histogram *mhist = (Histogram *) a;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
/* Sanity!
|
/* Sanity!
|
||||||
@ -146,8 +150,9 @@ merge_subhist( Histogram *shist, Histogram *mhist )
|
|||||||
/* Histogram of all bands of a uchar image.
|
/* Histogram of all bands of a uchar image.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
find_uchar_hist( REGION *reg, Histogram *hist )
|
find_uchar_hist( REGION *reg, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Histogram *hist = (Histogram *) seq;
|
||||||
Rect *r = ®->valid;
|
Rect *r = ®->valid;
|
||||||
IMAGE *im = reg->im;
|
IMAGE *im = reg->im;
|
||||||
int le = r->left;
|
int le = r->left;
|
||||||
@ -177,8 +182,9 @@ find_uchar_hist( REGION *reg, Histogram *hist )
|
|||||||
/* Histogram of a selected band of a uchar image.
|
/* Histogram of a selected band of a uchar image.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
find_uchar_hist_extract( REGION *reg, Histogram *hist )
|
find_uchar_hist_extract( REGION *reg, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Histogram *hist = (Histogram *) seq;
|
||||||
Rect *r = ®->valid;
|
Rect *r = ®->valid;
|
||||||
IMAGE *im = reg->im;
|
IMAGE *im = reg->im;
|
||||||
int le = r->left;
|
int le = r->left;
|
||||||
@ -208,8 +214,9 @@ find_uchar_hist_extract( REGION *reg, Histogram *hist )
|
|||||||
/* Histogram of all bands of a ushort image.
|
/* Histogram of all bands of a ushort image.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
find_ushort_hist( REGION *reg, Histogram *hist )
|
find_ushort_hist( REGION *reg, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Histogram *hist = (Histogram *) seq;
|
||||||
Rect *r = ®->valid;
|
Rect *r = ®->valid;
|
||||||
IMAGE *im = reg->im;
|
IMAGE *im = reg->im;
|
||||||
int le = r->left;
|
int le = r->left;
|
||||||
@ -249,8 +256,9 @@ find_ushort_hist( REGION *reg, Histogram *hist )
|
|||||||
/* Histogram of all bands of a ushort image.
|
/* Histogram of all bands of a ushort image.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
find_ushort_hist_extract( REGION *reg, Histogram *hist )
|
find_ushort_hist_extract( REGION *reg, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Histogram *hist = (Histogram *) seq;
|
||||||
Rect *r = ®->valid;
|
Rect *r = ®->valid;
|
||||||
IMAGE *im = reg->im;
|
IMAGE *im = reg->im;
|
||||||
int le = r->left;
|
int le = r->left;
|
||||||
@ -293,7 +301,7 @@ im_histgr( IMAGE *in, IMAGE *out, int bandno )
|
|||||||
int size; /* Length of hist */
|
int size; /* Length of hist */
|
||||||
int bands; /* Number of bands in output */
|
int bands; /* Number of bands in output */
|
||||||
Histogram *mhist;
|
Histogram *mhist;
|
||||||
int (*scanfn)( REGION *, Histogram * );
|
im_generate_fn scanfn;
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned int *obuffer, *q;
|
unsigned int *obuffer, *q;
|
||||||
|
|
||||||
|
@ -109,8 +109,10 @@ build_hist( IMAGE *in, IMAGE *out, int bins )
|
|||||||
/* Build a sub-hist, based on the main hist.
|
/* Build a sub-hist, based on the main hist.
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
build_subhist( IMAGE *out, Histogram *mhist )
|
build_subhist( IMAGE *out, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Histogram *mhist = (Histogram *) a;
|
||||||
|
|
||||||
return( (void *)
|
return( (void *)
|
||||||
build_hist( mhist->in, mhist->out, mhist->bins ) );
|
build_hist( mhist->in, mhist->out, mhist->bins ) );
|
||||||
}
|
}
|
||||||
@ -118,8 +120,10 @@ build_subhist( IMAGE *out, Histogram *mhist )
|
|||||||
/* Join a sub-hist onto the main hist.
|
/* Join a sub-hist onto the main hist.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
merge_subhist( Histogram *shist, Histogram *mhist )
|
merge_subhist( void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Histogram *shist = (Histogram *) seq;
|
||||||
|
Histogram *mhist = (Histogram *) a;
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
/* Sanity!
|
/* Sanity!
|
||||||
@ -157,8 +161,9 @@ merge_subhist( Histogram *shist, Histogram *mhist )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_hist( REGION *reg, Histogram *hist )
|
find_hist( REGION *reg, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Histogram *hist = (Histogram *) seq;
|
||||||
Rect *r = ®->valid;
|
Rect *r = ®->valid;
|
||||||
IMAGE *im = reg->im;
|
IMAGE *im = reg->im;
|
||||||
int le = r->left;
|
int le = r->left;
|
||||||
|
@ -144,8 +144,8 @@ normalise( IMAGE *in, IMAGE *out )
|
|||||||
TYPE *p1 = (TYPE *) p; \
|
TYPE *p1 = (TYPE *) p; \
|
||||||
\
|
\
|
||||||
for( x = le; x < ri; x++ ) { \
|
for( x = le; x < ri; x++ ) { \
|
||||||
for( b = 0; b < nb; b++ ) \
|
for( z = 0; z < nb; z++ ) \
|
||||||
q[b] = p1[b] < x ? 0 : 255; \
|
q[z] = p1[z] < x ? 0 : 255; \
|
||||||
\
|
\
|
||||||
q += nb; \
|
q += nb; \
|
||||||
} \
|
} \
|
||||||
@ -155,8 +155,9 @@ normalise( IMAGE *in, IMAGE *out )
|
|||||||
/* Generate function.
|
/* Generate function.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
make_vert_gen( REGION *or, void *dummy, IMAGE *in )
|
make_vert_gen( REGION *or, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
IMAGE *in = (IMAGE *) a;
|
||||||
Rect *r = &or->valid;
|
Rect *r = &or->valid;
|
||||||
int le = r->left;
|
int le = r->left;
|
||||||
int to = r->top;
|
int to = r->top;
|
||||||
@ -164,7 +165,7 @@ make_vert_gen( REGION *or, void *dummy, IMAGE *in )
|
|||||||
int bo = IM_RECT_BOTTOM( r );
|
int bo = IM_RECT_BOTTOM( r );
|
||||||
int nb = in->Bands;
|
int nb = in->Bands;
|
||||||
|
|
||||||
int x, y, b;
|
int x, y, z;
|
||||||
|
|
||||||
for( y = to; y < bo; y++ ) {
|
for( y = to; y < bo; y++ ) {
|
||||||
unsigned char *q = (unsigned char *)
|
unsigned char *q = (unsigned char *)
|
||||||
@ -195,8 +196,8 @@ make_vert_gen( REGION *or, void *dummy, IMAGE *in )
|
|||||||
TYPE *p1 = (TYPE *) p; \
|
TYPE *p1 = (TYPE *) p; \
|
||||||
\
|
\
|
||||||
for( y = to; y < bo; y++ ) { \
|
for( y = to; y < bo; y++ ) { \
|
||||||
for( b = 0; b < nb; b++ ) \
|
for( z = 0; z < nb; z++ ) \
|
||||||
q[b] = p1[b] < (ht - y) ? 0 : 255; \
|
q[z] = p1[z] < (ht - y) ? 0 : 255; \
|
||||||
\
|
\
|
||||||
q += lsk; \
|
q += lsk; \
|
||||||
} \
|
} \
|
||||||
@ -206,8 +207,9 @@ make_vert_gen( REGION *or, void *dummy, IMAGE *in )
|
|||||||
/* Generate function.
|
/* Generate function.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
make_horz_gen( REGION *or, void *dummy, IMAGE *in )
|
make_horz_gen( REGION *or, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
IMAGE *in = (IMAGE *) a;
|
||||||
Rect *r = &or->valid;
|
Rect *r = &or->valid;
|
||||||
int le = r->left;
|
int le = r->left;
|
||||||
int to = r->top;
|
int to = r->top;
|
||||||
@ -217,7 +219,7 @@ make_horz_gen( REGION *or, void *dummy, IMAGE *in )
|
|||||||
int lsk = IM_REGION_LSKIP( or );
|
int lsk = IM_REGION_LSKIP( or );
|
||||||
int ht = or->im->Ysize;
|
int ht = or->im->Ysize;
|
||||||
|
|
||||||
int x, y, b;
|
int x, y, z;
|
||||||
|
|
||||||
for( x = le; x < ri; x++ ) {
|
for( x = le; x < ri; x++ ) {
|
||||||
unsigned char *q = (unsigned char *)
|
unsigned char *q = (unsigned char *)
|
||||||
|
@ -74,8 +74,10 @@ typedef struct {
|
|||||||
/* lhist generate function.
|
/* lhist generate function.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
lhist_gen( REGION *or, REGION *ir, IMAGE *in, LhistInfo *inf )
|
lhist_gen( REGION *or, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
REGION *ir = (REGION *) seq;
|
||||||
|
LhistInfo *inf = (LhistInfo *) inf;
|
||||||
Rect irect;
|
Rect irect;
|
||||||
|
|
||||||
Rect *r = &or->valid;
|
Rect *r = &or->valid;
|
||||||
|
@ -173,16 +173,16 @@ typedef struct {
|
|||||||
/* Destroy a sequence value.
|
/* Destroy a sequence value.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
stop_maplut( Seq *seq, IMAGE *in, LutInfo *st )
|
maplut_stop( void *vseq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Seq *seq = (Seq *) vseq;
|
||||||
|
LutInfo *st = (LutInfo *) b;
|
||||||
|
|
||||||
/* Add to global stats.
|
/* Add to global stats.
|
||||||
*/
|
*/
|
||||||
st->overflow += seq->overflow;
|
st->overflow += seq->overflow;
|
||||||
|
|
||||||
if( seq->ir ) {
|
IM_FREEF( im_region_free, seq->ir );
|
||||||
im_region_free( seq->ir );
|
|
||||||
seq->ir = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -190,11 +190,12 @@ stop_maplut( Seq *seq, IMAGE *in, LutInfo *st )
|
|||||||
/* Our start function.
|
/* Our start function.
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
start_maplut( IMAGE *out, IMAGE *in, LutInfo *st )
|
maplut_start( IMAGE *out, void *a, void *b )
|
||||||
{
|
{
|
||||||
Seq *seq = IM_NEW( out, Seq );
|
IMAGE *in = (IMAGE *) a;
|
||||||
|
Seq *seq;
|
||||||
if( !seq )
|
|
||||||
|
if( !(seq = IM_NEW( out, Seq )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
/* Init!
|
/* Init!
|
||||||
@ -205,7 +206,7 @@ start_maplut( IMAGE *out, IMAGE *in, LutInfo *st )
|
|||||||
if( !(seq->ir = im_region_create( in )) )
|
if( !(seq->ir = im_region_create( in )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
return( (void *) seq );
|
return( seq );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Map through n non-complex luts.
|
/* Map through n non-complex luts.
|
||||||
@ -508,8 +509,11 @@ start_maplut( IMAGE *out, IMAGE *in, LutInfo *st )
|
|||||||
/* Do a map.
|
/* Do a map.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
gen_map( REGION *or, Seq *seq, IMAGE *in, LutInfo *st )
|
maplut_gen( REGION *or, void *vseq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Seq *seq = (Seq *) vseq;
|
||||||
|
IMAGE *in = (IMAGE *) a;
|
||||||
|
LutInfo *st = (LutInfo *) b;
|
||||||
REGION *ir = seq->ir;
|
REGION *ir = seq->ir;
|
||||||
Rect *r = &or->valid;
|
Rect *r = &or->valid;
|
||||||
int le = r->left;
|
int le = r->left;
|
||||||
@ -616,7 +620,7 @@ im_maplut( IMAGE *in, IMAGE *out, IMAGE *lut )
|
|||||||
|
|
||||||
/* Process!
|
/* Process!
|
||||||
*/
|
*/
|
||||||
if( im_generate( out, start_maplut, gen_map, stop_maplut, in, st ) )
|
if( im_generate( out, maplut_start, maplut_gen, maplut_stop, in, st ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
@ -104,10 +104,11 @@ project_new( IMAGE *in, IMAGE *hout, IMAGE *vout )
|
|||||||
/* Build a sub-project, based on the main project.
|
/* Build a sub-project, based on the main project.
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
project_new_sub( IMAGE *out, Project *mproject )
|
project_new_sub( IMAGE *out, void *a, void *b )
|
||||||
{
|
{
|
||||||
return( (void *)
|
Project *mproject = (Project *) a;
|
||||||
project_new( mproject->in, mproject->hout, mproject->vout ) );
|
|
||||||
|
return( project_new( mproject->in, mproject->hout, mproject->vout ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ADD_BUFFER( TYPE, Q, P, N ) { \
|
#define ADD_BUFFER( TYPE, Q, P, N ) { \
|
||||||
@ -123,8 +124,10 @@ project_new_sub( IMAGE *out, Project *mproject )
|
|||||||
/* Join a sub-project onto the main project.
|
/* Join a sub-project onto the main project.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
project_merge( Project *sproject, Project *mproject )
|
project_merge( void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Project *sproject = (Project *) seq;
|
||||||
|
Project *mproject = (Project *) a;
|
||||||
IMAGE *in = mproject->in;
|
IMAGE *in = mproject->in;
|
||||||
IMAGE *out = mproject->hout;
|
IMAGE *out = mproject->hout;
|
||||||
int hsz = in->Xsize * in->Bands;
|
int hsz = in->Xsize * in->Bands;
|
||||||
@ -192,8 +195,9 @@ project_merge( Project *sproject, Project *mproject )
|
|||||||
/* Add a region to a project.
|
/* Add a region to a project.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
project_scan( REGION *reg, Project *project )
|
project_scan( REGION *reg, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
Project *project = (Project *) seq;
|
||||||
Rect *r = ®->valid;
|
Rect *r = ®->valid;
|
||||||
int le = r->left;
|
int le = r->left;
|
||||||
int to = r->top;
|
int to = r->top;
|
||||||
|
@ -91,8 +91,10 @@ typedef struct {
|
|||||||
/* stdif generate function.
|
/* stdif generate function.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
stdif_gen( REGION *or, REGION *ir, IMAGE *in, StdifInfo *inf )
|
stdif_gen( REGION *or, void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
REGION *ir = (REGION *) seq;
|
||||||
|
StdifInfo *inf = (StdifInfo *) b;
|
||||||
Rect irect;
|
Rect irect;
|
||||||
|
|
||||||
Rect *r = &or->valid;
|
Rect *r = &or->valid;
|
||||||
|
@ -76,14 +76,11 @@ typedef struct {
|
|||||||
/* Stop function.
|
/* Stop function.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
stop_dilate( SeqInfo *seq, IMAGE *in )
|
dilate_stop( void *vseq, void *a, void *b )
|
||||||
{
|
{
|
||||||
/* Free attached objects.
|
SeqInfo *seq = (SeqInfo *) vseq;
|
||||||
*/
|
|
||||||
if( seq->ir ) {
|
IM_FREEF( im_region_free, seq->ir );
|
||||||
im_region_free( seq->ir );
|
|
||||||
seq->ir = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -91,12 +88,14 @@ stop_dilate( SeqInfo *seq, IMAGE *in )
|
|||||||
/* Start function.
|
/* Start function.
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
start_dilate( IMAGE *out, IMAGE *in, INTMASK *msk )
|
dilate_start( IMAGE *out, void *a, void *b )
|
||||||
{
|
{
|
||||||
SeqInfo *seq = IM_NEW( out, SeqInfo );
|
IMAGE *in = (IMAGE *) a;
|
||||||
|
INTMASK *msk = (INTMASK *) b;
|
||||||
int sz = msk->xsize * msk->ysize;
|
int sz = msk->xsize * msk->ysize;
|
||||||
|
SeqInfo *seq;
|
||||||
|
|
||||||
if( !seq )
|
if( !(seq = IM_NEW( out, SeqInfo )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
/* Init!
|
/* Init!
|
||||||
@ -113,18 +112,20 @@ start_dilate( IMAGE *out, IMAGE *in, INTMASK *msk )
|
|||||||
seq->soff = IM_ARRAY( out, sz, int );
|
seq->soff = IM_ARRAY( out, sz, int );
|
||||||
seq->coff = IM_ARRAY( out, sz, int );
|
seq->coff = IM_ARRAY( out, sz, int );
|
||||||
if( !seq->ir || !seq->soff || !seq->coff ) {
|
if( !seq->ir || !seq->soff || !seq->coff ) {
|
||||||
stop_dilate( seq, in );
|
dilate_stop( seq, in, NULL );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( (void *) seq );
|
return( seq );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dilate!
|
/* Dilate!
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
gen_dilate( REGION *or, SeqInfo *seq, IMAGE *in, INTMASK *msk )
|
dilate_gen( REGION *or, void *vseq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
SeqInfo *seq = (SeqInfo *) vseq;
|
||||||
|
INTMASK *msk = (INTMASK *) b;
|
||||||
REGION *ir = seq->ir;
|
REGION *ir = seq->ir;
|
||||||
|
|
||||||
int *soff = seq->soff;
|
int *soff = seq->soff;
|
||||||
@ -283,7 +284,7 @@ im_dilate_raw( IMAGE *in, IMAGE *out, INTMASK *m )
|
|||||||
|
|
||||||
/* Generate!
|
/* Generate!
|
||||||
*/
|
*/
|
||||||
if( im_generate( out, start_dilate, gen_dilate, stop_dilate, in, msk ) )
|
if( im_generate( out, dilate_start, dilate_gen, dilate_stop, in, msk ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
out->Xoffset = -m->xsize / 2;
|
out->Xoffset = -m->xsize / 2;
|
||||||
|
@ -76,14 +76,11 @@ typedef struct {
|
|||||||
/* Stop function.
|
/* Stop function.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
stop_erode( SeqInfo *seq, IMAGE *in )
|
erode_stop( void *vseq, void *a, void *b )
|
||||||
{
|
{
|
||||||
/* Free attached objects.
|
SeqInfo *seq = (SeqInfo *) vseq;
|
||||||
*/
|
|
||||||
if( seq->ir ) {
|
IM_FREEF( im_region_free, seq->ir );
|
||||||
im_region_free( seq->ir );
|
|
||||||
seq->ir = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -91,12 +88,14 @@ stop_erode( SeqInfo *seq, IMAGE *in )
|
|||||||
/* Start function.
|
/* Start function.
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
start_erode( IMAGE *out, IMAGE *in, INTMASK *msk )
|
erode_start( IMAGE *out, void *a, void *b )
|
||||||
{
|
{
|
||||||
SeqInfo *seq = IM_NEW( out, SeqInfo );
|
IMAGE *in = (IMAGE *) a;
|
||||||
|
INTMASK *msk = (INTMASK *) b;
|
||||||
|
SeqInfo *seq;
|
||||||
int sz = msk->xsize * msk->ysize;
|
int sz = msk->xsize * msk->ysize;
|
||||||
|
|
||||||
if( !seq )
|
if( !(seq = IM_NEW( out, SeqInfo )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
/* Init!
|
/* Init!
|
||||||
@ -113,7 +112,7 @@ start_erode( IMAGE *out, IMAGE *in, INTMASK *msk )
|
|||||||
seq->soff = IM_ARRAY( out, sz, int );
|
seq->soff = IM_ARRAY( out, sz, int );
|
||||||
seq->coff = IM_ARRAY( out, sz, int );
|
seq->coff = IM_ARRAY( out, sz, int );
|
||||||
if( !seq->ir || !seq->soff || !seq->coff ) {
|
if( !seq->ir || !seq->soff || !seq->coff ) {
|
||||||
stop_erode( seq, in );
|
erode_stop( seq, in, NULL );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,8 +122,10 @@ start_erode( IMAGE *out, IMAGE *in, INTMASK *msk )
|
|||||||
/* Erode!
|
/* Erode!
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
gen_erode( REGION *or, SeqInfo *seq, IMAGE *in, INTMASK *msk )
|
erode_gen( REGION *or, void *vseq, void *a, void *b )
|
||||||
{
|
{
|
||||||
|
SeqInfo *seq = (SeqInfo *) vseq;
|
||||||
|
INTMASK *msk = (INTMASK *) b;
|
||||||
REGION *ir = seq->ir;
|
REGION *ir = seq->ir;
|
||||||
|
|
||||||
int *soff = seq->soff;
|
int *soff = seq->soff;
|
||||||
@ -281,7 +282,7 @@ im_erode_raw( IMAGE *in, IMAGE *out, INTMASK *m )
|
|||||||
|
|
||||||
/* Generate!
|
/* Generate!
|
||||||
*/
|
*/
|
||||||
if( im_generate( out, start_erode, gen_erode, stop_erode, in, msk ) )
|
if( im_generate( out, erode_start, erode_gen, erode_stop, in, msk ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
out->Xoffset = -m->xsize / 2;
|
out->Xoffset = -m->xsize / 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user