Installing Touchlib on Mac OS X

From NUI Group Community Wiki

Jump to: navigation, search
       1.  Install Apple Developer Tools.  This package is included as an optional install on your original OS X installation disk.  Alternatively, you can download the new version of Xcode here.

2. Install Darwinports. Darwinports offers more current software packages than Fink.

3. Install the required packages using Darwinports (instructions on each linked page, or use Porticus for a GUI):

(If this doesn't work, go to step 4. This has worked successfully with Porticus on both a G5 Tiger and an Intel Leopard)

If all of those install without errors skip to step 5. If you can't get opencv to install, go to step 4 for instructions on building it yourself.

[Note: Python comes pre-installed on OS X Tiger]

4. Install OpenCV (only if you couldn't get it through darwinports).

At the Terminal type:

cvs -d:pserver:anonymous@opencvlibrary.cvs.sourceforge.net:/cvsroot/opencvlibrary login

It will ask for a password. Just hit enter. Now, copy this in:

cvs -z3 -d:pserver:anonymous@opencvlibrary.cvs.sourceforge.net:/cvsroot/opencvlibrary co -P opencv

This will download the source code into a directory in your home folder. It is about 100MB and may take a while depending on your connection speed. Once this is done, navigate to the new directory in Terminal:

cd opencv

Now, we finally get to configure the source code. It would be wise to make a build folder by typing in the following:

mkdir build; cd build

The new versions of OpenCV will automatically compile Universal Binary. Configure OpenCV using the packages you just installed from Darwinports:

../configure CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib"

After everything is configured, install it using the command:

make
sudo make install

To double check that everything is working type:

make check

If there are no serious errors, everything OpenCV should be working.

5. Install OSCPack

Download oscpack here.

Replace their Makefile with this Makefile File:OscpackMakefileForMacOSX.txt (modified for OS X).

In the oscpack directory, make and install it:

make
sudo make install

6. Install SVN

Download svn here.

Note that you will need to add /usr/local/bin to either your south beach smoke electronic cigarette reviews account's PATH, or the system level PATH if it has not already been altered for some other application. To modify to the path for all users, modify /etc/profile (for sh, ksh, bash, etc.) or /etc/csh.login (for csh, tcsh, etc).

7. Install Touchlib

Create a driectory for Touchlib and download the latest copy.

mkdir ~/Desktop/Touchlib/
cd ~/Desktop/Touchlib/
svn co http://touchlib.googlecode.com/svn/trunk/ multitouch

You might need some information, or answer for question how to uninstall software on mac. You can find it among non-commercial articles.


=

FIXME::This next section should be resolved in the SVN repository ASAP

There are a couple small touchlib code changes needed in version 47

In the file ./src/CBlobTracker.cpp

change line [strike]704[/strike] 734 from:

if((i == (numcheck-1) & extraIDs > 0) || current[start].error > reject_distance_threshold)

to

if((i == (numcheck-1) & extraIDs > 0))// || current[start].error > reject_distance_threshold)

Next, in the file ./demos/smoke/fluid2d.h

change line [strike]15[/strike] 19 from:

#include

to

#include "fluid2d.h"
=

Now navigate to the source code folder and compile:

cd multitouch
cmake .
make

There shouldn't be any errors.

So, now you can test a couple programs.

cd src/
./sampleapp

or

./configapp

You can also try out the demo apps:

cd ./demos/smoke/
./smoke

and

cd ./demos/osc/
./osc
cd ./demos/
./osc

Pong will not work on Linux or OS X because it relies on some Windows libraries.

As you will probably see, the program will come up -- you might even see yourself in the camera, then it will crash with some memory issues, bus errors or segmentation faults.

I have yet to check into these errors, but hope to soo. Good luck and as this is a wiki, please make changes for the sake of clarity/efficiency.

Christopher

References:

some info copied and pasted from other guides on this site as well as the OpenCV wiki.

  • Please excuse the formatting neglect on this first revision.
    • These instructions were developed on an Intel-based Macbook Pro, running OS X 10.4.9. While the instrctions should also work on older PPC machines Intel's OpenCV library and the associated Integreated Performance Primitives were originally designed to take full advantage of Intel Chips.