wired up new interpolation stuff to nip2
This commit is contained in:
parent
cbc77f433d
commit
c932070d3e
@ -12,6 +12,7 @@
|
||||
- revised transform / clip code, we now do corner not centre
|
||||
- yafr-smooth reworked along the lines of bicubic
|
||||
- cleanups after yafr hacking
|
||||
- added affinei_all
|
||||
|
||||
11/9/08 started 7.16.3
|
||||
- oop typo in manpage for im_project()
|
||||
|
@ -639,6 +639,8 @@ int im_affinei( IMAGE *in, IMAGE *out,
|
||||
VipsInterpolate *interpolate,
|
||||
double a, double b, double c, double d, double dx, double dy,
|
||||
int ox, int oy, int ow, int oh );
|
||||
int im_affinei_all( IMAGE *in, IMAGE *out, VipsInterpolate *interpolate,
|
||||
double a, double b, double c, double d, double dx, double dy ) ;
|
||||
int im_correl( IMAGE *ref, IMAGE *sec,
|
||||
int xref, int yref, int xsec, int ysec,
|
||||
int hwindowsize, int hsearchsize,
|
||||
|
@ -478,6 +478,28 @@ im_affinei( IMAGE *in, IMAGE *out, VipsInterpolate *interpolate,
|
||||
return( im__affinei( in, out, interpolate, &trn ) );
|
||||
}
|
||||
|
||||
int
|
||||
im_affinei_all( IMAGE *in, IMAGE *out, VipsInterpolate *interpolate,
|
||||
double a, double b, double c, double d, double dx, double dy )
|
||||
{
|
||||
Transformation trn;
|
||||
|
||||
trn.iarea.left = 0;
|
||||
trn.iarea.top = 0;
|
||||
trn.iarea.width = in->Xsize;
|
||||
trn.iarea.height = in->Ysize;
|
||||
trn.a = a;
|
||||
trn.b = b;
|
||||
trn.c = c;
|
||||
trn.d = d;
|
||||
trn.dx = dx;
|
||||
trn.dy = dy;
|
||||
|
||||
im__transform_set_area( &trn );
|
||||
|
||||
return( im__affinei( in, out, interpolate, &trn ) );
|
||||
}
|
||||
|
||||
/* Provide the old im__affine()/im_affine() as bilinear affinei.
|
||||
*/
|
||||
|
||||
|
@ -535,27 +535,11 @@ static im_arg_desc affinei_args[] = {
|
||||
IM_INPUT_INT( "h" )
|
||||
};
|
||||
|
||||
/* Call im_affinei via arg vector.
|
||||
*/
|
||||
static int
|
||||
affinei_vec( im_object *argv )
|
||||
static VipsInterpolate *
|
||||
get_interpolate( int interpol )
|
||||
{
|
||||
int interpol = *((int *) argv[2]);
|
||||
double a = *((double *) argv[3]);
|
||||
double b = *((double *) argv[4]);
|
||||
double c = *((double *) argv[5]);
|
||||
double d = *((double *) argv[6]);
|
||||
double dx = *((double *) argv[7]);
|
||||
double dy = *((double *) argv[8]);
|
||||
int x = *((int *) argv[9]);
|
||||
int y = *((int *) argv[10]);
|
||||
int w = *((int *) argv[11]);
|
||||
int h = *((int *) argv[12]);
|
||||
|
||||
VipsInterpolate *interpolate;
|
||||
|
||||
int result;
|
||||
|
||||
switch( interpol ) {
|
||||
case 1:
|
||||
interpolate = vips_interpolate_nearest_new();
|
||||
@ -579,12 +563,35 @@ affinei_vec( im_object *argv )
|
||||
|
||||
default:
|
||||
im_error( "affinei_vec", "%s", _( "bad interpolation" ) );
|
||||
return( -1 );
|
||||
interpolate = NULL;
|
||||
}
|
||||
|
||||
return( interpolate );
|
||||
}
|
||||
|
||||
/* Call im_affinei via arg vector.
|
||||
*/
|
||||
static int
|
||||
affinei_vec( im_object *argv )
|
||||
{
|
||||
int interpol = *((int *) argv[2]);
|
||||
double a = *((double *) argv[3]);
|
||||
double b = *((double *) argv[4]);
|
||||
double c = *((double *) argv[5]);
|
||||
double d = *((double *) argv[6]);
|
||||
double dx = *((double *) argv[7]);
|
||||
double dy = *((double *) argv[8]);
|
||||
int x = *((int *) argv[9]);
|
||||
int y = *((int *) argv[10]);
|
||||
int w = *((int *) argv[11]);
|
||||
int h = *((int *) argv[12]);
|
||||
VipsInterpolate *interpolate;
|
||||
int result;
|
||||
|
||||
if( !(interpolate = get_interpolate( interpol )) )
|
||||
return( -1 );
|
||||
result = im_affinei( argv[0], argv[1], interpolate,
|
||||
a, b, c, d, dx, dy, x, y, w, h );
|
||||
|
||||
g_object_unref( interpolate );
|
||||
|
||||
return( result );
|
||||
@ -601,6 +608,55 @@ static im_function affinei_desc = {
|
||||
affinei_args /* Arg list */
|
||||
};
|
||||
|
||||
/* affinei args
|
||||
*/
|
||||
static im_arg_desc affinei_all_args[] = {
|
||||
IM_INPUT_IMAGE( "in" ),
|
||||
IM_OUTPUT_IMAGE( "out" ),
|
||||
IM_INPUT_INT( "interpolate" ),
|
||||
IM_INPUT_DOUBLE( "a" ),
|
||||
IM_INPUT_DOUBLE( "b" ),
|
||||
IM_INPUT_DOUBLE( "c" ),
|
||||
IM_INPUT_DOUBLE( "d" ),
|
||||
IM_INPUT_DOUBLE( "dx" ),
|
||||
IM_INPUT_DOUBLE( "dy" )
|
||||
};
|
||||
|
||||
/* Call im_affinei via arg vector.
|
||||
*/
|
||||
static int
|
||||
affinei_all_vec( im_object *argv )
|
||||
{
|
||||
int interpol = *((int *) argv[2]);
|
||||
double a = *((double *) argv[3]);
|
||||
double b = *((double *) argv[4]);
|
||||
double c = *((double *) argv[5]);
|
||||
double d = *((double *) argv[6]);
|
||||
double dx = *((double *) argv[7]);
|
||||
double dy = *((double *) argv[8]);
|
||||
VipsInterpolate *interpolate;
|
||||
int result;
|
||||
|
||||
if( !(interpolate = get_interpolate( interpol )) )
|
||||
return( -1 );
|
||||
result = im_affinei_all( argv[0], argv[1], interpolate,
|
||||
a, b, c, d, dx, dy );
|
||||
g_object_unref( interpolate );
|
||||
|
||||
return( result );
|
||||
}
|
||||
|
||||
/* Description of im_affinei.
|
||||
*/
|
||||
static im_function affinei_all_desc = {
|
||||
"im_affinei_all", /* Name */
|
||||
"affine transform of whole image",
|
||||
IM_FN_TRANSFORM | IM_FN_PIO, /* Flags */
|
||||
affinei_all_vec, /* Dispatch function */
|
||||
IM_NUMBER( affinei_all_args ), /* Size of arg list */
|
||||
affinei_all_args /* Arg list */
|
||||
};
|
||||
|
||||
/* similarity args
|
||||
*/
|
||||
static im_arg_desc similarity_args[] = {
|
||||
@ -943,6 +999,7 @@ static im_function maxpos_subpel_desc= {
|
||||
static im_function *mos_list[] = {
|
||||
&affine_desc,
|
||||
&affinei_desc,
|
||||
&affinei_all_desc,
|
||||
&align_bands_desc,
|
||||
&correl_desc,
|
||||
&find_lroverlap_desc,
|
||||
|
Loading…
x
Reference in New Issue
Block a user