# Catch Neighborhood Speeders With Your Webcam

[John] is keeping the neighborhood safe by keeping an eye out for speeders. Well, he’s really keeping a webcam out for speeders. His technique doesn’t use radar or lasers. He’s processing webcam frames in Python to calculate speed.

It comes down to some basic image manipulation. He firsts gathers the images necessary to make the calculations by using a motion-detecting webcam program called YawCam. The images are analyzed to establish which parts have changed between frames; this gets rid of all the stationary objects. Now the frames can be compared to establish the distance in pixels. By calibrating the shot through measurements of the target area, this data can be directly converted into actual distance. It is then compared with the timestamps from each frame to arrive at speed. This can be used for vehicles on the street like we see above, or more whimsical measurements like pet turtle progress.

## 53 thoughts on “Catch Neighborhood Speeders With Your Webcam”

1. asheets says:

I’ve been looking for something like this. I’m am going to blatantly copy it.

2. Skitchin says:

I used YawCam for a while – fantastic software! Can fire off all types of events. Even using a crappy webcam with horrible noise, I was able to tweak the sensitivity accurately enough to detect most motion.

I wonder how accurate/consistent the MPH readings are? Also, as a hacker I must ask… So how fast do you have to go past the webcam for it not to register/see you ;) Haha

1. ewertz says:

If it runs off of a PC — and you know it does — the jitter in the frequency of snapshots is going to be an accuracy killer. The capture needs to be done on a real real-time embedded system before he starts running and crying to the policy — wouldn’t last 60 seconds in court.

Think about all of the past, successful defenses against radar guns — and those are purpose-built devices to solve just this problem. A PC does not a real-time system make. There are lots of better, cheaper solutions to *this* particular problem. This would be fine for part of the auditing or pre-filtering of perps, but for measurement it’s likely poor. It could be more than sufficient for awareness-raising though.

1. HackTheGibson says:

Looking at his site, I doubt it was to run to the police. He started by seeing how fast his daughters soccer ball was going. Looks like he just got curious at how far he could go.

2. GaspingSpark says:

The evidence gathered by this would tell the police whether or not it was “profitable” to set up a speed trap in his neighborhood.

2. n0lkk says:

1Approx.186,000 MPS?

3. He at least has a turtle and a daughter! And lives in a house, next to a street! Doing pretty good I’d say.

4. Alex says:

That’s the first thing I was gonna say but you beat me to it.

Great design & implementation though.

5. Good work man, the question is will the police accept this as evidence? If the people speeding aren’t punished then what’s the point? Personally I hate speeders, If you are in a hurry then leave early.
I think I will copy this and have it automatically send the results to my local police.

@t&p: Some of us want to live in safe neighborhoods.

1. Daniel says:

The cops wont accept it as evidence, but it might help to convince them to visit the street more often with their equipment

2. draeath says:

1. asheets says:

In my area, it isn’t admissable, but it will cause a “friendly” visit from the local PD with “advice” for the driver.

3. iw2 says:

At least here in Germany it is illegal for a regular person to film/photograph random strangers without their consent (if they are not part of a crowd). At least here trying to use data captured this way as evidence would actually make it possible to sue the person collecting the data. Also, as this would be illegally obtained evidence, it wouldn’t be admissible.

So at least here it would lead to quite the opposite of what you would try to accomplish with it…

I couldn’t have said it better…. I am so feed up with the idiots that fly down my street!!!!!

6. abc says:

Your comment only serves to discourage people from sharing their innovation. I wish you would think twice before posting something mean-spirited in the future.

1. Rodger Pape says:

Don’t worry abc, this isn’t a new phenomenon. Pioneers like Josef Mengele faced the same discouragement during their day. Glad to know they have supporters like you.

7. n0lkk says:

And that’s different than many hackers, how?

8. b1r6m4n says:

