PDA

View Full Version : TrackIR 'derivative' using webcam - is it possible?



mango42
03-15-2007, 08:08 AM
My question is:-

I have a webcam attached and operational, so is it possible to use some software to emulate TrackIR functionality? If so, how?

Inadaze
03-15-2007, 09:28 AM
Yup, it is possible...

There are two programs that I know of that can do it Cam2Pan and freelook.

Freelook - http://freelook.org/
Cam2Pan - http://www.mousevision.com/game/index.htm

I use freelook, but does take quite a bit of fiddling to set up correctly. (below is a copy of a post I made in the comunity help for someone else)

Some hints to help -

Use an LED light source for the camera to lock onto. (I use a LED headtorch I have for Fishing at night, it has a 1 led setting, I cover the lens of the torch with thin paper so it doesn't reflect too much on the monitor screen and diffuses the light which gives a bigger target for freelook to follow.) Having a dark background behind you helps too, otherwise freelook can lock onto any bright area it can see.

Use Newview with Freelook, the panning becomes allot smoother with it. You can get newview from the links in this thread on the freelook forums http://forum.glenmurphy.com/8/203 Setup new view to use external interface(cam2pan etc.) in the Helmet section of the program. I remove any key bindings in newview as I found they could conflict with freelook.

If possible, set the camera to manual control, most cameras have an auto setting which will try to get the best picture possible in the light available, if you can use a LED light source, set the camera to manual and turn down the brightness, contrast and exposure (Exposure is the most important), doing that will usually get you higher frame rates from the camera (Which means smoother panning) and helps eliminate the problem of freelook locking onto any other light sources.

Getting freelook to recentre correctly in game can be a problem, I set up freelook with buttons on my joystick, one to turn it on and off (for those moments when you don't want any head shake to ruin a shot) and another to re-centre freelook (I have it set to use the same button I use to recenter my view on the gunsight in the game, so I can reset freelook to centre itself and make my view dead centre at the same time.)

In the freelook profile, one of the most important settings is the Maxx, Maxyup, and maxydown, they define how far you can pan in freelook, if you pan further than the game allows, then freelook will recentre itself offset when you look forward again. I'm not sure if it is dependant on screen resolution, I use-

maxx = 1440
maxyup = 900
maxydown = 400

I run the game in 1280x1024 and those settings are reliable for me.

It might not be Trackir, but if you take the time to get used to it (and it can take some getting used to Wink2) and get it set up well it will pay off. Be prepared to do some faffing and experimentation to find the best settings for yourself for deadzone and panning speeds.

Good Luck with it!

S! Inadaze

ps If you minimize the Freelook window to the task bar before you start the game it uses less cpu resources. I can't remember how much less exactly, but I think it was less than half...

rnzoli
03-15-2007, 03:52 PM
Very good description above. I have got similar experiences with Freelook.

I had to give up only 1 button on my joystick for re-centering and that is mapped to the IL-2 view re-centering function. I don't switch it off during the game, because I noticed that if I keep the re-centering button pressed, it will also lock the view there, so for those crucial moments, I just keep it pressed, no need to switch back and forth.

I haven't tried newview yet, I wonder why does it make panning smoother? Does it make some filtering? Or should the hat-switch be used?

Inadaze
03-15-2007, 04:18 PM
New view lets you tweak the response curves and things like how fast the view will recentre when you are in the deadzone, or how fast a pan starts, I think you are right that it is filtering the inputs.

I know freelook has some settings for sensitivity but I find myself that using newview with freelook gives better control (I don't seem to have to move my head as far and smaller movements seem less jittery.)
It doesn't need the hatswitch, it can be set up to use an external input such as freelook or cam2pan. I think it somehow uses reverse engineered trackir data and was originally designed to apply it to hatswitch movements to give more fluid precise control.

Lurch1962
03-15-2007, 04:51 PM
I don't have a set-up like this, but you might try out the following as a possible way to maximize the contrast between the LED light source and the ambient room lighting.

Assuming you're using a red LED, a piece of red plastic or a red filter placed in front of the web cam's lens will pass all the LED's light while blocking out all wavelengths shorter than that for orange or even yellow light (i.e., green and blue).

Note that the red filter must be non-diffusing, and should be of half decent optical quality--no obvious distortion as you look through it. Plastic filter assortment booklets available at some camera shops are a good source. Or a piece of red plexiglass. And a fairly rich, deep red will filter out non-red light better. If you have a selection to choose from, try flicking each filter in front of the LED to see if its brightness remains the same. (A VERY deep red could possibly filter out some red LED light.)

--Lurch--

rnzoli
03-16-2007, 06:59 AM
and smaller movements seem less jittery.
Excellent info, I will give NewView a try. I noticed this problem, when tracking other planes in formation flying.

mango42
03-16-2007, 11:20 AM
Some excellent responses - many thanks, especially to Inadaze (sounz like my perrenial condition, except when dogfighting http://forums.ubi.com/groupee_common/emoticons/icon_smile.gif

I'll check out those links now...

Davinci..
03-16-2007, 12:06 PM
Originally posted by mango42:
My question is:-

I have a webcam attached and operational, so is it possible to use some software to emulate TrackIR functionality? If so, how?

I tried just about everything to get this to work. First with cam2pan then with freelook(i found free look to work better).
Takes a while to get it setup just right for your situation(lighting, etc.) You can get decent results. I went all out got a green leds, made a boom on my hat(helped a lot), the whole 9. But it just dosnt work "that well", its funtional, but not particularly practical. It just cant give you smooth acurate tracking that a mouse or acutal TIR can. I went back to using mouse for my view control, perfectly acturate, smooth, and perfect control over it. Something you need online.

triggerhappyfin
03-16-2007, 11:45 PM
I've been using the Cam2Pan since early IL-2 days. The cost of 9.95$ is nothing compared what TracIr costs. And if you already have a webcam I cant see what TrackIr does better for those additional money. Yes the newview makes the panning smoother and less jittery.
I run it in flashlight mode using a little led on my headset to lock it on. Ive found out that any white or reflective material would be enough to reflect the light from the screen enough to catch the flashlite mode. So my next move will be to abandon the led. Switching it for something reflective.

Huxley_S
03-17-2007, 12:10 AM
Any 1 know how to wire up a red LED so that it can run off a spare USB port?

JG53Hunter
03-17-2007, 01:47 AM
You go can even further and use an IR-LED (infrared). Allmost all webcams are able to sense infrared light. This enables you to use a filter made out of some exposed colour film. This kind of filter blocks out all visible light!
If you use an IR-LED with that kind of filter youre completely independent of the surounding light situation.

To test your Webcam if it can sense IR just grab the next remote-controll.

Im using an external powersupply, so i don't know how to use USB for it. But it shouldn't be a problem to use an USB-port for it.

rnzoli
03-17-2007, 01:55 AM
My LED is wired to the otherwise useless Scroll Lock LED on the keyboard.

Last night I was experimenting with NewView, that's a very capable little product with a scary amount of options, but finally I think it works, and indeed, smooths the view. The best testing is to move the view with a head movement slowly while trying to see a distant object. I think I can get a steadier view on that distant object with NewView+Freelook, but I want to do some negative tests (Freelook only, TrackIRUse=0) to exclude any placebo effect.

mango42
03-18-2007, 01:20 PM
@ Huxley_S

So long as you're careful*, should be no probs wiring an LED to USB. You can even get LED's with built-in resistors these days, so matching 5v to LED voltage drop is a doddle.

* http://www.usbman.com/Guides/BelkinMotherboard_cable_assembly.htm

for da nitty-gritty

HTH

mango

PBNA-Boosher
03-18-2007, 03:00 PM
You're right, Freelook does take a while to configure, but from what I see so far it's better than the workout my thumb gets in a dogfight from hat switches. Thanks for the heads up!

wingmanno1
03-19-2007, 06:36 AM
To all of you: check out this guy:
http://cgi.ebay.nl/ws/eBayISAPI.dll?ViewItem&item=22009...=cross_promot_widget (http://cgi.ebay.nl/ws/eBayISAPI.dll?ViewItem&item=220093858932&ssPageName=MERC_VIC_RCRX_Pr4_PcY_BIN_IT&refitem=220092030586&itemcount=4&refwidgetloc=closed_view_item&usedrule1=CrossSell_LogicX&refwidgettype=cross_promot_widget)

i bought a copy of that pdf and it all looks very plausible.

Inadaze
03-19-2007, 07:31 AM
Originally posted by wingmanno1:
To all of you: check out this guy:
http://cgi.ebay.nl/ws/eBayISAPI.dll?ViewItem&item=22009...=cross_promot_widget (http://cgi.ebay.nl/ws/eBayISAPI.dll?ViewItem&item=220093858932&ssPageName=MERC_VIC_RCRX_Pr4_PcY_BIN_IT&refitem=220092030586&itemcount=4&refwidgetloc=closed_view_item&usedrule1=CrossSell_LogicX&refwidgettype=cross_promot_widget)

i bought a copy of that pdf and it all looks very plausible.

From the photo it looks as if that guy is using freelook, by the look of it he's using an ir led as a light source and modifying the camera (Probably using the exposed colour film method that JG53 Hunter mentioned in this thread)

I'm sure it'll work, I've seen another guy that had done the same mod, but he put the how too onto the web for free (I can't find that page now I want it!), I think it's a bit dubious that he's selling the info, and I wonder if the guy that wrote freelook knows that his program is been used in such a way. I guess the how to info isn't illegal though, and nothing stops him saying, I use such and such you can download from here...

The way it works is, wire an IR led under the camera, take the camera lense apart, remove the lense filter (The thing that makes camera lenses look red/purple) and replace it with a small piece of exposed film. put camera lense back together...Now the camera will only pick up IR light. Then get something that reflects IR to use as the tracker dot, the example I saw used some of the reflective material from a motorcycle jacket. It will show up very brightly because it is reflecting the IR from the LED and you no longer have to worry about other light sources. I suppose ya camera is knackered for anything else though...