can now displace affine input space

so hopefully that means you can change corner vs. centre convention
easily
This commit is contained in:
John Cupitt 2012-12-18 13:08:18 +00:00
parent 1fc10d56a8
commit e6eb08173f
5 changed files with 30 additions and 21 deletions

View File

@ -33,6 +33,7 @@
- all interpolators use corner convention ... we had round-to-nearest in
several of them before, causing a range of annoying problems
- redone im_affine*() as a class
- added input space displacement to affine
14/11/12 started 7.30.6
- capture tiff warnings earlier

9
TODO
View File

@ -1,14 +1,5 @@
- test affine labq processing
- now we've removed round-to-nearest from NN, we need something extra in the
affine transform to displace the input cods
dx/dy displace output
- make affinei into a class
- quadratic doesn't work for order 3

View File

@ -499,8 +499,10 @@ make_join( SymbolTable *st, JoinType type,
out->thistrn.b = -b;
out->thistrn.c = b;
out->thistrn.d = a;
out->thistrn.dx = dx;
out->thistrn.dy = dy;
out->thistrn.idx = 0;
out->thistrn.idy = 0;
out->thistrn.odx = dx;
out->thistrn.ody = dy;
/* Clean the table and propogate the transform down the RHS of the
* graph.
@ -519,8 +521,10 @@ make_join( SymbolTable *st, JoinType type,
trn.b = 0.0;
trn.c = 0.0;
trn.d = 1.0;
trn.dx = -out->cumtrn.oarea.left;
trn.dy = -out->cumtrn.oarea.top;
trn.idx = 0;
trn.idy = 0;
trn.odx = -out->cumtrn.oarea.left;
trn.ody = -out->cumtrn.oarea.top;
clean_table( st );
if( propogate_transform( out, &trn ) )
return( -1 );

View File

@ -80,8 +80,10 @@ apply_similarity( VipsTransformation *trn, IMAGE *in, IMAGE *out,
trn->b = -b;
trn->c = b;
trn->d = a;
trn->dx = dx;
trn->dy = dy;
trn->idx = 0;
trn->idy = 0;
trn->odx = dx;
trn->ody = dy;
vips__transform_set_area( trn );
if( vips__transform_calc_inverse( trn ) )
return( -1 );

View File

@ -78,6 +78,7 @@
* - gtk-doc
* 14/12/12
* - redone as a class
* - added input space translation
*/
/*
@ -334,6 +335,11 @@ vips_affine_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
ix += iarea->left;
iy += iarea->top;
/* And the input offset.
*/
ix -= affine->trn.idx;
iy -= affine->trn.idy;
q = VIPS_REGION_ADDR( or, le, y );
for( x = le; x < ri; x++ ) {
@ -429,6 +435,11 @@ vips_affine_build( VipsObject *object )
if( vips_object_argument_isset( object, "ody" ) )
affine->trn.ody = affine->ody;
if( vips_object_argument_isset( object, "idx" ) )
affine->trn.idx = affine->idx;
if( vips_object_argument_isset( object, "idy" ) )
affine->trn.idy = affine->idy;
if( vips__transform_calc_inverse( &affine->trn ) )
return( -1 );
@ -541,28 +552,28 @@ vips_affine_class_init( VipsAffineClass *class )
_( "Horizontal output displacement" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsAffine, odx ),
0, 10000000, 0 );
-10000000, 10000000, 0 );
VIPS_ARG_DOUBLE( class, "ody", 113,
_( "Output offset" ),
_( "Vertical output displacement" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsAffine, ody ),
0, 10000000, 0 );
-10000000, 10000000, 0 );
VIPS_ARG_DOUBLE( class, "idx", 112,
VIPS_ARG_DOUBLE( class, "idx", 114,
_( "Input offset" ),
_( "Horizontal input displacement" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsAffine, idx ),
0, 10000000, 0 );
-10000000, 10000000, 0 );
VIPS_ARG_DOUBLE( class, "idy", 113,
VIPS_ARG_DOUBLE( class, "idy", 115,
_( "Input offset" ),
_( "Vertical input displacement" ),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET( VipsAffine, idy ),
0, 10000000, 0 );
-10000000, 10000000, 0 );
}
static void