Good thing motion-blur is easy unless the cam is of quality. I drive 40 through neighborhoods all the time, speedbumps = JUMPS. I do it because the HOAs love to sprinkle stopsigns, low speedlimits, and bumps everywhere…

1. Volfram says:

hey HAD, what’s this guy’s IP address? I’m sure someone here can figure out where he lives from it and dispense some good ol’ fashioned justice to a menace to society like him.

1. b1r6m4n says:

my ip is currently 75.242.246.161, but my modem is old and it changes a lot. you probably have a few days to try at my ssh, vnc, and qvis dvr (tcp 80) port openings. oh, utorrent and a vpn server is up too if that helps. i suppose they could give you my email as well. by any chance are you a member of an overbearing HOA similar to those i love to enrage?

2. b1r6m4n says:

i should add that this is an awesome project, but frankly will likely not bring much change in its current state. speeding on private roads alone is hard for police to do much about, same for the private stop-signs that you do not legally have to obey.

9. bio says:

speeding on an open road, yeah we all do it but in a negborhood with kids you go atleast 25 and if you dont your a dick

10. thebes42 says:

I suppose blaming the world for being dangerous and trying to change other people’s behaviours to make it “safe” must feel better than teaching one’s children to look before running into the road?
Must be a feel good thing, because it can’t have been more productive than having spent an equal amount of time teaching the kid that the world is a risky place and ultimately if they want to avoid harm they have to be ready for jerks who are unpredictable and even reckless.
This just seems like more of the nanny-state’s mentality that enough hall-monitoring will keep everything “safe”.

1. draeath says:

Shit happens. When it does, I would rather it be a dog or a soccer ball, and not a child who was less than perfect.

2. So, which one should know better, then? A child playing in the yard, or the adult operating a two ton vehicle?

Speed limits are usually there for a reason, you know. If you blast through in 60 at 2am I won’t shed any tears if you wrap your car around a lamp post, but if you keep doing it at times when innocent bystanders are likely to suffer you’re just a jerk.

1. thebes42 says:

And yet I do not do these things, though I do occasionally speed in a reasonable and customary fashion on the highway like most people.
I’m just saying that no matter what one does to attempt to change dangerous behaviours by jerks, there will always be dangerous jerks- and in general our society’s nanny-state mentality towards rule based public safety does not increase safety so much as it inconveniences individuals who are already attentive to safety.

BTW, its bs to say speed low limits are needed for safety when 20% of the public thinks its fine to tweet while driving. Give me an alert and attentive driver doing ten over rather than a drunk or a txt’er doing ten under any day.

3. fightcube says:

Your logic is seriously flawed. Please never have children and stay the hell off my street.

4. tjb says:

Any one who says “just teach your kids not to…” has obviously never really tried to raise a kid. They go threw phases where they are defiant and independent. They some times get mad and stomp off, or the ball bounces out and that’s all they think about. How about a kid with cognitive disabilities? Teaching your kids is important, but it is not the ONLY thing to do. I can’t stand parents who don’t discipline there kids but that is no excuse for someone to drive 45 MPH down my street. Pets have similar problems. Try teaching a new puppy or cat the road is bad.

We had a person near us who insisted on driving way to fast for our street several times a day. Took down the license plate and called the cops. I doubt she got a ticket but she DID get a visit and has since slowed down.

1. thebes42 says:

Back when I was a kid if I had stepped into the street without looking both ways, and I’d have gotten caught, my “arse would have been grass”. Actually I know quite a few middle-age adults who caught a licking for doing just that. It could really have killed me or any of my friends. Even our Irish Setter knew to look both ways before crossing the street.

Today, raising a child that way has somehow become “borderline child abuse” and it instead “takes a village to raise a child” – ie parents place their duties onto society as a whole because they are too irresponsible to actual parent, instead they let the internet, the tv, the schools, etc do it for them and cry in outrage that not everyone cares.

2. tjb says:

