Flash Webcam Motion Tracking – 1st Attempt

I decided my next step with the webcam was to attempt some motion tracking. After a couple nights work I managed to get something working fairly well.

The short explanation: I created a grid of squares over the webcam input, and each square is checking to see if there is a bright light under it. If it sees a bright light then it tells a green square to move to that position.

Update 12.17.08:
Here is the source code folks:
download source

This is the code for exactly what you are seeing in the video. I won’t be providing a whole lot of support for this version since I have moved past it now in the interest of improving it, and am focusing my energies on those versions (which I may be releasing at a future date).

Share:
  • Facebook
  • Twitter
  • RSS
  • StumbleUpon
  • Tumblr
  • Technorati

Related posts:

  • Morse DeCode with the Arduino Board and Flash Having a week off from work will do weird things...
  • Flash Water Reflection Script I finally got around to really digging into some of...
  • Halftone Effect with Flash I am going to keep on posting my explorations with...
  • BitmapData + Webcam + Mouse Repulsion As I promised I integrated the webcam into my last...
  • Flash Masking Effect – Blocks Another designer needed a Flash transition like a bunch of...

  • 6 Comments (Leave a Reply)

    1. Chris Rojas (November 19, 2008)

      Hi, I was wondering if you would be making the source code available for other to check out.

      I’m interested in combining something like this with an infrared HD camera, a flash based 3d engine and a large projection surface say 30′ or so to create a interactive environment.

    2. Phillip (November 20, 2008)

      Could you possibly make it so it tracks sudden color changes instead of light? I am looking into doing somthing of this sort for a special project.

    3. danny (November 22, 2008)

      Chris – I will look into cleaning the code up and posting it soon.

      Phillip – Tracking color is one of my future goals with this. Until i get my code posted I will give you a hint at what to look for if you want to try it out yourself.

      The key to a lot of this is getPixel. Once you have a bitmapData made, you can use getPixel() to grab the color from any pixel on that bitmap. Then you could figure out a general range of numbers that represent the colors you are looking for. After that just keep checking to see if its switching between the two color ranges.

      Hope that helps some!

    4. Flash Free (December 7, 2008)

      This is a great blog!

    5. Ag (December 15, 2008)

      Could you please provide the sourcecode?

    6. dyleeo (January 4, 2009)

      This is sweet! I havent checked source yet but def want to see the inner workings. Nice!



    Leave a Reply

    Name
    (* required)
    Email Address
    ( * required - will not be published)
    Web Site
    Comment
    (* required)