fix up labelregions

This commit is contained in:
John Cupitt 2014-02-12 10:33:31 +00:00
parent 3c1815ea67
commit eaa8bbe729
3 changed files with 35 additions and 3 deletions

26
TODO
View File

@ -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

View File

@ -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 );
}

View File

@ -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();
}