Laughing Man in Processing


The Laughing Man is the antagonist from the anime series Ghost in the Shell: Stand Alone Complex. During each of his public appearances in the series he manages to hack all video feeds/cyborg eyes in the vicinity to obscure his face with the logo above.

[Ben Kurtz] had been watching the series recently and realized he could put together a similar effect using Processing. The interesting bit, and what makes this more fun than a simple demo, is that he’s using the OpenCV library. OpenCV is a open source computer vision library. [Ben] uses it to handle the facial recognition in Processing and then apply the image.

It’s only 100 lines and we wonder what other fun tricks could be employed. Here’s a Hack a Day skull you can swap in for the logo.

[thanks dakami]


  1. Ben Keller says:

    I did the same thing (albeit a bit more kludgey) this summer using the same OpenCV library and python. Check it out at , or at . I considered using Processing, but I like python more ;)

  2. Nick says:

    Love it!

  3. tesla says:

    That is sweet. Now to get the hack out to surveillance systems. I love GiS

  4. Dan says:

    Would have been nice if you mentioned it was written in Java.

  5. new year will says:

    I must admit, I flipped my shit for a second or two when I pulled up the back and was greeted by logo.

  6. Blind says:

    Dan, he said it was written in Processing.

  7. ross says:

    GITS is one of the best anime series ever produced, this is totally awesome!

  8. Zorink says:

    sorry, noob here, when I run the code I get a video window to open, but no face recognition. The bottom window says:

    The haar classifier cascade file ‘haarcascade_frontalface_alt.xml’ can not be found in folders, you must specify the full path instead.

    any ideas?

  9. marz says:

    Last I tried to use OpenCV in Ubuntu it crashed like nutz because of a bug in the Linux kernel.


  10. Jamesy says:

    So much win I love it ^_^ Should try this out on the school’s camera system.

  11. Erik says:

    Cool, now i have something to match my Shirt.

  12. jim says:
  13. Ben says:


    Change the text:



    “C:\\Program Files\\OpenCV\data\\haarcascades\\haarcascade_frontalface_alt.xml”

    include the quotes, and remember to double the backslashes. If that doesn’t work, find where you installed the OpenCV facial recognition profiles and put that in instead.

  14. GITS fan says:

    Ghost in the Shell was great, and projects like this just increase the entertainment value. :)

  15. AbuMaia says:

    Using a Creative webcam with their Advanced Video Effects software, you can download this program to create your own effect doing the same mask thing.

  16. theweirdness says:

    Sweet, love GITS SAC, I considered doing this a few weeks ago, but looks like someone beat me to it :P

    great job!

  17. Can’t get it to work :/
    Using Windows XP… says it can’t find the openCV library after I installed it.

  18. The LOLing Man says:

    Sweet! but remember that in GitS SAC, the text around the logo scrolled… someone called deltadesu posted an updated animated version on the comments. He says it’s low res, though.

  19. Ben says:


    make sure you have your opencv/bin directory in your PATH variable. my installer claimed to do so, but did not.

  20. barry99705 says:
  21. Zorink says:


    that didn’t work either, it didn’t like the \ character

    I finally got it to work by copying the OpenCV.CASCADE_FRONTALFACE_ALT.xml
    into the same directory as the laugh script

  22. julien says:

    ok so i got this working, but (sorry if this is noob, this is my first experience with processing) how would i go about incorporating this into iChat when i video chat with people? would i have to extract the application to some where in the libraries of Ichat where it would run when the video chat was triggered?

  23. Andy Best says:

    Hah, awesome. I did the same thing with an apple a while back so as to create my own digital version of the “son of man” painting.

    Incidentally, in case anyone is interested, I’m going to be putting up some Processing + OpenCV tutorials on my site probably some time in the next week :)

  24. Fang says:

    crap i cant get this to work i keep getting a error message saying that,

    Does anyone know what that means?

  25. Fang says:

    crap i cant get this to work i keep getting a error message saying that,

    the package “hypermedia” does not exist. You might be missing a library.

    Does anyone know what that means?

  26. julien says:

    did you install the opencv correctly?

  27. Thanks, Ben.

    And yeah that absolute thing needs \\ to work.

  28. carloscorp says:

    heh its fun xD

  29. Fang says:


    I believe so. Ive redone it just to make sure and i get the same problem

  30. cck says:

    Dreamy idea, hardly yet achievable, would be to couple openVC with things like unwarp-mosaic (from siggraph 2008) and then write code automatically morphing all faces in a videoe.g. to smile like joker or aphex twin. Anyone knows of things similar in effect to unwarp-mosaic?

  31. Guy says:

    @ Zorink

    I did what you said, by copying the OpenCV.CASCADE_FRONTALFACE_ALT.xml
    into the same directory as the laugh script. Now it opens my webcam, but doesn’t display the logo on my face. Know how to fix this?

  32. chaostheory says:

    make sure you copied the right file, there is also one called haarcascade_frontalface_alt_tree.xml
    You can’t normaly see the _tree part

  33. GUY says:

    Well I found haarcascade_frontalface_alt_tree.xml, it was in C:/Program Files/OpenCV/data/haarcascades/haarcascade_frontalface_alt.xml. Now what am I supposed to do with it? I tried moving it into the same directory as the laugh folder but that didn’t do anything. I feel like such a newb.

  34. ben kurtz says:

    Hi guys! Thanks for your interest!

    I’ve updated the script with some user suggestions. Now the text rotates and the image scales! Check it out:

    Future work: Get OpenCV to work on profiles as well and work out some of the flicker bugs!

  35. Lordi GaForge says:

    Honestly? This is one of the sample programs that comes with openCV, only instead of placing a box around the face, he places an image.

    Sorry, just not impressed.

  36. Linus says:

    no this is not funny, thanx to that fucking idiot who made this i’ve lost 200$ usd.

    The one who did this deserves a bulldozer up his/her ass.

    If i ever get your name ill sue you. Good luck.

  37. jojo says:

    @linus your annoying

  38. javierdpp says:

    Nice work man but im trying to make the same effect with a video but the video show it so slow and there is any sound could you help me please ?????

  39. Rokth Hyde says:

    this app is much older and has been around for alot longer.

  40. DroopieDog says:

    Learn how to use “your” and “you’re”.

    ‘you’re’ = you are,
    ‘your’ = possessive pronoun, means that something belongs to you

  41. chris says:

    I have been trying on and off for a year to get
    OpenCV working with Processing sketches.

    I always get:
    The package “Hypermedia” does not exist etc etc warnings on compile.

    Many others have had similar problems – there’s a thread that has been discussing the problem for over a year, with no solution apparent:

    I have tried all the suggestions on this thread, and many others, on four different Windows XP machines, with every version of OpenCV ever released.
    I can’t get the darn thing to work.

    Is anyone clever enough to have a solution?

  42. unfold says:

    I’ve created a sketch that also does this, but uses the latest openCV (2.3) and processing 1.5.1 for windows.

    It’s a Frankenstein bit of code, but it works fine, so I thought I’d share. Here’s the code and some installation tips:

  43. jonny says:

    processing shows this OpenCV.CASCADE_FRONTALFACE_ALT.xml cannot be resolved or is not a field.
    and i don’t understand this “copying the OpenCV.CASCADE_FRONTALFACE_ALT.xml
    into the same directory as the laugh script”.
    thanking you in advance

  44. jonny says:

    I copied this “OpenCV.CASCADE_FRONTALFACE_ALT.xml
    into the same directory as the laugh script”. Now there is no error but cam shows a black screen only no image is there

  45. William says:

    For those of us whom are still interested in this.

    He has made this an executable. (I have not tried this yet.)

  46. Aw, this was a really good post. Spending some time and actual effort to
    make a top notch article… but what can I say… I hesitate a lot and don’t
    seem to get anything done.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 97,581 other followers