|
|
I found a possible bug in image.c of V3.1g.
If this has been already fixed in V3.5, I am sorry for
the posting.
The below C code is 'bilinear' function in image.c of V3.1g.
I think the "if ((p == 0.0) && (q == 0.0)) {...}" was
added in order to reduce the calculation time.
But the return value with the 'if' statement is different
from the value without the statement in case p=0 and q=0.
The return value in the 'if' statement should be *(corners+3).
Or, it's better to remove the 'if' statement, because
probability of the 'if' case is very small in usual interpolation
processes.
Same as 'norm_dist' function.
R. Suzuki
//-------------------------------------------------
static DBL bilinear(DBL *corners, DBL x, DBL y)
{
DBL p, q;
DBL val;
p = x - (int)x;
q = y - (int)y;
if ((p == 0.0) && (q == 0.0))
{
return (*corners); /* upper left */
}
val = (p * q * *corners) + (q * (1 - p) * *(corners + 1)) +
(p * (1 - q) * *(corners + 2)) + ((1 - p) * (1 - q) * *(corners + 3));
return (val);
}
Post a reply to this message
|
|