Our hackspace sometimes has a problem with people leaving things in the sink for washing and then getting distracted on uber-awesome project. Obviously being a technical place a technical solution to (a social) problem was needed.
Cue the Great OpenCV Washing-Up Detector!
I've been mucking about with shape recognition in OpenCV for a while and recently managed to get the HoughCircles feature to work with the Python bindings. The HoughCircles function takes a binary (black and white) image and attempts to find circular shapes in it. Well, what shape are most things that are left in the sink? Yup, circular.
I'd managed to repurpose an opencv testing script to look for circular shapes in an image and look for a plug-hole positioned and sized circles to exclude, anything left over is a plate, cup or bowl. This increments a counter and at preset levels will trigger an annoyance to get people to clean up.
So the software worked well enough with testing images, time to mount this permanently and get some real data going. First step was to mount the camera above the sink
This gives us a nice view of the sink. Good! Theres already "training data" in it
Next step was to mount the beaglebone on something so that it doesnt short out on the Altoids tin. Some junk perspex and M3 bolts saw to that

LOL I LIKEZ CASE MODDINGS, I HAZ DREMEL
Mark and I pulled some more network cable over the ceiling so I can monitor software remotely
This is what the camera sees, its taking a snapshot and feeding it into OpenCV. Its then Canny thresholded and blurred before being run through the circle detector. Notice here its missed the glass, it doesnt show up on the edge detection images.
Theres a little bit of faffing to set some parameters for the edge detection but given that there is only artificial lighting around it they shouldnt need adjusting. I have added a feature to shut the alarms up when the lights are off though, thats just averaging the brightness levels from an HSV copy of the image though.
So what alarms are installed? Well I started by triggering the Hackspace traffic lights (formerly the IRC Rage-meter).

and here we go, after 5 minutes of their being crap in the sink the green light comes on, prompting loads of "wtf is that?" messages which are followed up by one of us saying "go do the f**king washing up"
I've also added a mode where it shouts on our IRC channel, next I'll be adding some air horns or something to really wake people up!
I'll post the code if enough people are interested.






hahaha this is awsum MAKE MORE THINGZ
Yup, definitely interested in code. We have a similar problem here at work and this would be a great way to get the lazy wasters to wash up their own stuff!
Have played with OpenCV in terms of facial recognition, and found it to be very powerful, if only a little confusing in places.
I would love to see the code!
Now that you have some experience with OpenCV, you could have it recognize and say rude things to persistent offenders. I saw a couple of people talking smack about 'what a waste' of time and tech this is. The spam filters would eliminate what I really want to say to them, so I'll leave it alone and just tell you I think it is a marvelous project. Please do post code. Especially anything you had to do to get the webcam to work- this is the sort of problem that ends up choking a lot of projects, and whatever you found would be appreciated by the hardcore hackers out here.
super work dude.... interested in seeing the code.....
GIMME DAT CODE
I see that you've found a cool application for the traffic signal : ).
Every time a dremel disc shatters to pieces while cutting, I pray it doesn't hit anything fragile, like an LCD screen.
I would like to see the code it can be a fun trick at my home :), i also worked with openCv before but i would like to see how its implemented, especially the irc, traffic lights...
cool idea
or my eyes.....
well one if my other CV projects I'm playing with is facial recognition, it might be interesting to mash the two projects together and start identifying offenders :)
I'll document the Beaglebone image build as well, having seen how bad some of the documentation is it can only be a good thing!
I'll post the code for the CV stuff later when I get home from work (or more likely: to the hackspace tonight!).
The traffic lights are a couple of solid-state relays connected to an arduino that we use for an LED board, I've taken a couple of pins from it to drive the lights. The arduino listens for text strings from our server and if it sees something like "$light0" it sets the lights based on the number (from 0-3, 0 being off and 3 being Red).
That arduino is hooked into our server which has a daemon running on it to take text from a TCPIP port and send it to the arduino, all my code does is just forward a "$light0" to the server based on how many times its detected things in the sink in the last 5 minutes :)
We have a similar daemon running for forwarding text from our server to IRC, its a similar setup to the traffic lights. Basically I have a python class called "Annoyances" which has 3 different annoyance levels and one to turn everything off. In this case the methods do the IRC/traffic light things but it'd be trivial to drive a servo and set off an air horn instead.
At some point I'm hooking it up to our GladOS themed door-entry system so GladOS herself can start yelling at people to wash up!
code is up! Its on my github account and linked to in the next post :)
Awesome work!
This is fantastic. I need this. XDDDD
Nice work! Would love to see the code, somewhat interested in a build like this myself. :)
different type website ...nice work..
Great project! I am just starting out using the beagle bone. I'd love to see a tutorial on how you got the web cam and openCV installed on beagle bone. Also, what distribution are you running on your bone?
I'm running Debian at the moment, the Angstrom image that came with the bone refused to work with the ps3 camera. I gave up with it for a while as I've been banned from the forum twice (without even posting anything!) and couldnt get any help with it. I've tried to build about 3 different images for it but none worked!!
The debian netinstall image works a treat though, even opencv/ps3 camera worked straight off!
This is a ridiculously good build. Loving it :) Do you have a mail address I can catch you on? I have a few questiona.
Thanks
Ryan