Ubuntu + OpenKinect + Mouse Control

  

Mouse control with OpenKinect on Ubuntu Linux

Here is a quick tutorial to get use your hand as a mouse in a Minority Report-esque interface using the Kinect and Ubuntu.  Credit to Ooblik (Tim Flaman) for the awesome project. Before you begin, ensure that you have installed the OpenKinect drivers and they are functioning correctly.

Quickstart

sudo apt-get install libncurses5-dev freeglut3-dev libX11-dev libxtst-dev libxmu-dev cmake git

git clone https://github.com/Ooblik/Kinect-Mouse.git

cd Kinect-Mouse

mkdir build

cd build

cmake ..

make

sudo ./kmouse

Steps explained:

Install a few dependencies for the Kinect mouse:

sudo apt-get install libncurses5-dev freeglut3-dev libX11-dev libxtst-dev libxmu-dev cmake git

Use git to clone the source from Ooblik’s repo on Github:

git clone https://github.com/Ooblik/Kinect-Mouse.git

Then make yourself a build directory within the repo, use cmake to configure, and make to build.

cd Kinect-Mouse

mkdir build

cd build

cmake ..

make

Ensure that your Kinect is plugged in (USB and power), and run kmouse. It needs to be run as root unless you have followed the steps here to add your user to the ‘video’ group.

sudo ./kmouse

You will likely need to reposition the Kinect (or yourself) to get it working accurately… The mouse only works at a very specific distance from the Kinect.  This is the red area in the video viewer. To click the mouse, remain still over the target and the mouse will left click. Interaction is little more than a proof of concept at present… but it works!

 

2 Comments

  1. Marcos

    How does this work? How does kmouse take what the camera captures?

  2. Proxima

    I’m getting this when I try to make, don’t know why…

    Linking C executable kmouse
    CMakeFiles/kmouse.dir/kinect_mouse.c.o: In function `freenect_threadfunc’:
    kinect_mouse.c:(.text+0xdea): undefined reference to `freenect_find_video_mode’
    kinect_mouse.c:(.text+0xe24): undefined reference to `freenect_set_video_mode’
    kinect_mouse.c:(.text+0xe3f): undefined reference to `freenect_find_depth_mode’
    kinect_mouse.c:(.text+0xe79): undefined reference to `freenect_set_depth_mode’
    collect2: ld returned 1 exit status
    make[2]: *** [kmouse] Error 1
    make[1]: *** [CMakeFiles/kmouse.dir/all] Error 2
    make: *** [all] Error 2

Leave a Reply