该方法用于计算沿给定轴的一维样条滤波器。这些由样条滤波器过滤。
用法:scipy.ndimage.spline_filter1d(input, order=3, axis=-1, output=<class ‘numpy.float64’>)
参数
input:数组-输入数组
order:int-样条曲线的顺序,默认为3。
axis:int,-样条线过滤器沿其应用的轴。默认为最后一个轴。
output:ndarray-放置输出的数组,或者返回的数组的dtype。默认值为numpy.float64。
范例1:
Python3
# importing spline filter with one dimension.
from scipy.ndimage import spline_filter1d
# importing matplot library for visualiation
import matplotlib.pyplot as plt
# importing munpy module
import numpy as np
# creating an image
geek_image = np.eye(80)
# returns an image array format
geek_image[40,:] = 1.0
print(geek_image)
输出:
范例2:
Python3
# importing spline filter with one dimension.
from scipy.ndimage import spline_filter1d
# importing matplot library for visualiation
import matplotlib.pyplot as plt
# importing munpy module
import numpy as np
# creating an image
geek_image = np.eye(80)
geek_image[40,:] = 1.0
# in axis=0
axis_0 = spline_filter1d(geek_image, axis=0)
# in axis=1
axis_1 = spline_filter1d(geek_image, axis=1)
f, ax = plt.subplots(1, 3, sharex=True)
for ind, data in enumerate([[geek_image, "geek_image original"],
[axis_0, "spline filter in axis 0"],
[axis_1, "spline filter in axis 1"]]):
ax[ind].imshow(data[0], cmap='gray_r')
# giving title
ax[ind].set_title(data[1])
# orientation layout of our image
plt.tight_layout()
# to show image
plt.show()
输出:
相关用法
- Python Scipy stats.tsem()用法及代码示例
- Python Scipy stats.tvar()用法及代码示例
- Python Scipy stats.gmean()用法及代码示例
- Python Scipy stats.tmin()用法及代码示例
- Python Scipy stats.tstd()用法及代码示例
- Python Scipy stats.tmax()用法及代码示例
- Python Scipy stats.describe()用法及代码示例
- Python Scipy stats.mean()用法及代码示例
- Python Scipy stats.nanmedian()用法及代码示例
- Python Scipy stats.nanstd()用法及代码示例
- Python Scipy stats.nanmean()用法及代码示例
- Python Scipy stats.moment()用法及代码示例
- Python Scipy stats.mode()用法及代码示例
- Python Scipy stats.normaltest()用法及代码示例
- Python Scipy stats.skewtest()用法及代码示例
- Python Scipy stats.kurtosis()用法及代码示例
- Python Scipy stats.kurtosistest()用法及代码示例
- Python Scipy stats.relfreq()用法及代码示例
- Python Scipy stats.scoreatpercentile()用法及代码示例
- Python Scipy stats.itemfreq()用法及代码示例
- Python Scipy stats.histogram()用法及代码示例
- Python Scipy stats.cumfreq()用法及代码示例
- Python Scipy stats.variation()用法及代码示例
- Python Scipy stats.binned_statistic_dd()用法及代码示例
注:本文由纯净天空筛选整理自sravankumar8128大神的英文原创作品 Python SciPy – ndimage.spline_filter1d() function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。