資源簡介
雙立方插值實現,里面還有一個說明文檔,大家可以拿去參考

代碼片段和文件信息
//?Bicubic?interpolation.cpp?:?定義控制臺應用程序的入口點。
//
#include?“stdafx.h“
#include?
#include?
double?cubicInterpolate(double?p[4]?double?x)
{
return?p[1]?+?0.5?*?x*(p[2]?-?p[0]?+?x*(2.0*p[0]?-?5.0*p[1]?+?4.0*p[2]?-?p[3]?+?x*(3.0*(p[1]?-?p[2])?+?p[3]?-?p[0])));
}
double?bicubicInterpolate(double?p[4][4]?double?x?double?y)
{
double?arr[4];
arr[0]?=?cubicInterpolate(p[0]?y);
arr[1]?=?cubicInterpolate(p[1]?y);
arr[2]?=?cubicInterpolate(p[2]?y);
arr[3]?=?cubicInterpolate(p[3]?y);
return?cubicInterpolate(arr?x);
}
double?tricubicInterpolate(double?p[4][4][4]?double?x?double?y?double?z)
{
double?arr[4];
arr[0]?=?bicubicInterpolate(p[0]?y?z);
arr[1]?=?bicubicInterpolate(p[1]?y?z);
arr[2]?=?bicubicInterpolate(p[2]?y?z);
arr[3]?=?bicubicInterpolate(p[3]?y?z);
return?cubicInterpolate(arr?x);
}
double?nCubicInterpolate(int?n?double*?p?double?coordinates[])
{
assert(n?>?0);
if?(n?==?1)
{
return?cubicInterpolate(p?*coordinates);
}
else
{
double?arr[4];
int?skip?=?1?<(n?-?1)?*?2;
arr[0]?=?nCubicInterpolate(n?-?1?p?coordinates?+?1);
arr[1]?=?nCubicInterpolate(n?-?1?p?+?skip?coordinates?+?1);
arr[2]?=?nCubicInterpolate(n?-?1?p?+?2?*?skip?coordinates?+?1);
arr[3]?=?nCubicInterpolate(n?-?1?p?+?3?*?skip?coordinates?+?1);
return?cubicInterpolate(arr?*coordinates);
}
}
int?main()
{
//?Create?array
double?p[4][4]?=?{?{?1334?}{?7234?}{?1636?}{?2572?}?};
//?Interpolate
std::cout?<
//?Or?use?the?nCubicInterpolate?function
double?co[2]?=?{?0.1?0.2?};
std::cout?<
system(“pause“);
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1780??2017-06-08?14:09??雙立方插值實現\Bicubic?interpolation.cpp
?????文件?????372474??2017-06-09?14:03??雙立方插值實現\Bicubic?interpolation學習總結.pdf
?????目錄??????????0??2018-07-11?09:49??雙立方插值實現
-----------?---------??----------?-----??----
???????????????374254????????????????????3
- 上一篇:Vxworks6.8 SMP編程指導
- 下一篇:身份證閱讀器網頁控件
評論
共有 條評論