|
![](/i/fill.gif) |
Lutz-Peter Hooge wrote:
> I posted a patch adding bicubic interpolation to image_maps
> to .binaries.programming.
The matrix stated in the description (from image.cpp)
>* DESCRIPTION
>* calculates the interpolation between f[1] and f[2] at position x
>* using the cubic function given by:
>*
>* ( [-0.5 1.5 -2.5 0.5 ] [f[0]] )
>* [x^3, x^2, x, 1] * ( [ 1.0 -2.5 2.0 -0.5 ] * [f[1]] )
>* ( [-0.5 0.0 0.5 0.0 ] [f[2]] )
>* ( [ 0.0 1.0 0.0 0.0 ] [f[3]] )
>*
does not correspond to the code
>static DBL interp_cubic(DBL f[4], DBL x)
>{
> DBL val;
> val=(-0.5*f[0] + 1.5*f[1] - 1.5*f[2] + 0.5*f[3])*x*x*x
> +( 1.0*f[0] - 2.5*f[1] + 2.0*f[2] - 0.5*f[3])*x*x
> +(-0.5*f[0] + 0.5*f[1] )*x
> +( 1.0*f[1] );
> return(val);
>}
>
It seems that the code implements the other matrix:
( [-0.5 1.5 -1.5 0.5 ] [f[0]] )
[x^3, x^2, x, 1] * ( [ 1.0 -2.5 2.0 -0.5 ] * [f[1]] )
( [-0.5 0.5 0.0 0.0 ] [f[2]] )
( [ 0.0 1.0 0.0 0.0 ] [f[3]] )
Is it just a typing mistake or ?
>A few things to discuss:
>
>3) Currently the matrix with determines the coefficients for the
>cubic interpolation function is hardcoded. Would it make sense
>to let the user specifiy a different one?
It would be more convenient to have a choice, of course with some
default matrix hardcoded.
Gleb
Post a reply to this message
|
![](/i/fill.gif) |