Not-Quite-Dead-Yet

General Discussion => PC => Topic started by: Propnut on Jan 12, 2014, 07:49 AM

Title: Head Tracking on the cheap
Post by: Propnut on Jan 12, 2014, 07:49 AM
One of the great things about the Arma series is the ability to use head tracking for situational awareness. It is great to be able to look over your shoulder without the need to interrupt your current direction of travel or turn your back on potential threats ahead of you.

As many of you already know, the most common commercial head tracking hardware/software is TrackIR by NaturalPoint. This gear is excellent; plug and play, profiles already created and available for hundreds of games. But, it is expensive. The current version TrackIR (5) is 150.00-170.00 USD although you can still buy the last generation TrackIR (4 Pro) for 99.99.

While chatting with a beginner flight sim pilot the other day I found that his income level removed any hope of his purchasing a TrackIR and he was trying to compensate with the old fashioned hat switch.

So I shared this information with him:

There are two very cheap methods of getting head tracking for games; Freetrack and FacetracknoIR.

Freetrack has been around for a long time, I used it extensively for flight sims before I was forced to buy a TrackIR 5 to play Arma2 (of course they caved to public pressure soon after and added freetrack support, lol).

Freetrack is a open source (as of last year anyway) free to the public software designed to use everyday webcams that have been altered by removal of their Infrared (IR) filter, and adding a simple visible light filter instead (floppy disk media works great). Via the software, the camera can detect the position of an array of IR LEDs attached either to a hat or a clip on your head. When you move your head the Freetrack software translates this movement to the game that you are playing.

Pros: Webcams are cheap, the Software is free

Cons: You have to be a little bit handy with a soldering iron to make the LED array, the software has not been updated in over five years. You have to tweak the software to get the results that you want.

FacetracknoIR is a very interesting community based, free, software that does not require any modification to a webcam nor does it require an LED array. It captures the shape of your face and tracks that shape as you move your head around. The software then translates this to the game just as Freetrack and TrackIR does. Did I mention that it is free?

Pros: Webcams are cheap, software is free, no LED or reflector array, current and ongoing support and development by the community.

Cons: Tricky to get set up properly for your lighting conditions and movement. Takes a lot of tweaking to get comfortable with it.

The other day I decided to build our new pilot a Freetrack system, I have built dozens of them for various people over the years. With that in mind I went looking for a webcam that I know is excellent for the task; the PS3 "Eye".

The PS3 Eye was developed for the PS3 gaming console to track body movement via two lighted wands that the game player holds in their hands. Because it was developed specifically for this use it is capable of 120FPS and does NOT require the user to remove an IR filter. Even better?! They are CHEAP! You can pick them up at local gaming stores for 9.99 each (used). I bought two at GameStop yesterday.

The PS3 Eye is a USB device, Windows drivers have been developed and released by Code Laboratories and can be found here:

http://codelaboratories.com/products/eye/driver/

I simply taped a piece of floppy disk media over the front of the lens and it was ready to go.

Since I was building a Freetrack System I decided to compare all three systems since I own a TrackIR 5 (on my Simpit) and TrackIR 4 (at my desktop).

Freetrack can be found here:

http://www.free-track.net/english/

With freetrack there is a bug that causes the program to crash when you turn on the camera, this is fixed via a few updated files added to the program directory. Information is found here.

http://forum.free-track.net/index.php?showtopic=2416&page=1

FacetracknoIR of course required me to remove the floppy disk media so it could clearly see my pretty..er...well....my face. :)
FacetracknoIR also required tweaking, much more so than Freetrack, but eventually I had the responses calmed down with a nice deadzone in the middle so my view didn't bounce around the screen with every movement of my head. But, it was not at all as smooth as I would prefer it. Freetrack and TrackIR are much smoother. One thing that I found extremely helpful is that FacetracknoIR also supports point tracking. In other words; having the camera look for and follow an IR LED array (ok, put the floppy disk media back on the camera) via a plugin called "Point Tracker". This made tracking much more stable and smooth. Still not up to Freetrack or TrackIR standards though.

A note on the PS3 Eye: I found that in both Freetrack and FacetracknoIR the camera acted buggy. I had to adjust the video stream settings (even if it is just moving a slider from one point and back to its original point) to get smooth operation. In Freetrack if I did not do this step before starting the camera the program would crash. In FacetracknoIR the tracking would simply be erratic.

Comparison:

Freetrack along with the PS3 Eye is, in my opinion, no worse nor better than either the TrackIR 4 or TrackIR 5 but all three are better than FacetracknoIR.

FacetracknoIR is still being developed and there might be more tweaks that I did not find and use last night and it is very much worth keeping an eye on. If you are not electronically inclined and the thought of using a soldering iron scares the bejubits out of you (that can get messy) than by all means use FacetracknoIR, once you get used to it you will appreciate the greatly increased situational awareness.

FacetracknoIR can be found here:
(if you use the PS3 Eye check under the Compatibility tab and look at the information on webcams. It will explain how to set the PS3 Eye to run at 120fps. Otherwise it will default to 30fps. This works for both Freetrack and FacetracknoIR)

http://facetracknoir.sourceforge.net/home/default.htm

I know that for Arma3 many of you use 3rd person (boo hiss!, lol) and you will find that head tracking is also a great tool from that viewpoint allowing you to look around, increase elevation, slide the viewpoint sideways, etc without changing the orientation of your avatar.

Anyway, I hope this helps anyone who wants to use headtracking but does not want to take the expensive plunge that is TrackIR.
Title: Re: Head Tracking on the cheap
Post by: Maynerd on Jan 12, 2014, 12:12 PM
     Thanks for the info Propnut. I've wanted to get a TrackIR for a long time but never been able to spare the expense. I tried looking into some of the webcam hacks but lost focus when they started talking about buying specific, obscure cameras that were hard to find for cheap, and then cracking them open to burn out certain spots on the internal pcb to get it working correctly for tracking. Sounds like you've got some much easier ways to go about it. I've got a PS3 Eye that's been sitting unused since about 2007, and a couple of nice Logitech cams I can play around with. My only requirement is that I can play in mostly darkness, so the face tracking probably wouldn't work for me anyway. Have you tried using a Kinect on pc for tracking? I've heard varying opinions but might be worth a look.

     I know a lot of people hate the concept of playing ArmA in 3rd person. For me personally, being able to switch back and forth between 1st and 3rd isn't about gaining an advantage (okay, maybe a little ;)), it's about settling my stomach. As I've gotten older I've started to notice a slight increase sensitivity to motion sickness in gaming that I didn't have before. Case in point, the new Tomb Raider game is 3rd person but that tiny bit of camera shake that you can't turn off made me so sick I had to uninstall the game until I can figure out how to disable it. For the most part it hasn't gotten to the point where I'm taking morning sickness pills like some have suggested, but last night my camera was pulling to the left in the gunner seat of the tank and it only took about 30sec before I had to get out and swear off it for the night.
Title: Re: Head Tracking on the cheap
Post by: Propnut on Jan 12, 2014, 12:38 PM
Hi Maynerd,

I have not tried a Kinect device for head tracking, but I assume it too would need good lighting to acquire and keep the target.

You can create a simple IR LED array by gluing the LEDs and wire directly to a baseball cap. The power comes from an unused USB cord (just cut it off an old device that you are no longer using. You only need the red and black wires (positive and negative). Here is a simple circuit for the LEDs.

(http://i157.photobucket.com/albums/t79/Prop_Nut/FreetrackDiagram.jpg)

Nice thing of course is that you can use this in the dark.

Title: Re: Head Tracking on the cheap
Post by: DTRAX on Jan 12, 2014, 12:54 PM
very nice and on the cheap, thanks for the detailed post. ;D
Title: Re: Head Tracking on the cheap
Post by: Propnut on Jan 12, 2014, 12:59 PM
By the way Maynerd, you will either want to modify any IR LEDs that you buy or buy ones that are already modified. LEDs used a focused beam of light, you need to make them diffused by sanding the front of the LED flat (almost down to the internal contacts) and polishing them up a bit so light can shine through.

This IR LED is the correct type without modification:

http://www.digikey.com/product-detail/en/SFH%20485%20P/475-1470-ND/1228122
Title: Re: Head Tracking on the cheap
Post by: deathmetaldan on Jan 12, 2014, 01:50 PM
while looking around at this i saw that people are doing this with a xbox kinect also. I have an old style connect laying around not being used so i think i might mess with it.
Title: Re: Head Tracking on the cheap
Post by: Propnut on Jan 12, 2014, 02:08 PM
Dan, let me know how this works out for you. I am having trouble finding information on working with the Kinect on PC. One thing I did find though is that the Kinect is limited to 30hz.
Title: Re: Head Tracking on the cheap
Post by: Maynerd on Jan 12, 2014, 03:22 PM
I wonder if it would be possible to get something like this setup to work with ArmA.

http://www.youtube.com/watch?v=Jd3-eiid-Uw
Title: Re: Head Tracking on the cheap
Post by: Maynerd on Jan 13, 2014, 12:16 PM
     BTW, I've got an old Logitec QuickCam Pro 4000 I picked up years ago that hasn't worked in probably a decade. It stopped picking up video, but the mic seems to still work over usb. I was wondering if anyone might know why it just shows black all the time. The only thing I can remember about it was it stopped working around the time I plugged it into my PS2 but it might have been something before that. It's like the optical sensor is burnt out or something. I'm willing to tear that one apart to see if I can fix it and I'd be up for experimenting with it to the point of destruction if necessary, as it's already long past time I should have given up on it.

     I've got a QC Pro 5000 that works just fine so I'll try that one. I'm still a bit paranoid that I'm going to destroy the PS Eye if I plug it into my PC due to the issues with the 4000. Either way, I'm going to give it a shot until it works or something else breaks.
Title: Re: Head Tracking on the cheap
Post by: Propnut on Jan 13, 2014, 12:22 PM
No idea why the other camera went bad, sometimes they do.

Unless your USB port is putting out more amperage than the device can handle (not likely but it could happen) than you should have no problem with the PS3 eye. I assume you have plugged other devices into your USB port since the Microsoft cam died?

Install the drivers that I linked to first and then plug in the PS3 Eye. USB devices, regardless of PS3/PC, have the same specs.
Title: Re: Head Tracking on the cheap
Post by: Maynerd on Jan 13, 2014, 01:47 PM
     I got the QC 5000 setup and then installed FreeTrack v2.2 from the website. I keep getting the "Exception EAccessViolation in the module" error and a sieve-esque memory leak. Forum post said to lower your font DPI so I'll try that after this defrag finishes and can reboot.

*Update*

Lowering the desktop DPI seems to work. QC5k works with FT 2.2, just need to get some led's. What I really need is a way around the "set your dpi to 96 and reboot" issue. That's going to drive me insane very fast.
Title: Re: Head Tracking on the cheap
Post by: Propnut on Jan 13, 2014, 03:13 PM
You might try FacetracknoIR first and see if you are comfortable with it.

Not sure why you are getting that message every time you start Freetrack. Once you set your desktop to 96 DPI it should stay there. Unless you are changing it back every time.

Did you alter the QC Pro 5000 to remove the IR filter?

EDIT: I just looked it up, the QC Pro 5000 does not need to have the filter removed. It seems to be a great candidate for Freetrack.
Title: Re: Head Tracking on the cheap
Post by: PapaReap on Jan 13, 2014, 03:30 PM
I first used Freetrack then went to using FacetracknoIR, however, even though the face tracking works pretty well, I didn't like the way the face tracking was working overall (weird things moving my mouth, like eating and gaming ...  :-[ )

I was going to build my own clip, but, got lazy and bought a TrackClip Pro around $35 I think, and just use FacetracknoIR with tracker source set to "PointTracker 1.0" which seems to work ok.

I'm only using a old logitech webcam 300 with ir filter removed and a piece of floppy media (only 30 fps), would like to get a PS3 eye and give that a try (need to find one cheap).

All in all, still a pretty cheap way to get head tracking imho.
Title: Re: Head Tracking on the cheap
Post by: Propnut on Jan 13, 2014, 03:46 PM
Hey PapaReap, can you share your FacetracknoIR Pointtrack profile?

I have been experimenting tonight to get a better, more stable, experience out of the program. Considering the issues that many people face getting Freetrack to work.

Title: Re: Head Tracking on the cheap
Post by: PapaReap on Jan 13, 2014, 05:08 PM
Prop, here is the profile.ini I have setup for FacetracknoIR

https://www.dropbox.com/s/5c8ig5hqadw1977/Arma%203%20trackclip.ini
Title: Re: Head Tracking on the cheap
Post by: Propnut on Jan 13, 2014, 05:23 PM
Excellent, thanks.

I have been testing more tonight with it, but if I have to recenter the view at all the responses are messed up. It changes left to down, right to up and left, etc. I have to stop and start the camera again. I have managed to get smooth tracking in it though. If I can figure out the latest bug I would recommend it over Freetrack for those who have trouble getting freetrack to operate smoothly. But I would still rather use Freetrack otherwise.

Title: Re: Head Tracking on the cheap
Post by: deathmetaldan on Jan 14, 2014, 05:14 AM
i am going to give this a shot

http://www.desiquintans.com/headtrack

i have a couple wiimotes laying around and if it doesnt work at least i can use the IR leds for something else
Title: Re: Head Tracking on the cheap
Post by: PapaReap on Jan 14, 2014, 11:28 AM
Propnut, yeah I occasionally need to reset the camera after playing awhile, not sure why... could be the old camera I'm using. I just have a hot key setup and make sure to center my head the press the key.



I updated the FTNoIR_Tracker_PT.dll from version 1.0 to 1.1
this is a new profile using PointTracker 1.1 with FacetracknoIR
https://www.dropbox.com/s/5c8ig5hqadw1977/Arma%203%20trackclip.ini
Title: Re: Head Tracking on the cheap
Post by: Propnut on Jan 14, 2014, 11:35 AM
Hey Reap, thanks again.

I tested your first profile with 1.1 already. Worked great, still the odd issue with needing to stop and restart the camera occasionally to get it to center again (regardless of how many times I pressed the "center" hotkey, lol).
Title: Re: Head Tracking on the cheap
Post by: PapaReap on Jan 14, 2014, 11:52 AM
Ok, so maybe it is not my camera after all.

How often do you need to stop/start your camera? I don't have to stop/start the camera, just center it occasionally.

Which game protocol do you use?
Title: Re: Head Tracking on the cheap
Post by: Maynerd on Jan 15, 2014, 11:01 AM
     I've been experimenting with facetracknoir and I think that's going to be my best option. I play in almost complete darkness so I really should look into getting an ir led setup, but I'm wondering if it would be better (easier at the very least) to get an led headlamp and switch out the bulbs for some ir ones like they did here. http://www.instructables.com/id/Infrared-LED-Flashlight/

     I'm not the most handy with a soldering iron but I think I could get the job done without too much trouble. I got some Scotchlite reflective tape hoping that it would be enough for the camera to track, but didn't have much luck with that in the dark. I think it reflects better from a further distance anyway.

Edit:
     I'm heading to radio shack this afternoon to pick up some IR LEDs. I've never quite been able to grasp the concept of how electrical components work (despite years of working with electrical engineers who've tried to explain it), so I'm guessing all I'll need to pick up would be the LEDs and a 22ohm resistor? Is 3 enough or should I go for 4? I've got an old pc power supply I've been using for spare wire, so I'll cut some off that unless I need something specific. Power will be from a USB cable once I find a spare. I'm either going to tape all of this to a hat or possibly make my own headset clip from a coat hanger depending on how much time I have this evening.
Title: Re: Head Tracking on the cheap
Post by: Propnut on Jan 15, 2014, 12:18 PM
Three LEDs are all you need, but make sure you sand down the tip of the LED flat. And then buff it up a bit so IR can shine through. If you do not do this your camera will lose track of the LEDs unless you have them pointed directly at it as they are more like a laser beams without the mod.
Title: Re: Head Tracking on the cheap
Post by: Maynerd on Jan 18, 2014, 11:27 AM
   So just an update on what/how I did on my project. I went down to the local Radio Shack and for just under $9, picked up 3 High-Output 5mm infrared LEDs and a 5 pack of 22Ohm ½ watt carbon-film resistors (smallest quantity they had). I taped the LEDs to a couple of cut pieces of coat hanger and wired them with two lengths of small gauge cut from an old 350 watt power supply, and the red and black wires of an old USB cable. I should have sanded them first because the one in the middle was a little difficult to reach in the crook with my wife's nail buffing block (thanks Honey). I didn't sand them at first because I wanted to see just how focused the beam would be, and someone else said you could get the same effect by sticking a cube of Styrofoam over the LEDs. It worked... kinda. In the same way one could say that getting blackout drunk and dancing naked in a public fountain to get yourself arrested, works as a way to find a place to sleep for the night. I'd describe the experience as suboptimal, to say the least. ...The Styrofoam part, I can't attest to the drunk/naked/fountain/jail thing. Point is, the Styrofoam didn't cut it.

   Moving on, I sanded down the tips of the LEDs using both sides of the file on my trusty Leatherman Charge TTI and then worked my way through the four sides of a nail buffing block until the tips were flat and shiny. This provided the most reliable tracking by far up to that point. I'd been testing with FaceTrackNoIR and a Logitech QuickCam Pro 5000 my mother-in-law gave us a few years ago. I've been trying it both with and without a piece of 3.25 floppy disk media as a filter over the camera lens. Until I sanded far enough down and buffed them, the camera had problems tracking the LEDs even in a dark room with the filter off. After buffing, it tracks nicely but I still need to keep the room pretty dark even with the filter on.

   I'm still getting used to it as an additional method of controlling my character. I'm sure I'll get hooked as soon as I use it for flying. Anyway, thanks everyone for the advice, especially you Propnut for reigniting the spark to try it again. Next step will be testing with the PS3 Eye and seeing if that makes a difference.
Title: Re: Head Tracking on the cheap
Post by: Propnut on Jan 18, 2014, 02:09 PM
Bravo! Welcome to the world for headtracking!