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

Calibration with different Screen Ratio and Framerate #156

Closed SpaceRichard closed 6 months ago

SpaceRichard commented 8 months ago

Hi

I used this tool currently in a docker testing envoirnment with version 11.22 (see #155 ).

My camera ist almost 90 degree to the street and in around 10m distance. I use a Reolink 810 with RTSP, the size ist 640x360 which not fit to any of the plugins. The framerate ist 15 fps

Calibration ..... cal_obj_px_L2R=160 px cal_obj_mm_L2R=4700 mm speed_conv_L2R=0.10575 cal_obj_px_R2L=150 px cal_obj_mm_R2L=4700 mm speed_conv_R2L=0.11280 (Change Settings in /root/speed-camera/config.py) Speed Trigger ... Log only if max_speed_over > 10 kph and track_counter >= 6 consecutive motion events Exclude Events .. If x_diff_min < 5 or x_diff_max > 40 px If y_upper < 35 or y_lower > 160 px or x_left < 200 or x_right > 520 px If max_speed_over < 10 kph If event_timeout > 0.50 seconds Start New Track track_timeout=0.30 sec wait after Track Ends (avoid retrack of same object) Speed Photo ..... Size=640x360 px image_bigger=1.0 rotation=0 VFlip=True HFlip=True image_path=media/images image_Prefix=speed- image_font_size=14 px high image_text_bottom=True image_jpeg_quality=95 image_jpeg_optimize=True Motion Settings . Size=640x368 px px_to_kph_L2R=0.105750 px_to_kph_R2L=0.112800 speed_units=kph CAM_LOCATION= None

As you see I set the motion track area to a 320x125px area. Cars are usually within 140-170px - I set 160px I don't touch the cal_obj_mm_L2R / cal_obj_mm_L2R yet I I think this should work out.

The results I get are > 150 km/h up to 600-700 km/h if it save something or it simply I dont get any result. Some delivery guy was tracked with >80km/h walking speed ...

Here some Log maybe I overseen something. speedcam_log_20231128.log

Here on the street are 30 km/h allowed and I guess it should not be over 50 km/h but by this huge difference I wonder where I have done the mistake in the settings

Thanks :)

SpaceRichard commented 8 months ago

So after some days with irregular results, I found my error. I don't get that I should calibrate with the detected size (green frame) and not with the real car size. As I have quite different size of the detected area/part It was hard to say the size correct.

So I used the area I want to use for detection 220px with are 4900mm - as R2L and L2R is the same distance (small street almost one lane) I think this would not make much differences.

I get now maybe 40-50% correct results or at least results that I would think could be correct. But still a lot of cars drive here above 300km/h :)