pageauc / speed-camera

A Unix, Windows, Raspberry Pi Object Speed Camera using python, opencv, video streaming, motion tracking. Includes a Standalone Web Server Interface, Image Search using opencv template match and a whiptail Admin Menu Interface Includes picam and webcam Plugins for motion track security camera configuration including rclone sync script. watch-app allows remotely controller camera configuration from a remote storage service name. Uses sqlite3 and gnuplot for reporting. Recently added openalpr license plate reader support.
Apache License 2.0
960 stars 169 forks source link

Calculating average speed does not match example in Wiki #126

Closed waubain closed 9 months ago

waubain commented 1 year ago

I read the Wiki on improving motion tracking. In the log output example the final average speed is the average of all the values, but on my log the averaged displayed and recorded is always the LAST Add value (6/6) which in the below case is 31.9 mph. Is this now a running average?

I am using speed-camera on a Windows 10 PC, with an IP bullet camera. Resolution = 1280x720.

My log

2023-01-03 15:21:14 INFO     speed_camera New  - 0/6 xy(91,95) Start New Track
2023-01-03 15:21:14 INFO     speed_camera  Add - 1/6 xy(192,92) 12.27 mph D=39/50 C=11 29x19=427 sqpx L2R
2023-01-03 15:21:14 INFO     speed_camera  Add - 2/6 xy(218,92) 22.49 mph D=26/50 C=11 28x18=398 sqpx L2R
2023-01-03 15:21:14 INFO     speed_camera  Add - 3/6 xy(243,91) 22.85 mph D=25/50 C=11 27x19=378 sqpx L2R
2023-01-03 15:21:14 INFO     speed_camera  Add - 4/6 xy(249,89) 18.27 mph D=6/50 C=10 47x20=611 sqpx L2R
2023-01-03 15:21:14 INFO     speed_camera  Add - 5/6 xy(295,91) 31.98 mph D=46/50 C=9 26x18=354 sqpx L2R
2023-01-03 15:21:14 INFO     speed_camera  Add - 6/6 xy(320,90) 31.89 mph D=25/50 C=13 26x18=365 sqpx L2R
2023-01-03 15:21:14 INFO     speed_camera  Saved media/images/20230103-152114.jpg
2023-01-03 15:21:16 INFO     isSQLite3  Success: File is sqlite3 Format data\speed_cam.db
2023-01-03 15:21:16 INFO     db_check   Success: sqlite3 Connected to DB data\speed_cam.db
2023-01-03 15:21:16 INFO     speed_camera  SQL - Inserted Data Row into data\speed_cam.db
2023-01-03 15:21:16 INFO     speed_camera End  - L2R Ave Speed 31.9 mph Tracked 229 px in 0.453 sec Calib 220px 5800mm

As a side note the Wiki on How to tune Motion Tracking there seems to be missing words when there is explanations of how to fix poor motion tracking.

If objects are moving faster and you get a lot of track timeouts and incomplete tracks eg track_count not achieve and could not calculate a final speed```

If objects are too close or too large eg camera is too close or objects too large in camera view then speed camera will have problems.

thanks 20230102-102743