match works

This commit is contained in:
John Cupitt 2014-05-26 14:20:38 +01:00
parent 246525e649
commit e2cda919ea
3 changed files with 20 additions and 4 deletions

3
TODO
View File

@ -1,6 +1,3 @@
- test vips_match()
seems not to work? a coordinate is swapped somewhere
- quickly wrap the useful bits of mosaicing/ - quickly wrap the useful bits of mosaicing/

View File

@ -121,6 +121,7 @@ vips_match_build( VipsObject *object )
VipsMatch *match = (VipsMatch *) object; VipsMatch *match = (VipsMatch *) object;
double a, b, dx, dy; double a, b, dx, dy;
VipsArrayInt *oarea;
VipsImage *x; VipsImage *x;
g_object_set( match, "out", vips_image_new(), NULL ); g_object_set( match, "out", vips_image_new(), NULL );
@ -160,13 +161,22 @@ vips_match_build( VipsObject *object )
&a, &b, &dx, &dy ) ) &a, &b, &dx, &dy ) )
return( -1 ); 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, if( vips_affine( match->sec, &x,
a, -b, b, a, a, -b, b, a,
"interpolate", match->interpolate, "interpolate", match->interpolate,
"odx", dx, "odx", dx,
"ody", dy, "ody", dy,
NULL ) ) "oarea", oarea,
NULL ) ) {
vips_area_unref( oarea );
return( -1 ); return( -1 );
}
vips_area_unref( oarea );
if( vips_image_write( x, match->out ) ) { if( vips_image_write( x, match->out ) ) {
g_object_unref( x ); g_object_unref( x );

View File

@ -492,6 +492,15 @@ vips_affine_build( VipsObject *object )
resample->out->Xsize = affine->trn.oarea.width; resample->out->Xsize = affine->trn.oarea.width;
resample->out->Ysize = affine->trn.oarea.height; 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! /* Generate!
*/ */
if( vips_image_generate( resample->out, if( vips_image_generate( resample->out,