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.