5 Replies Latest reply on Jan 28, 2007 5:59 PM by SuperRoach

    Webcam motion detection


      I'm working with flash and a webcam basically when the user puts their hand over one of the dots it should change colour I have got it sort of working with one dot but it does not recognise the other dots and sometimes does not do anything at all. very strange any help would be greatly appreciated thank you.

      the code below is placed on the first frame and balls (the dots)refers to a movieclip

        • 1. Re: Webcam motion detection
          kglad Adobe Community Professional & MVP
          1. remove the balls array definition from your onEnterFrame loop.

          2. where is the kill() method defined and why is there a space between kill and ()?
          • 2. Re: Webcam motion detection
            Bhavzzz Level 1
            Hi kglad,

            Tried that does not work, the ball only changes colour when the balls array definition is onEnterFrame loop. the kill() function is on the ball movieclip...it basically tells the movieclip to play so that the balls' colour changes.
            • 3. Re: Webcam motion detection
              trying to understand your code, that there is a major colour change on the pixel where the ball is?

              Is it only one pixel, or an area? because noise on a webcam would make single pixel detection almost impossible, but a 5 x 5 or 10 x 10px sampling area would be far more reliable in the results your after
              • 4. Re: Webcam motion detection
                Bhavzzz Level 1
                Hi SuperRoach,

                The code is actually checking if there is a colour change within the webcam and if it is in the same position as the ball then the kill() function is activated…well I believe that’s what the code is doing…I’m not that good a coder so might have got is a bit wrong maybe…thanks for pointing that out it might help solve this…but if you have any idea as to how I could sample a range rather then pixels it would be great.
                • 5. Re: Webcam motion detection
                  SuperRoach Level 1
                  ah ok.... so if its one pixel, its possible the colour change could be happening in a lot of places at once. A night setting would make the noise grain or colour changes pretty random.

                  You can/should test any webcam app out by the way by using a fake webcam. For example, use camtasia to record your screen as a webcam. Then, move shapes around and see how that alters your flash in realtime