【发布时间】:2017-09-06 19:33:06
【问题描述】:
我有很多点,我需要将均值滤波器(如下所述)转换为中值滤波器以平滑绘图。有人可以指导我吗?
# Mean Filter
smoothfilter <- function(feat, ntap)
{
ofeat <- feat # Actual data
nfeat <- length(feat) # Length of a actual data
nhtap <- floor(ntap / 2.0)
sf <- feat[1:(nfeat-ntap+1)]
for (j in 2:ntap) {
sf <- sf + feat[j:(nfeat-ntap+j)]
}
sf <- sf / ntap
ofeat[(nhtap+1):(nfeat-nhtap)] <- sf
ofeat
}
【问题讨论】:
-
你想做什么?你想要的输出是什么?
-
我只想比较均值滤波结果和中值滤波结果。我写了一个均值滤波器,但我对中值滤波器方法感到困惑。