Detect Speed with a Raspberry Pi, Camera and OpenCV

Heyya mates @HaRmX96210944 @odje210947 ,

So long as you have enabled the toggle switch that you can see in the image below you will have a web server that you can access. This will also provide you with an IP Address that you can type into the URL of any internet browser on any locally connected device. With that IP Address (it will look like something like | http://172.17.0.1:8080 | ) typed and entered into the URL you will access the speed-cam web server. You may have to enter a username and password if it is your first time.

Hopefully that helps you both :blush:,
Tim

2 Likes

sorry but i cant access

Hi & thanks for the material!

I am new to Raspberry Pi although I have now 2 Pi 4 B’s. Having gone through the tutorial 2x I have been able to pull up an operational speed camera menu box but cannot access the output via a web page. Using a Pi camera v2 camera, the camera is not seen in the Raspberry Pi Configuration interface choices but using sudo raspi-config I1 shows Legacy Camera enable and getting images with raspistill.

I have hours into this and willing to pay for support.

Please advise, thanks in advance DAG

Looks like this thread has gone a bit quiet and a few folk with unresolved problems, somewhat discouraging. I have same issue as previous 2 posters. Pi4B 4GB, Buster and Pi HQ camera. Camera working tested with raspistill and webpage available locally which displays the webserver.txt file only. The speedcam is not recording anything (tested with a toy car on the workbench). Also , the ip address displayed in the menu item B is not the same as my pi address as seen on the router. If I try the ip address in the menu item B then there is no page displayed.

Any assistance will be appreciated
Many thanks

I have success now just following the install guide on the github page. The install process is also much faster.

1 Like

I’ve been looking through the code, is there a way to convert KPH to MPH within the program?

The code can be found here:
speed-camera/speed-cam.py at master

The settings start at line 87. The one you want is “MO_SPEED_MPH_ON”.

1 Like

Has anyone had any issues with vehicles running through the frame too fast for the program to capture? I’m using Raspberry Pi Camera Module 3 standard lens and RPI4.

Hey Michael,

sounds like you are capturing quite a significant speed there! Its possible that you may have it set up a bit close to where the vehicles are moving past, try and back the camera up a bit to see if that helps capture the object a bit better.

Cheers,
Blayden

Hello,
i have tried and failed to get this to work. I have deployed Buster but it seems to upgrade to Bullseye. This lead me onto this page

this took a very long time, installs and i can import cv2 in python but i dont know how to access the webpage, not sure there is one.
I am not proficient in Linux but i need to get this working.
I have the same camera as in the video with the same lens and it is on a Pi4b.

Please help.

just to confirm @Tomasz263501 - have you followed our guide specifically for installing an old version of RPi OS?

Are you sure that you aren’t inadvertently running an full-upgrade at any point?

i have realised my error, i have run your install steps but only get a ‘default’ webpage using the install procedure i posted for OpenCV and the speed camera you have done.

   webserver.py
           written by Claude Pageau

This is a stand alone web server.

Please Note
You will need at least one entry in a folder
before the web server will display content.
IMPORTANT: Use browser refresh to update files list
then select a list hyperlink.
Default config.py webserver settings are

    WEB_PAGE_REFRESH_ON = True
    WEB_PAGE_REFRESH_SEC = "900"
    WEB_PAGE_BLANK_ON = False

If a folder is selected on the right pane listing
the folder contents will appear in existing browser tab.
Select the <BACK link on Right panel listing to
navigate back to previous folder. <BACK will not
be displayed when in web server root folder.
Use browser refresh button to update web page and
display most recent data.

This web server can display other types of content.
Web pages with javascript, css Etc will run.
If a folder has an index.html it will take over
the browser tab.
This browser can only access local raspberry pi
files. It cannot access internet web pages.

see pi-timolo github wiki for more details

https://github.com/pageauc/speed-camera/wiki

hello,
thank for the instructions, i have flashed the sd card with buster and run the install procedure how ever i still get the webpage with the text message as shown (webserver.txt)

That’s progress @Tomasz263501!

It seems to me that there is no file being created to analyse. Have you started both services? the webserver and the speed_camera.py options detailed here at 4:27

We’re deep in the weeds and at a limit of our expertise here - perhaps it’s appropriate to raise a Github Issue on the original repo so the project creator can weigh in.

1 Like

Yes.
The Pi i have has arm17 architecture and from what i have read it doesn’t support libcamerra

Which Pi are you using out of interest?

Hello,
I know what the problem is, I was gifted a pi but I investigated the amount of RAM it has and it only has 2GB. This is the problem, thank you for your time on this and when my 4GB version turns up I will test again.

Ton

1 Like

great troubleshooting there - that’s one to add as a sanity check for other users.

If anybody else would like to query their ram capacity, you can use the free and/or top commands