My kids recently played MagiQuest, a game wherein people run around with "magic wands" that shoot out infrared light into sensors that activate different portions of the game. Each wand shoots out a pattern of infrared light that is unique to that wand. I'd like to write a Mathematica function that can distinguish one wand from another.
My laptop's webcamera can detect the light from the wand. Using img=Dynamic[CurrentImage[]];
I can analyze a stream of "video" from the webcam (where to process img
, one has to use img[[1]]
as the head of img
is Dynamic
.)
My question is very open-ended: how do I go about building a function that detects the pattern given by a wand? So far, all I have done is create a simple function that can detect when a light is shining on the camera in a dark room (i.e., it simply knows when the wand is shining at the camera). What is missing is a way to properly analyze the stream and detect patterns, no small job.
A significant problem: my webcam detects the infrared light as white light, so any white light can throw off the camera's detection. Bonus points for showing how to hack the camera to only recognize infrared light and disregard all other light sources.
Dynamic@CurrentImage[]
... How quickly are these wands flashing? If you record video separately, it would guarantee a stable framerate somewhere between 15-30 fps depending on your webcam and recording mode. Then you can analyse the pre-recorded video with Mathematica. $\endgroup$