LdDl / rust-road-traffic

Vehicle counting/tracking and speed estimation
19 stars 3 forks source link

Core refactor #14

Closed LdDl closed 1 year ago

LdDl commented 1 year ago
  1. New Web-UI. Looks like old (ha-ha), but developed with Svelte. Now it has separate repository. I did save old vanilla JS code just for history in src/lib/rest_api/static_old folder.
  2. Kalman filter is here https://github.com/LdDl/kalman-rs now.
  3. Multi-object tracker is here https://github.com/LdDl/mot-rs now.
  4. The way speed is estimated has been changed. Now calculations are not based on Haversine formula only but pixels per meter parameter for each convex polygon is considered to be used.
  5. For transformation X,Y (pixels) -> Lon,Lat (WGS84, EPSG4326) there is intermediate transformation into (and from) EPSG3857. It is used to get more realistic distances
  6. Skeleton term introduced. It is straight line between centers of two sides (currently those are predefined as FIRST and THIRD side of convex polygon. Need to be careful when building configuration). This line is used to calculate pixels per meter. Let user to change sides and skeleton parameters directly in further? Don't know: for me it is just easier to redraw polygon to get needed skeleton. Will see how it goes and then make decision if we need API to change sides for specifying skeleton line.
  7. Every point inside polygon are going to be projected on its skeleton line. That is how speed is measured (since we know pixels per meter we can calculate speed in m/s or km/h).
  8. Refactored Redis and Data analytics workers since the way they worked was really bad - they've used to use absolute timestamps of an operation system instead of relative timestamps to frames => that caused errors such like this use case: static video about ~3 minutes is processed for 9 minutes (e.g., due weak hardware) and then software says: "there were N vehicles per 9 minutes" - which is an error obviously
  9. Objects are tracked by lower bound of the detection box. It is done due the empirical analysis on some angle views - most of time lower bound of the detection box is closer to the ground - we assume it should estimate speed more correctly due the distance estimations
  10. Added REST API to monitor current occupancy status for the zone