如何将Savitzky-Golay过滤器应用于在同一X坐标处具有2个以上Y坐标的GPS位置数据

2024-04-25 23:59:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我现在用的是全球导航卫星系统(GPS)接收器。你知道吗

全球导航卫星系统接收器给了我相当准确的位置信息。你知道吗

不过,我应该纠正他们建立一个无人机和车辆的参考地图。你知道吗

我在插值和平滑由X和Y坐标组成的地图时遇到了一些问题。你知道吗

我的地图是这样的。你知道吗

它在1 X坐标处有2个不同的Y坐标。你知道吗

enter image description here

我只想参考地图有一条线,而不是点。你知道吗

当我放大原始点数据时,它们看起来是这样的。你知道吗

enter image description here

为了使点成为一条线,我试着插值和平滑它们,但结果很差。你知道吗

我的结果在这里。你知道吗

结果不好的原因是在同一个X坐标上有两个以上的Y坐标

enter image description here

我的密码在这里。你知道吗

如何在数据上正确应用Savitzky-Golay过滤器?你知道吗

我应该使用2D过滤器吗?你知道吗

请帮帮这个可怜的小家伙。你知道吗

def interpolateNsmoothMap(self):
    coordinate_x_nparray = np.array(self.coordinate_x_list)
    coordinate_y_nparray = np.array(self.coordinate_y_list)
    xx = np.linspace(coordinate_x_nparray.min(), coordinate_x_nparray.max(), 10000)
    interpolated = scipy.interpolate.interp1d(coordinate_x_nparray, coordinate_y_nparray, kind='linear')
    smoothed = scipy.signal.savgol_filter(interpolated(xx), 1001, 3)

    plt.figure(figsize=(15, 15))
    plt.plot(xx, smoothed, marker='o', linewidth=0, markersize=10)
    plt.suptitle('Map')
    plt.xlabel('UTM X')
    plt.ylabel('UTM Y')
    plt.gca().xaxis.set_major_formatter(mtick.FormatStrFormatter('%.6f'))
    plt.gca().yaxis.set_major_formatter(mtick.FormatStrFormatter('%.6f'))
    plt.grid('on')
    plt.show()

Tags: imageselfcoordinatehere系统np地图plt