diff --git a/TODO b/TODO index d257ca27..498f2f25 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,16 @@ +- it was quick .. + + $ time vips-7.38 vips im_label_regions ~/pics/babe.jpg x.v + 196640 + real 0m0.189s + user 0m0.173s + sys 0m0.031s + + now incredibly slow + + add a operation-name -> gtype cache? + - nip2 make check is failing - ink to vec etc. should work for complex .. output or accept a double-length @@ -52,6 +64,20 @@ put description first + should be: + + $ vips getpoint + read a point from an image + usage: + getpoint in x y + prints: + out-array + where: + in - Input image, input VipsImage + out-array - Array of output values, output VipsArrayDouble + x - Getpoint to read from, input gint + y - Getpoint to read from, input gint + diff --git a/libvips/morphology/labelregions.c b/libvips/morphology/labelregions.c index 117c6ad8..08d8c3a2 100644 --- a/libvips/morphology/labelregions.c +++ b/libvips/morphology/labelregions.c @@ -59,6 +59,7 @@ static int vips_labelregions_build( VipsObject *object ) { VipsMorphology *morphology = VIPS_MORPHOLOGY( object ); + VipsLabelregions *labelregions = (VipsLabelregions *) object; VipsImage *in = morphology->in; VipsImage **t = (VipsImage **) vips_object_local_array( object, 7 ); @@ -72,7 +73,7 @@ vips_labelregions_build( VipsObject *object ) /* Create the zero mask image. */ - if( vips_black( &t[0], in->Xsize, in->Ysize, 1, NULL ) || + if( vips_black( &t[0], in->Xsize, in->Ysize, NULL ) || vips_cast( t[0], &t[1], VIPS_FORMAT_INT, NULL ) ) return( -1 ); @@ -81,7 +82,7 @@ vips_labelregions_build( VipsObject *object ) if( vips_image_inplace( t[1] ) ) return( -1 ); - serial = 0; + serial = 1; m = (int *) t[1]->data; for( y = 0; y < t[1]->Ysize; y++ ) { for( x = 0; x < t[1]->Xsize; x++ ) { @@ -100,10 +101,13 @@ vips_labelregions_build( VipsObject *object ) } g_object_set( object, - "mask", t[1], + "mask", vips_image_new(), "segments", serial, NULL ); + if( vips_image_write( t[1], labelregions->mask ) ) + return( -1 ); + return( 0 ); } diff --git a/libvips/morphology/morphology.c b/libvips/morphology/morphology.c index 795d60eb..61d83713 100644 --- a/libvips/morphology/morphology.c +++ b/libvips/morphology/morphology.c @@ -134,8 +134,10 @@ vips_morphology_operation_init( void ) extern int vips_morph_get_type( void ); extern int vips_rank_get_type( void ); extern int vips_countlines_get_type( void ); + extern int vips_labelregions_get_type( void ); vips_morph_get_type(); vips_rank_get_type(); vips_countlines_get_type(); + vips_labelregions_get_type(); }