median

更新时间:2022-12-29 00:46:44 阅读: 评论:0


2022年12月29日发(作者:学籍查询网)

中值滤波(MedianFilter)

中值滤波(MedianFilter)

中值滤波的中⼼思想就是逐项地遍历信号,并⽤相邻信号项的中值替换当前值。这种⽅法是的滤波处理⾮常快速,⽽且对于⼀维数据集合和

⼆维数据集合(例如图像)都适⽤。

在下⾯的例⼦中,我们使⽤SciPy信号⼯具箱中的实现。

#!/usr/bin/python3.4

#_*_encode:utf-8_*_

importnumpyasnp

importpylabasp

assignal

#getsomelineardata

x=ce(0,3,101)

print('Withoutnoisy:',x)

#addsomenoisysignal

x[5::10]=1.5

print('Withnoisy:',x)

(x)

(t(x,3))

(t(x,5))

(['originalsignal','length3','length5'])

()

运⾏⽂本输出结果如下:

Withoutnoisy:[0.0.030.060.090.120.150.180.210.240.270.30.33

0.360.390.420.450.480.510.540.570.60.630.660.69

0.720.750.780.810.840.870.90.930.960.991.021.05

1.081.111.141.171.21.231.261.291.321.351.381.41

1.441.471.51.531.561.591.621.651.681.711.741.77

1.81.831.861.891.921.951.982.012.042.072.12.13

2.162.192.222.252.282.312.342.372.42.432.462.49

2.522.552.582.612.642.672.72.732.762.792.822.85

2.882.912.942.973.]

Withnoisy:[0.0.030.060.090.121.50.180.210.240.270.30.33

0.360.390.421.50.480.510.540.570.60.630.660.69

0.721.50.780.810.840.870.90.930.960.991.021.5

1.081.111.141.171.21.231.261.291.321.51.381.41

1.441.471.51.531.561.591.621.51.681.711.741.77

1.81.831.861.891.921.51.982.012.042.072.12.13

2.162.192.221.52.282.312.342.372.42.432.462.49

2.521.52.582.612.642.672.72.732.762.792.821.5

2.882.912.942.973.]

中值滤波,窗⼝长度为3和5:

从图形中可以看出,窗⼝越⼤,信号和原始信号相⽐失真越严重,但同时看上去也越平滑。

本文发布于:2022-12-29 00:46:44,感谢您对本站的认可!

本文链接:http://www.wtabcd.cn/fanwen/fan/90/50080.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

上一篇:geronimo
下一篇:smithy
标签:median
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图