sysnotes
← all notes Computer Vision

Geo-referencing detections from a GPS track

Posted 30 Apr 2026 · cv, gps, geospatial, mapping

A detection on frame 4173 is not useful. "A defect at this coordinate on the map" is. The bridge between the two is the GPS track from the camera, plus a bit of care about time.

Interpolate the track to frame time

GPS logs at 1-10 Hz, video runs at 25-30 fps, so most frames land between fixes. Interpolate position by timestamp instead of snapping to the nearest fix:

import numpy as np
def pos_at(t, track_t, lat, lon):
    return (np.interp(t, track_t, lat),
            np.interp(t, track_t, lon))

t = frame_idx / fps + video_start_epoch
lat_f, lon_f = pos_at(t, track_t, track_lat, track_lon)

Mind the offset

The camera clock and the GPS clock are never quite the same. A one second skew at highway speed is ~25 metres of error. Find the offset once by matching an obvious landmark in the footage to its known coordinate, then apply it to every frame.

Snap to the road, then dedupe

Raw fixes wander off the carriageway, so snap points to the road geometry (a map-matching pass against OSM works well). Then collapse the same physical defect seen across consecutive frames into one point by clustering detections that are within a few metres and share a class. Without that step one pothole becomes fifteen map markers and the report is unreadable.