Jump to content

Any coders that could lend a hand?


Aspman

Recommended Posts

We've got a problem with speeders through the village, we're in a 40 but a lot (possible the majority) of cars are well above that. Traffic monitoring last year showed a lot of cars doing 80+ and an outright winner doing 105mph.
We've no paths and kids have to walk along the verge to get the school bus and cross the road with cars doing these speeds so it's a real issue.
We got a few VAS signs put up but if anything they seems to have made thing worse. The signs are in the middle of the village and ether side has now become an assumed NSL zone.
Councils won't do anything unless you've proof so I found a guide online to setup a Raspberry Pi with a camera as a defacto speed camera.

https://www.hackster.io/hodgestk/traffic-camera-9d3739

It uses OpenCV to detect objects coming into view and times their passing through. simple bit of maths works out the speed.
I can follow instructions but I'm no coder and I can only get so far with this.
The guide is a few years old and most of the software has moved on a bit. I've worked my way through but now got stuck.

The code wants to call picamera for Opencv to work, but the newer versions of the OS use Libcamera.
It's past my knowledged to switch the code from one to the other.

Any Python gurus help out?

Link to comment
Share on other sites

Suggest asking your local road safety committee for the loan of a hand-held speed camera. 80+ is unacceptable. Local Police should be able to advise who to contact. 

  • Like 3
Link to comment
Share on other sites

If you have no joy an Automatic Traffic Counter speed survey using pneumatic tubes should be about £150 for a weeks worth of data from any one of many traffic survey companies and will pick up every vehie in that period. It'll be data that an LA will accept as fact too, unlike a DIY set up. 

 

A hand held radar gun is about £250 to buy but can be tricky to use accurately. 

Edited by skomaz
  • Like 1
Link to comment
Share on other sites

Wont the L.A. have to give permission for that to be installed across the road?

 

At only £150 they should be jumping at the opportunity to pay for it to be done themselves to display their green credentials.

 

Its a big problem on my single track chemin rural, its not the volume of traffic but the speeds that people drive through inches from peoples front gates while staring at their phones, from my balcony I can see right into the drivers seat and its also much safer than being near the gate, by far the worst culprits for speed and not looking at the road (using their phones) are the young mothers with children in the back, for outright speed its the young males, no change there.

 

I would be interested in being able to measure and record outright speeds, it needs to be something running automatically, I suppose a video recording and knowing the distance between two points within the field of view to calculate the speed would be the easiest and from having already presented video recordings to my friend the Maire in the Nord I know that the visual image is more than enough to get the message across, maybe even better than speed readings alone.

 

That might be the way for the OP unless they are up against people without any compassion who will only react in the face of data.

Link to comment
Share on other sites

  • 8 months later...

As I type this evening already

If anything I think this was under reading and he was still gunning it as he passed me, still another 600m of 40mpg  limit to go.

Screenshot 2024-04-29 190949.png

  • Sad 3
Link to comment
Share on other sites

18 hours ago, @Lee said:

Not bad for a MkV Escort tbh.

Obvs a kittens though. 


Think it was a Rover 45

  • Like 2
Link to comment
Share on other sites

1 hour ago, Aspman said:


Think it was a Rover 45

 

Yep definitely an older Rover as far as I can tell.

Link to comment
Share on other sites

20 hours ago, Aspman said:

still another 600m of 40mpg  limit to go

So he has to accelerate hard, to keep the fuel consumption below 40mpg.

  • Haha 2
Link to comment
Share on other sites

I should just be allowed to throw rocks at them or something

Screenshot 2024-04-30 203347.png

  • Like 2
Link to comment
Share on other sites

Can you get the camera and pi to recognise the car and sprinkle a few nails???

Link to comment
Share on other sites

Interesting to read my comment from last year, I had forgotten about it.

 

We have a very pro-active Maire here, since my posting he has installed a "radar pedagogique" a solar powered speed camera mounted on a pole with a concrete block base, it detects vehicles approaching and flashes the speed limit, it then flashes their speed in red if above the limit and green if below, the intention was to "sensibilise" drivers whilst gathering data to be used to decide whether to make my road a Zone 30 (30kph speed limit pedestrians have priority) and possible traffic calming measures.

 

2 weeks later the previous 50km/h limit was scrapped and it became a zone 30, so far it has not made a lot of difference but if the traffic calming comes in it should do, I am going to ask that the speed camera be moved to the other end of the road just beyond my house to record vehicles coming from the other direction as they approach much faster from there due to having to negotiate a junction to approach from the main road.

Link to comment
Share on other sites

On 14/08/2023 at 15:59, Aspman said:

 Traffic monitoring last year showed a lot of cars doing 80+ and an outright winner doing 105mph.
 

who did the traffic monitoring? 
What equipment was used?
#curious :)

Link to comment
Share on other sites

17 hours ago, J.R. said:

Interesting to read my comment from last year, I had forgotten about it.

 

We have a very pro-active Maire here, since my posting he has installed a "radar pedagogique" a solar powered speed camera mounted on a pole with a concrete block base, it detects vehicles approaching and flashes the speed limit, it then flashes their speed in red if above the limit and green if below, the intention was to "sensibilise" drivers whilst gathering data to be used to decide whether to make my road a Zone 30 (30kph speed limit pedestrians have priority) and possible traffic calming measures.

 

