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
983 stars 172 forks source link

[Questions] Raspberry Pi 3 + V2 Camera #13

Closed ayjay2017 closed 7 years ago

ayjay2017 commented 7 years ago

Hi Claude,

Thanks for putting together such a great project!

I'm trying to squeeze every last bit of performance out of my Raspberry Pi 3, and have hit a wall at around 26fps with a resolution of 912 x 400.

Do you have any suggestions for improving my framerate at this resolution? Also, what effect does resolution vs framerate have on the overall accuracy of the speed-cam readings? Finally, do you plan on releasing an updated version with the new OpenCV3.x?

Thanks again for your great work.

pageauc commented 7 years ago

Code should be compatible with opencv3. Let me know if you have an issue. You can reduce stream image size and it should increase fps but everything is a compromise. It still takes time to do the opencv processing so there is a limit to the fps since it will not be dependent on the camera as you are finding out. Speed camera crops the speed rectangle area and uses that to process for motion tracking. You might try reducing the size using config.py variables

# Crop Area for motion detection Tracking
# ---------------------------------------
x_left  = 25           # Exclude event if x less than this px position Default=25
x_right = 295          # Exclude event if x greater than this px position Default=295 
y_upper = 75           # Exclude event if y less that this value default=100
y_lower = 185          # Exclude event if y greater than this value default=175

These are for 240p image resolution see the config.py.720 if you are using 720p image resolution. You will need to make sure the motion track area is contained in this rectangle. Should reduce some opencv processing time and speed up fps a little.

Motion Tracking is somewhat dependent on the speed of the objects being tracked. Faster speeds require faster fps but will still work as long as track length stays inside monitoring rectangle.

Regards Claude ...