I cam up with this when I seen what Johnny Lee can do with a wiimote. Youtube it to check it out, pretty amazing.
I realized not everybody has a wiimote or a bluetooth dongle to connect it to the PC, so I used my webcam and python.
The webcam needs to have a filter on it to rid everything but the IRLED. A few layers of film negative, the black ends of them, is placed over the lens of the webcam to only allow IR light to come through. I don't have a way to click with the mouse, but use voice recognition instead to do that.
You will need VideoCapture and PIL.
Most camera shops will give you waste negatives.
Hope this helps someone.
#Webcam IR mouse control
#K.B. Carte 07/27/2009
#Works only with an IR filter on the webcam.
#To do this simply cut out the black part of a film
#negitave, and place two or three layers over the lens
#of the webcam.
from VideoCapture import Device
import Image
from ctypes import *
cam = Device()
user = windll.user32
res = (1440,900) #set to the resolution of the screen
def xy(im):
imxy = im.getprojection()
imx = imxy[0]
imy = imxy[1]
x = imx.index(1)
y = imy.index(1)
return (x,y)
while 1:
try:
im = cam.getImage()
im = im.resize(res)
x,y = xy(im)
user.SetCursorPos(x,y)
except ValueError: #A value error is raised when it can't see
pass #the IRLED