Skip to main content
Participant
May 9, 2011
Question

Webcam Brightness as control cs3 asap :)

  • May 9, 2011
  • 1 reply
  • 450 views

Hey Im looking to make the brightness of footage being captured by a webcam as a trigger to start or stop an event or animation. basically when the brightness being captured by the webcam goes below a certain level a layer will be effected and when the brightness goes back above this level it will revert back to its original state..

Any ideas ??

This topic has been closed for replies.

1 reply

Lee_Burrows
Participating Frequently
May 10, 2011

hi

you could follow these steps to get the brightness of the webcam:

1. reduce video instance width and height to 1px.

2. create a BitmapData object of same size (1px by 1px).

3. use (eg) myBitmapData.draw(myVideo); to copy video to bitmapdata.

4. reset video width and height back to original size.

5. get pixel from bitmapData object (eg) var myPixel:uint = myBitmapData.getPixel32(0,0);

now you have the average colour (and hence also brightness) of the video in myPixel and you can start/stop your animation based on this value