From e2cda919ea466dd4848aac38ee476bc7b61ec49f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 26 May 2014 14:20:38 +0100 Subject: [PATCH] match works --- TODO | 3 --- libvips/mosaicing/match.c | 12 +++++++++++- libvips/resample/affine.c | 9 +++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index b267d2ad..97ac6e1b 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,3 @@ -- test vips_match() - - seems not to work? a coordinate is swapped somewhere - quickly wrap the useful bits of mosaicing/ diff --git a/libvips/mosaicing/match.c b/libvips/mosaicing/match.c index b465a39a..6cdec911 100644 --- a/libvips/mosaicing/match.c +++ b/libvips/mosaicing/match.c @@ -121,6 +121,7 @@ vips_match_build( VipsObject *object ) VipsMatch *match = (VipsMatch *) object; double a, b, dx, dy; + VipsArrayInt *oarea; VipsImage *x; g_object_set( match, "out", vips_image_new(), NULL ); @@ -160,13 +161,22 @@ vips_match_build( VipsObject *object ) &a, &b, &dx, &dy ) ) return( -1 ); + /* Output area of ref image. + */ + oarea = vips_array_int_newv( 4, + 0, 0, match->ref->Xsize, match->ref->Ysize ); + if( vips_affine( match->sec, &x, a, -b, b, a, "interpolate", match->interpolate, "odx", dx, "ody", dy, - NULL ) ) + "oarea", oarea, + NULL ) ) { + vips_area_unref( oarea ); return( -1 ); + } + vips_area_unref( oarea ); if( vips_image_write( x, match->out ) ) { g_object_unref( x ); diff --git a/libvips/resample/affine.c b/libvips/resample/affine.c index 13659405..2ec6787a 100644 --- a/libvips/resample/affine.c +++ b/libvips/resample/affine.c @@ -492,6 +492,15 @@ vips_affine_build( VipsObject *object ) resample->out->Xsize = affine->trn.oarea.width; resample->out->Ysize = affine->trn.oarea.height; +#ifdef DEBUG + printf( "vips_affine_build: transform: " + "a = %g, b = %g, c = %g, d = %g\n", + affine->trn.a, + affine->trn.b, + affine->trn.c, + affine->trn.d ); +#endif /*DEBUG*/ + /* Generate! */ if( vips_image_generate( resample->out,