fix morph on non-uchar images

This commit is contained in:
John Cupitt 2013-06-28 14:50:39 +01:00
parent de796417cb
commit 610f7aa0eb
4 changed files with 22 additions and 13 deletions

View File

@ -1,3 +1,6 @@
28/6/13 started 7.34.1
- fix morphological operators on non-uchar images
7/6/13 started 7.34.0
- version bump
- oops, VImage.PIL_mode_from_vips() failed for CMYK, thanks Alessandro

3
TODO
View File

@ -1,3 +1,6 @@
- 3-way dilate on a float image seems to be broken
- object construction is threadsafe, but class construction is not
https://github.com/jcupitt/libvips/issues/64

View File

@ -2,7 +2,7 @@
# also update the version number in the m4 macros below
AC_INIT([vips], [7.34.0], [vipsip@jiscmail.ac.uk])
AC_INIT([vips], [7.34.1], [vipsip@jiscmail.ac.uk])
# required for gobject-introspection
AC_PREREQ(2.62)
@ -17,7 +17,7 @@ AC_CONFIG_MACRO_DIR([m4])
# user-visible library versioning
m4_define([vips_major_version], [7])
m4_define([vips_minor_version], [34])
m4_define([vips_micro_version], [0])
m4_define([vips_micro_version], [1])
m4_define([vips_version],
[vips_major_version.vips_minor_version.vips_micro_version])
@ -37,7 +37,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
# binary interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=34
LIBRARY_REVISION=3
LIBRARY_REVISION=4
LIBRARY_AGE=3
# patched into include/vips/version.h

View File

@ -19,6 +19,8 @@
* 7/11/10
* - gtk-doc
* - do (!=0) to make uchar, if we're not given uchar
* 28/6/13
* - oops, fix !=0 code
*/
/*
@ -714,11 +716,12 @@ morphology( IMAGE *in, IMAGE *out, INTMASK *mask, MorphOp op )
/* Prepare output. Consider a 7x7 mask and a 7x7 image --- the output
* would be 1x1.
*/
if( im_cp_desc( out, in ) )
if( im_cp_desc( morph->out, morph->in ) )
return( -1 );
out->Xsize -= mask->xsize - 1;
out->Ysize -= mask->ysize - 1;
if( out->Xsize <= 0 || out->Ysize <= 0 ) {
morph->out->Xsize -= morph->mask->xsize - 1;
morph->out->Ysize -= morph->mask->ysize - 1;
if( morph->out->Xsize <= 0 ||
morph->out->Ysize <= 0 ) {
im_error( "morph", "%s", _( "image too small for mask" ) );
return( -1 );
}
@ -730,7 +733,7 @@ morphology( IMAGE *in, IMAGE *out, INTMASK *mask, MorphOp op )
printf( "morph_vector_gen: %d passes\n", morph->n_pass );
#endif /*DEBUG*/
}
else if( op == DILATE )
else if( morph->op == DILATE )
generate = dilate_gen;
else
generate = erode_gen;
@ -738,13 +741,13 @@ morphology( IMAGE *in, IMAGE *out, INTMASK *mask, MorphOp op )
/* Set demand hints. FATSTRIP is good for us, as THINSTRIP will cause
* too many recalculations on overlaps.
*/
if( im_demand_hint( out, IM_FATSTRIP, in, NULL ) ||
im_generate( out,
morph_start, generate, morph_stop, in, morph ) )
if( im_demand_hint( morph->out, IM_FATSTRIP, morph->in, NULL ) ||
im_generate( morph->out,
morph_start, generate, morph_stop, morph->in, morph ) )
return( -1 );
out->Xoffset = -mask->xsize / 2;
out->Yoffset = -mask->ysize / 2;
morph->out->Xoffset = -morph->mask->xsize / 2;
morph->out->Yoffset = -morph->mask->ysize / 2;
return( 0 );
}