I think both teaching of kids AND policing individuals who pose a threat. You can’t rely on just one or the other. I am not calling the cops every time some one drives down our street to fast. But I will do what I can about repeat offenders.

5. Family07 says:

Even if you teach your kids to be safe, what I would call parenting or you would call being a “nanny”… a little child on a bike versus a car even at 25 miles an hour doesn’t have much of a chance . Yes kids do stupid and reckless things because they don’t grasp the concept of what can really happen to them, but as adults we know and should watch out for all the little ones! I’m guessing you’re not a parent because once you are you see things in a different way!!!! If my kid gets hurt on the baseball field that’s one thing but if a stupid idiot is driving 45 miles an hour down the street that they know little kids are riding bikes on that is that adult not the kid!!! It is senseless for adults to drive around Ikelea when children are around .

1. Family07 says:

In the last sentence it was supposed to say recklessly not Ikelea. Apparently my voice texting isn’t very good ????!

11. Rhyno says:

You guys, comparing this guy to a Nazi, and carrying on about his clearly self-righteous attempts to catch people speeding… Wow. How embarrassing. RTFA. The HAD description is merely a hook. He says nothing about working with the Gestapo to send a-holes to the gas chambers, or supporting the “nanny state”.

I actually thought the people who came here knew how to read. Especially with all the grammar nazis running around…

You see, ignorance is fine, as long as it isn’t something you publicly flaunt.

I’m sad for you guys… I just wish you’d find something useful to hate on.

12. I’m a little irked with the HAD staffer’s title for this. They took “measure the speed of objects in motion” and manufactured a controversy with this whole “catch speeders” thing.

I understand that the goal is to hook people, but lets not misrepresent the project with a leading title. Why not let the hackers visiting hackaday decide how the project could be used?

1. I really doubt that anyone expected controversy. This is impressive in its randomness as well as the extent people are arguing. We’re always surprised with what people will choose to latch on to for an argument.

1. fightcube says:

Ehh, I agree with Mark. You really did put words into his mouth… a lot of these people are being idiots over it also.

13. AussieTech says:

More strength to John’s arm.

This car went screaming up my quiet street driven by a first year probationary driver with a BAC of 0.19, then ran several red lights.

Fifteen minutes later in Mill Park it ripped a mature tree right out of the ground at an estimated impact speed of 140kph, killing five of the six young occupants instantly.

RIP Mill Park Tree

Steven Johnstone – Drunken Murderer

2 Days before – 2 days after RIP Matthew Lister

The next day their friends “commemorated” their dead mates by going to the site, getting drunk, and doing burnouts.

This is the bottom of the “memorial” the following day, and from personal observation it doesn’t do the litter of bottles justice;

http://neutrinodata.s3.amazonaws.com/theage-education/cmsimages/web/0e5d7482-0e1d-11df-a689-0014220c8f46-8369397.jpg

Police? Evidence? Ha! Mere technicalities. A few weeks later some longsuffering Mill Park residents finally took matters into their own hands one night and torched a bunch of cars belonging to local hoons.

This is why speed bumps, low limits, and stop signs. If some people have no self control others will do it for them – one way or another.

1. draeath says:

Darwin still does his magic, despite all our efforts to defeat him.

It sucks, yes. However, a stupid moron was removed from the gene pool.

I think it’s far more unfortunate that he took a few others out with him.

2. thebes42 says:

You already said that the five who died were running stop lights and violating the speed limit. Indeed the driver was even unlawfully drunk. Perhaps the speed bumps might have slowed them down, but drunken jerks will likely be drunken jerks if physically possible. Low speed limits and frequent stop signs would have done nothing but inconvenience those who, like most of us, choose to obey some semblance of the law.

FWIW I had a friend killed by a drunk in high school. That one was doing about 75mph in a 25 with his headlights off while fleeing from the police. Again, the laws and rules and any ideas about monitoring the public would have changed nothing. Maybe, but probably not, if she’d have had the sort of training for driving that they teacher in MSF motorcycle courses- that might possibly have given her a chance to get out of the way of the unexpected car chase.

