In this Instructable, I'll teach you how to make a motion tracking dummy. I hear kids and adults alike screaming and laughing as they pass Micheal on the sidewalk: it has been a great addition this Halloween.
I'll include a link to GitHub that has all the code needed to run the dummy as well as links to all the materials I used.
Step 1: Computer Vision
You might as well get the computer vision working before you buy any supplies. This is definitely the toughest step, and my instructions will be for a Windows 10 build environment. If you are on a different build platform, you may need to tweak the code slightly to get things to work.
Go ahead and get python up and running using the instructions here: https://www.python.org/downloads/
Get opencv up and running following the link here: http://opencv.org/downloads.html
3. Test the Combo
Open one of the scripts in /opencv/sources/samples/python2
Make sure that one of the simpler program in there works. If not, work through whatever issues you're having before moving forward
4. Test the Code
Grab the stuff in the repo here: https://github.com/ScienceIsNeato/HalloweenTracker
Note that while I am a coder for my day job, this isn't SOLID code. I just put stuff in as I needed it and didn't follow OOP standards. That being said, everything should be at least commented well enough to understand what's going on. If you like this project and find yourself breaking things out into classes/functions, feel free to put in a pull request :)
Step 2: The Camera
When testing the computer vision code, I just used my builtin webcam, but this wouldn't work well for the final for a couple of reasons. First, I didn't want to set my laptop outside on the window sill. Second, I wanted to be able to track people from far away, so for that I needed a webcam with a wide field of view.
I ended up going with a 170 degree field of view webcam from ELP ($50): https://www.amazon.com/gp/product/B00UA70HWO/ref=o...
The camera is pretty sweet. High resolution and great, wide angle. Good video quality as well. It comes unhoused, so you will need to whip together a housing for it (I used some scrap wood from the garage). This is actually kind of nice because it opens up the possibility that you could build it into something a bit more seamlessly.
Keep in mind that the camera is stationary - it is not inside the head of the dummy. It should be pretty close to the dummy or you'll need to add some code to correct for the distance between the camera and the head.
I did run into a weird issue that almost botched the project for me: opencv couldn't recognize my webcam. After a couple of nights troubleshooting, I discovered that it was an obscure bug that there was an odd workaround for. Getting a video driver wrapper software solved the issue: http://www.trackercam.com/TCamWeb/dvdriver.htm
Step 3: Arduino and Servo
The Arduino aspect of this project is trivial (as you'll see from the code). Just get a standard Duo. The comments in the code tell you which wires to attach to the servo and where.
For the servo, make sure you don't get a continuous rotation one. That won't work. You need an addressable one. Here's a link to the one I used from Hitec ($14): https://www.amazon.com/gp/product/B0006O3XEA/ref=o...
I did end up extending the wires by about 10 feet so that I could fish them through the window. The servo can be powered directly through the Arduino (though make sure that you use Vin as the power pin so that you're pulling directly from the USB port instead of going through the microcontroller - you may blow it out otherwise.
Step 4: Assembling the Dummy
I splurged a little bit and got a highly reviewed mask ($47) https://www.amazon.com/gp/product/B0097SHHJI/ref=o...
The mask goes on a Styrofoam head ($5) https://www.amazon.com/gp/product/B002CQSAMK/ref=oh_aui_detailpage_o08_s01?ie=UTF8&psc=1
Then I used a pair of dickies for the body ($30) https://www.amazon.com/gp/product/B005HJ8PO2/ref=o...
The only part that really needs any structure to it is the torso (this is so the servo can turn from a sturdy surface). I used a cinder block and some scrap wood from the garage for this part.
For the body, I bought a cheap roll of brown paper from Home Depot. I tore it into pieces and crumpled into balls, then used those to stuff the dummy. Finally, I added some old gloves and shoes and attached with carpet tape.
Step 5: Grab a Beer and Enjoy!
The code I posted has an option to make recordings whenever the program is tracking. Here's a video of some of the best reaction videos.
I'm happy to answer any questions for things I didn't cover in the Instructable!
Please feel free to leave suggestions for how I should improve this haunt next year!
Step 6: Halloween Night
Now that you've had the dummy out for a month, it's time for the long con. Dissemble your prop and don the costume yourself. Wait for the trick or treaters to come walk by the dummy that they've seen for weeks. Then slightly move a part of your body that isn't a head. Then stand up. Then slowly walk to the sidewalk. Then chase them down the street. Those kids will be telling the story of their encounter with you until they're 70.
papamaiku made it!