Skip to main content

Head tracker using webcam for auralization

GitHub release GitHub last commit GitHub issues LICENSE


Support files for the Internoise 2021 paper "Head tracker using webcam for auralization".

Description

Head tracker via camera face tracking and communication via UDP protocol.

Built on top of the Google's MediaPipe face_mesh (python release).

Folder structure:

  • /EACheadtracker: Contains the source code for the HeadTracker as published in the paper.
  • /test: Presents auralization experiments in MATLAB using the HeadTracker.
  • /audios: The raw files for the audio examples in the paper.
  • /videos: The images related to the head movements that produced the audios in the paper.
  • /presentation: PDF conference presentation of the paper.

System support

OS Support
Windows Tested on Windows 10
macOS Tested on v10.15 and v11.2.1 (amd_64)
Linux Tested on Ubuntu 18.04.5 LTS
Raspberry Pi Tested



Setup python environment

  • This application only requires you to run pip install mediapipe==0.8.3.1. However for the sake of good practices, we recommend you create a new python enviroment and install the required libraries with:
cd internoise2021-headtracker/src/

conda create --name headtracker python=3.8

conda activate headtracker

pip install -r requirements.txt
  • MediaPipe supports Python 3.6 to 3.8.

Raspberry Pi

Install OpenCV and mediapipe from the sources bellow:

Using the HeadTracker

The application can be initialized with the default parameters by running:

python HeadTracker.py

It is also possible to specify some other useful parameter by adding parameter/value flags during initialization, such as:

python HeadTracker.py --input_id 0 --port 5555 --width 1280 --height 720

Use python HeadTracker.py --help to see all the available options.

  • Alternatively you may use the Windows executables distributed here. Notice that you don't need to setup an environment, or install anything else, in order to use the .exe standalones. (The distributed executables are outdated in relation to this repository)

  • Connect to any plataform that accepts UDP/IP connection, use the address: IP:'127.0.0.1' and PORT:5555 .

  • In order to close the app, mouse clicking "quit the window" might not work in all operating systems, as a general rule use "Esc" to finish the process.

Interpreting received data

The HeadTracker application currently sends to the server yaw, pitch and roll information in degrees and translational positions in centimeters, where downwards pitch and counterclockwise roll and yaw are denoted with negative angles, such that the full rotation is bounded between -180° and 180°, as illustrated bellow.

The sent data are strings encoded into bytes, for e.g. if the sent/received message is: b'-5,10,0,30,9,75', the corresponding coordinates are yaw=-5°, pitch=10°, roll=0°, Tx=30 cm, Ty=9 cm and Tz=75 cm — depending on the application the data needs to be decoded for proper use.

Example: reading HeadTracker output data with Matlab

Bellow you can find a snippet of how to connect to the UDP address and convert the binary data to matlab array.

% Open the HeadTracker application (make sure the file path is added to matlab path variables)
open('HeadTracker.exe')

% Connect to the local server
udpr = dsp.UDPReceiver('RemoteIPAddress', '127.0.0.1',...
                       'LocalIPPort',5555);

% Read data from the head tracker
while true
    py_output = step(udpr);
    if ~isempty(py_output)
        data = str2double(split(convertCharsToStrings(char(py_output)), ','));
        disp([' yaw:', num2str(data(1)),...
             ' pitch:', num2str(data(2)),...
             ' roll:', num2str(data(3))])
    end
end

Other examples of the connection to matlab are posted here.


Cite us

D. R. Carvalho; W. D’A. Fonseca; J. Hollebon; P. H. Mareze; F. M. Fazi. Head tracker using webcam for auralization. In 50th International Congress and Exposition on Noise Control Engineering — Internoise 2021, pages 5071–5082(12), Washington, DC, USA, Aug. 2021. doi: 10.3397/IN-2021-2956.

Bibtex:

@InProceedings{headtracker:2021,
  author    = {Davi Rocha Carvalho and William {\relax D'A}ndrea Fonseca and Jacob Hollebon and Paulo Henrique Mareze and Filippo Maria Fazi},
  booktitle = {{50th International Congress and Exposition on Noise Control Engineering --- Internoise 2021}},
  title     = {Head tracker using webcam for auralization},
  year      = {2021},
  address   = {Washington, DC, USA},
  month     = {Aug.},
  pages     = {5071--5082(12)},
  doi       = {10.3397/IN-2021-2956},
}

Metadata

Release files for EACheadtracker 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for EACheadtracker 0.0.1
File Size Uploaded
EACheadtracker-0.0.1.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for EACheadtracker 0.0.1
File Interpreter ABI Platform
EACheadtracker-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 80.6 kB

Release files / EACheadtracker-0.0.1.tar.gz

Download URL EACheadtracker-0.0.1.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a59e507911a94b0d25602bcb8f5451a25178b6edfb3bf094ffcfed8aea5c620a
BLAKE2b-256 checksum
How to use checksums
e711d1bc0df54e298794d7ab8454496ea4951e73de013cc7bfd5a703d9a1a632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.6

Release files / EACheadtracker-0.0.1-py3-none-any.whl

Download URL EACheadtracker-0.0.1-py3-none-any.whl
Size 61.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ae10ef0e6c8b2350f09f31164ad6a7c8b03d115567cd4da41667b8e8db54fb9
BLAKE2b-256 checksum
How to use checksums
b804dfb435bdd041be507fa1952221b7fe13dc0e09eb657142708b3df79c02a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page