This content has been marked as final. Show 4 replies
Sounds cool but, oddly enough, I don't have a webcam at work :)
How did you do it? How did you detect user motion in their webcam feed to go with the ball?
Unfortunately I cannot share the code, coz it is copyrighted to my client.
The logic is as follows -
The contents of the webcam are copied onto bitmap. Then I Xor the bitmap image with previous image. The resulting image is the motion difference between the two images. This is depicted by all whites in the new bitmap. Rest of the area is black due to XOR operation. I calculate the number of pixels that touch the base of the ball (a small rectangle). If the number of pixels that are white is more than a thresold value I bounce the ball up.
I hope it makes sense.
It uses cam functions, bitmap blend, bitmap threshold functions