OpenCV-based face detection sample with added mustache


Posted by Angel on 2012-09-12T15:18:54-04:00

This application builds on an OpenCV face detection sample, but adds a black mustache on the faces detected and (now) uploads the picture to Twitter!

You can see it in action in a video interview at DESIGN East:

There was also a video taken at CES 2013

BeagleStache premiered at DESIGN East Theater during the Gadget Freak DIY Lab on Sep 19, 2012 (slides). More information about how it was created is referenced below.

The BeagleStache was also featured at Maker Faire NY 2012:

Drew Fustini also did a very nice “BoothStache” using BeagleBone Black at DesignWest 2013 and did a very nice write-up.

How to build one

Follow the instructions on the Google Doc presentation:

  • Buy BeagleBone.
  • Buy PS3 Eye.
  • Buy BeagleBone LCD3 Cape or another power source.
  • Buy BeagleBone Battery Cape.
  • For tweeting, buy Iogear GWU627 Ethernet-to-WiFi adapter and tether it to WiFi. To overcome the limitations of the small screen, you should probably configure it separately to the WiFi and then connect it to your board.
  • Assemble it together into some kind of case.
  • You might want to update BeagleBone to latest image.
  • Boot board and login to console, perhaps using the built-in USB networking and Gate One.
  • Clone repository and build:
    root@beagleboard:~# git clone git://
    root@beagleboard:~# cd stache
    root@beagleboard:~/stache# make && make install
  • Edit config.js to include your tweet message, location of your LED control files and API keys for your Twitter account. To acquire your keys:
  • Make sure the date/time is set properly because Twitter requires it.
  • Double-click the BeagleStache icon to execute ‘runstache’ and start the app running. Be patient and try not to start it up multiple times.

Alternatively building on BeagleBoard-xM, instead of BeagleBone

I believe I used this SD card image.

root@beagleboard:~# opkg install --force-overwrite task-native-sdk cpp libstdc++6 opencv opencv-dev opencv-apps
root@beagleboard:~# opkg install --force-overwrite libopencv-imgproc-dev libopencv-highgui-dev libopencv-ml-dev
root@beagleboard:~# opkg install --force-overwrite libopencv-video-dev libopencv-features2d-dev libopencv-core-dev
root@beagleboard:~# opkg install --force-overwrite libopencv-calib3d-dev libopencv-objdetect-dev libopencv-contrib-dev
root@beagleboard:~# opkg install --force-overwrite libopencv-legacy-dev libopencv-flann-dev
root@beagleboard:~# git clone git://
root@beagleboard:~# cd stache
root@beagleboard:~/stache# make && make install

For reference, below is my version information:

root@beagleboard:~# cat /etc/version 
Angstrom v2012.01-core
root@beagleboard:~# ls -l /etc/version
-rw-r--r--    1 root     root            23 Jan 11 18:31 /etc/version
root@beagleboard:~# cat /etc/angstrom-version 
Angstrom v2012.01-core (Core edition)
Built from branch: angstrom-staging
Revision: a9fe47faf2f4241a2b80c26d3d38ec8694c71c08
Target system: arm-angstrom-linux-gnueabi
root@beagleboard:~# cat /etc/angstrom-build-info
Configured Openembedded layers:
meta-angstrom     = master:f0f99ea3cd132a6a69a9f4bad22da55403f9f940
meta-xfce         = master:c65139cd012231db6c3994481d11fe118773afab
meta-java         = master:bce529e9cde236a1814d8596bb93aed406680a28
meta-ti           = master:f9f283ea3cbd24cc9ba7c5ba830f10e30da5ea82
meta-ettus        = master:f097bb61772d07610d84a668dc19a47e180962b3
meta-efikamx      = master:2ef47fdd4e8232d766c0c63d9427253ee56e31d0
meta-nslu2        = master:17853811179f2760791c6b138f96e9dd15493517
meta-palm         = master:6031c4359af9cea72c983df23e3c0cc9579cb126
meta-n450         = master:7c3db7010479970f3f92501349827c517de3c36a
meta              = angstrom-staging:a9fe47faf2f4241a2b80c26d3d38ec8694c71c08

Comments are not currently available for this post.