2 weeks later the previous 50km/h limit was scrapped and it became a zone 30, so far it has not made a lot of difference but if the traffic calming comes in it should do, I am going to ask that the speed camera be moved to the other end of the road just beyond my house to record vehicles coming from the other direction as they approach much faster from there due to having to negotiate a junction to approach from the main road.


We have 3x VAS signage up that does exactly this. But they don't record or even log speeds.

 

Screenshot 2024-05-01 164258.png

Screenshot 2024-05-01 164406.png

Link to comment
Share on other sites

Posted (edited)
1 hour ago, Aspman said:


We have 3x VAS signage up that does exactly this. But they don't record or even log speeds.
 

 

I'd ask again about that - as the vast majority of them CAN be set up to record and log vehicle numbers and speeds - I know that for a fact as I've used data from them in the past and have also been involved in specifying them for projects.  It should therefore be a relatively simple task for the LHA to tweak them and download the data at regular intervals and get traffic flow volumes as well as things like average, maximum and 85%ile speeds.

Edited by skomaz
  • Like 1
Link to comment
Share on other sites

14 hours ago, Winston_Woof said:

who did the traffic monitoring? 
What equipment was used?
#curious :)


Going back, that was the council prior to the VAS signs going up.
It was the usual setup with a couple of pneumatic tubes

Link to comment
Share on other sites

51 minutes ago, Aspman said:


Going back, that was the council prior to the VAS signs going up.
It was the usual setup with a couple of pneumatic tubes

So presumably at the time not nearly all the cars were speeding then otherwise something would have been done. 
 

im not saying that there aren’t cases of excessive speed but is it possible that there are some positive bias issues?

 

eg for the handful your pi has caught “speeding” how many weren’t?

Link to comment
Share on other sites

also vehicles with loud pipes in low gears sound faster than they really are.

That's another Positive Bias or False Perception or whatever it's called

Link to comment
Share on other sites

16 minutes ago, Winston_Woof said:

also vehicles with loud pipes in low gears sound faster than they really are.

That's another Positive Bias or False Perception or whatever it's called

I think it's observer bias; the observer expects to find cases of $phenomenon and so tends to notice those cases more than cases not meeting that circumstance.

  • Like 1
Link to comment
Share on other sites

59 minutes ago, Winston_Woof said:

for the handful your pi has caught “speeding” how many weren’t?

 

That's why 85%ile info is the measure that is used. 

Link to comment
Share on other sites

5 hours ago, skomaz said:

 

That's why 85%ile info is the measure that is used. 

Even that's a misuse of statistics; what the eightyfifth percentile figure is correctly used to measure is the quantity that 85% of all observed phenomonae are at or below. In this case, the speed that 85% of drivers drive at or below in the absence of any legal penalties.

Link to comment
Share on other sites

14 hours ago, Aspman said:

 

Screenshot 2024-05-01 164406.png



That Image has made me think.

If there are no parking restrictions on the road  a pair of transits (other vans are available)  strategically parked to form a chicane might slow the traffic down ;o)

  • Like 1
Link to comment
Share on other sites

Posted (edited)
11 hours ago, Winston_Woof said:

So presumably at the time not nearly all the cars were speeding then otherwise something would have been done. 
 

im not saying that there aren’t cases of excessive speed but is it possible that there are some positive bias issues?

 

eg for the handful your pi has caught “speeding” how many weren’t?

the Pi records all cars speeds above 17mph to generally exclude cyclists and pedestrians. The percentage speeding is significant but not the majority.
The app can chart by hour the average speed but also records each event. I'm working on a way to extract the data as a CSV so it's easier to plug into Excel.
It's not perfect and the AI can glitch where it detects more than one object on a vehicle, I've noted a few unlikely speeds (clocked a bin lorry at 88 but it was probably stationary or close to 5mph as it was collecting so the AI has glitch on an part of the image shape) but these are fairly minimal and generally obvious.

We actually have the data from the council monitoring but I'm not particularly adept at excel analysis. Can upload if anyone wants to play.

Edited by Aspman
Link to comment
Share on other sites

11 hours ago, Winston_Woof said:

also vehicles with loud pipes in low gears sound faster than they really are.

That's another Positive Bias or False Perception or whatever it's called


Getting the pi in and working was a way to try to get around that.
I work from home in a room that faces the road. Noise defintey changes on road conditions, the car sound faster when the road is wet for instance. And yes some cars sound faster than they are going.
But some cars are phenominally over the limit and that is obvious. Often it's the same cars. I now recognise a few of them. A beat-up old Focus ST, a new Fiesta ST, Blue 3 series etc, I see these cars every day and have thought they were always too fast. Pi is proving it to some extent.

We are getting more police presence on the road and most visits result in 3-5 referrals to procurator (so court appearance not just 3 points).

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Community Partner

×
×
  • Create New...

Important Information

Welcome to BRISKODA. Please note the following important links Terms of Use. We have a comprehensive Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.