14. echodelta says:

If we do it, be polite but firm at a personal level. Better than having the Police first. Neighborhood watches should watch first, collect data on frequent offenders. With data from neighborhood watches, greater penalty can apply legally when caught. Speed bumps should be illegal. No emergency vehicles no snowplows no bus service should be subject to such. Circles, curves, and yes narrowing the street have shown great results at human engineering.
On the hack side, add calibrated microphone at curb. Tag Db to car boomers for frequent offense, even at speed limit.

15. ejonesss says:

this will make it easier and cheaper for police to set up speed traps.

1. cheaper since common off the shelf web cams and laptops (or even second hand from electronics recyclers)

2. no license because cameras except for wireless dont transmit any radio waves (radar guns use microwave waves that need to be carefully controlled)

3. a license may still be required just because otherwise the speeder could argue “the officer was not licensed in speed clocking” and get the ticket thrown out. just like in other improper evidence handling.

16. axodus says:

I got something similar to that install in my city.
It’s an electronic sign that tells you how fast you’re going,
and a sign below with the legal top speed for that area.
It flashes his digit if your over spending.
It’s used for informational purposes, not for speed-trapping
But it does convey the message of “we are watching you” :)

1. Stoat says:

Add a camera and character recognition, have it flash up the registration too.

Watch how fast people slow down when they realise “this sign means YOU”

17. axodus says:

*over speeding (damn auto-complete) :P

18. fightcube says:

This is the type of commenter that should be banned from Hackaday.

19. i tried to do this with two webcams, that didn’t work out too well. Now with this dead-simple tutorial i can’t open yawcam, it throws an ‘unable to identify ip address’ error and doesn’t open the main window.

not cool yawcam. not cool.

20. Colibri says:

So, if that video-based solution is not *so* accurate, I’d be very interested to know how to build a solid radar using cheap parts. Like [1] or [2] (this one is not so cheap).

21. iyahdub says:

I think its good to be inquisitive , innovative, etc, and deffo protect kids in residential areas. Just dont use it to scam people out of more money… Police forces nowadays dont do much more than raise money for their corporations to the point of being pressured into having TARGETS WTF ?!? Worrying about money, the police ?!? Come on, peole open your eyes !! WAKE UP !!
But well done for the person whoo done this, as his intention was good !!

22. I know I’m late to the party but I do think this is a useful project. It’s obviously not evidence and doesn’t even capture the license plate but it could easily be used to say when when repeat offenders are most likely to be driving past. If it can be shown to the police that they can catch 5 speeders in 20 mins at a particular place then they might be motivated to do something.

Regards accuracy, I’d imagine it makes a big difference on what side of the road the car is driving on – cars nearer the camera will move across more pixels and so appear faster. Can the calibration be done by driving your car past at a set speed? it might be best to use a GPS for speed as speedometers can be 10% out.

The average speed of vehicles would be interesting to note. Also the number of vehicles. It might also be interesting to note the average size of vehicles as well. A future idea might be a web cam system for filming those repeatedly driving in city bus lanes – where I live there are many drivers with no insurance, road tax etc and I suspect it’s mainly these drivers who can “afford” to be in these lanes – obviously taxi’s, electric vehicles, emergency vehicles would need to be excluded manually.

I’ll also say I’m no angle on the road but I do fully understand peoples frustration.

23. Garry Smith says:

Rig it up to a shotgun = no complaints :)

24. Dave says:

Good old-fashioned point to point accuracy always work calculate the distance between two points and you come up with your speed and has always been useful in court, traffic surveys, Logistics issues and neighborhood safety. Now granted using video equipment could be a little complicated but if you had the capability of getting a multiplexer phasing it to a certified radar unit and get yourself certified it may not be able to give people tickets but it would certainly be a tool to get things started by collecting pretty decent and accurate information.

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.