在Wikipedia (http://en.wikipedia.org/wiki/Bicubic_interpolation) 上找到了bicubic的描述,不过它只给出了知道导数情况下的公式。后来在CSDN上找到了C语言的算法描述(),改造了一下做了个测试。他没有给出插值样条,通常使用sin(x * PI) / x的逼近。
span::real Tessellation::sinxx(span::real value) {
if (value < 0) value = -value;
if (value < 1.0) {
span::real temp = value * value;
return 0.5 * temp * value - temp + 2.0 / 3.0;
}
else if (value < 2.0) {
value = 2.0 - value;
value *= value * value;
return value / 6.0;
}
else {
return 0.0;
}
}
以下是测试结果。
Nearest:

Bilinear:

Bicubic:

阅读(4827) | 评论(0) | 转发(0) |