You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func smoothGPSData2(data []point, sigma float64) []point {
smoothedData := make([]point, len(data))
x := make([]float64, len(data))
y := make([]float64, len(data))
// Extract the latitude and longitude data into separate slices
for i, p := range data {
x[i], y[i] = p.lat, p.lng
}
// Create a Gaussian distribution with sigma as the standard deviation
dist := distuv.Normal{
Mu: 0,
Sigma: sigma,
}
// Convolve the data with the Gaussian kernel
for i := range x {
for j := range y {
kernel := dist.Prob(x[i] - x[j])
smoothedData[i].lat += kernel * x[j]
smoothedData[i].lng += kernel * y[j]
}
}
return smoothedData
}
The text was updated successfully, but these errors were encountered:
Documentation: https://jeffreyearly.com/smoothing-and-interpolating-noisy-gps-data/
Code example
The text was updated successfully, but these errors were encountered: