FaceTrackNoIR

From FlightGear wiki
Jump to navigation Jump to search
FaceTrackNoIR
The FaceTrackNoIR interface, with the webcam view in the bottomleft corner.
The FaceTrackNoIR interface, with the webcam view in the bottomleft corner.
Developed by Wim Vriend, Ron Hendriks
Initial release May 24, 2010
Latest release July 08, 2018
OS Windows
Development status Active (2010-)
License parts of the program under ICS Licence, the rest unknown
Website

FaceTrackNoIR is a headtracking program that uses the SeeingMachines FaceAPI. Movements of the head are registered by a simple web cam; no additional hardware (eg. markers) are required. FlightGear support is built in, so you can look around in the FlightGear world by rotating your head. You can download it from here: http://www.facetracknoir.nl/ for around 2,85 Euro, you need the free PluginPack as well.

Run with FlightGear 2017.3 and newer

Installation

  • You then need to have the headtracker folder somewhere on your system. Its source for FlightGear's development version is part of FGAddon, precisely at:

flightgear/fgaddon/trunk/Addons/Headtracker

  • Since FGAddon is a Subversion repository, any method to retrieve contents from a Subversion repository should be fine to get Headtracker on your hard drive. The page FGAddon explains a bunch of them in case you have no idea. For instance, with the Subversion command-line client (svn), the following command retrieves the development version of Headtracker (the last parameter is the destination folder):
   svn checkout https://svn.code.sf.net/p/flightgear/fgaddon/trunk/Addons/Headtracker Headtracker

Usage

  1. Make sure you closed any webcam software that might be running. This is really important, failing to do so will probably stop FaceTrackNoIR from working.
  2. Start FaceTrackNoIR.
  3. Select "Game Protocol: FlightGear" and click the "Start" button under "Tracker Source". You might have to restart the FaceTrackNoIR once, after clicking "Start".
  4. A small window with your webcam's view should show up in the leftbottom corner. Make sure your head is well within the view and eyes, nose and cheeck are outlined by a yellow line. When you move/rotate your head, the lines should follow your movements.
  5. Start FlightGears Launcher and add the following argument in Additional Settings in Settings:
    --addon=full-path-to-the-headtracker-folder
    --generic=socket,in,25,localhost,5550,udp,facetracknoir
    --generic=socket,out,10,localhost,5551,udp,facetracknoir
  6. Add optional (opens up the property browser showing the headtracking values:
    --prop:browser=/sim/headtracker
  7. While running FlightGear, open the FaceTrackNoIR dialog and edit the sensitivity bars, so that your head movements correspond well with FlightGear's view movements. Ticking the "invert" boxes might be neccesary if your movements are mirrored.
    • In FlightGear sometimes you have to reset the view. You can do this by pressing =-key (equal sign)

Run with FlightGear pre 2017.3 and older (works only for FlightGear Versions older than 2017.3)

  1. Download and install FaceTrackNoIR, as prescribed in the README contained in the zip-file or alternatively in the installation manual.
  2. You will have to move 2 files to the FlightGear root. Both files are called "headtracker.xml", but their content is different! One file goes to $FG ROOT/Nasal and the other goes to $FG ROOT/Protocol. The files can be found in FaceTrackNoIR's file section.
  3. Make sure you closed any webcam software that might be running. This is really important, failing to do so will probably stop FaceTrackNoIR from working.
  4. Start FaceTrackNoIR.
    • Select "Game Protocol: FlightGear" and click the "Start" button under "Tracker Source". You might have to restart the FaceTrackNoIR once, after clicking "Start".
    • A small window with your webcam's view should show up in the leftbottom corner. Make sure your head is well within the view and eyes, nose and cheeck are outlined by a yellow line. When you move/rotate your head, the lines should follow your movements.
  5. You can run FTNoIR through two ways:
    • Run FlightGear, with the following (extra) commands:
      --generic=socket,in,25,localhost,5550,udp,headtracker
      --generic=socket,out,10,localhost,5551,udp,headtracker
      --prop:browser=/sim/headtracker
      --config=$FG ROOT/Nasal/headtracker.xml
    • Set the commands showed above via FGRun. All of them can be set via Advanced on the last page of the launcher.
  6. While running FlightGear, open the FaceTrackNoIR dialog and edit the sensitivity bars, so that your head movements correspond well with FlightGear's view movements. Ticking the "invert" boxes might be neccesary if your movements are mirrored.


Resetting the View in pre 2017.3

The following code is from an external discussion.

Sometimes it is useful to be able to reset the view (in the example below with the equal sign key). That can be accomplished by adding the following code to the headtracker.xml in the Nasal directory at the beginning (the first and the last tag in the code snippet below already exist - use the code in between):

<PropertyList>
	<input>
		<keyboard>
			<key n="61">
				<name>= (equal sign)</name>
				<desc>Reset Head Tracker</desc>
				<binding>
					<command>nasal</command>
					<script>headtracker.reset()</script>
				</binding>
			</key>
		</keyboard>
	</input>
	<nasal>

Alternatively you can assign the reset functionality to a button. In the following example clicking on the button resets the headtracker if in the default cockpit view. Otherwise it gets back to the cockpit view.

<button>
	<number>
		<unix>13</unix>
		<windows>1</windows>
	</number>
	<desc>Reset view and cockpit view</desc>
	<binding>
		<command>nasal</command>
		<script>
			<![CDATA[
				if (getprop("/sim/current-view/view-number") > 0) {
					setprop("/sim/current-view/view-number", 0);
					setprop("/sim/current-view/goal-pitch-offset-deg", getprop("/sim/view[0]/config/pitch-offset-deg"));
					setprop("/sim/current-view/goal-heading-offset-deg", 0.0);
				} else {
					headtracker.reset();
				}
			]]>
		</script>
	</binding>
</button>

Troubleshooting

I get a "missing ... .dll" error

Download the faceAPI demo to install the neccessary .dlls.

Translating along X, Y or Z axis results in too large movements

If you experience that translations are exagerated too much despite appropriate settings in FaceTrackNoIR's curve settings, then you might want to add e.g. a factor of 0.01 to the headtracker.xml file in the Nasal directory like e.g.:

 z.apply(0.01 * getprop("/sim/headtracker/z-m"));

Related content

External links