1 of 3
1
Touchlib Installation/Compiling Instructions
Posted: 28 January 2007 10:57 AM   [ Ignore ]
Administrator
Avatar
RankRankRankRank
Total Posts:  535
Joined  2006-11-09

UNDER REVISION

What is Touchlib?

Touchlib is an open source library for creating multi-touch interaction surfaces. It handles tracking blobs of infrared light and sending your programs these touch events, such as ‘finger down’, ‘finger moved’, and ‘finger released’. It supports most camera/webcam types. Touchlib is written in C++ (the BlobTracking / Analysis is all written by David Wallin) and has a Visual Studio 2005 Solution (*.sln) ready to compile. The source code includes our main library which you can link into your application to start capturing touch events. Also included is a basic config app which you will need to be run in order to calibrate your camera, and has a couple demo applications.  You can check out some of the demo applications if you want to see how it works, pong or the config app should be fairly easy to follow. Setting up a bare minimum multitouch app should only take a dozen lines of code or less.

No docs are available right now and it’s currently Windows only (though it should be possible to make everything compile under other OS’s with a little work)



Recommendations:

Requirments: Download and install the following; (Create folder “C:\touchlib\” for a project folder)


  1. OpenCV

  2. DSVideoLib

  3. VideoWrapper

  4. GLUT

  5. Microsoft Platform SDK

Step by Step Compiling Instructions.

1.) Get the latest touchlib source here: http://code.google.com/p/touchlib/source (if you need a subversion interface please try tortoisesvn for Windows)



2.) Add the following “Environment Variables” -("Right Click” My Computer >> Properties >> Advanced >> Environmental Variables >> Under System Variables >> “Click NEW")

  1. DSVL_HOME - dsvideolib root directory, Example: “C:\touchlib\DSVL\”

  2. VIDEOWRAPPER_HOME - root directory of the video wrapper library, Example: “C:\touchlib\Wrapper”

  3. OPENCV_HOME - root directory of OpenCV, Example: “C:\Program Files\OpenCV”

To be continued…

Video Demonstrations





We thank David Wallin, for making Touchlib available to us, and for all his hard work on Touchlib. For more info about Touchlib, visit this link

 Signature 

~

Profile
 
 
Posted: 01 February 2007 04:08 AM   [ Ignore ]   [ # 1 ]
Administrator
RankRankRank
Total Posts:  300
Joined  2007-01-08

Newbie’s Guide to getting Touchlib to compile.
Jan 6 2007

FOLLOW THESE INSTRUCTIONS AT YOUR OWN RISK!

I am completely new to C++ so it took me a while to get Touchlib to compile, below is a rough “how-to” which will hopefully make the process a little easier for you.

**************************************************************
// Download Files
**************************************************************
Download Visual c++ 2005 Express edition
Download Latest Platform SDK
Download Latest DirectX SDK
Download Open CV
Download VideoWrapper
Download DSVL

Install or Unzip everything into sensible directories

**************************************************************
// Easy way to install the Platform SDK for Visual c++ express
**************************************************************
Visual Studio 2005 Express needs some modification in order to get it working correctly.

Create a directory called “PlatformSDK” under “Program FilesMicrosoft Visual Studio 8VC”
Then copy the “bin”, “include”, and “lib” directory from the PSDK installation directory into this new directory.

**************************************************************
// Add Environment Variables
**************************************************************
Right click “My Computer” and go to “properties”, click the “advanced” tab, and select “Environment Variables”.
Create a New variable for DSVL_HOME with a value of the DSVL installation directory (eg c:multitouchdsvl). 
Repeat for VIDEOWRAPPER_HOME.
Repeat for OPENCV_HOME.

**************************************************************
// Modify altbase.h to work with Visual c++ express
**************************************************************
For now you have to edit a couple files to remove a couple errors.

Taken from http://dev.openwengo.com/trac/openwengo/trac.cgi/wiki/HowToBuildFromSourceNgVs2005

edit “C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKIncludeatlatlbase.h” (or “c:Program FilesPlatform SDKincludeatlatlbase.h")

Go to around line 287 and comment out the following:

============================================
/*
PVOID __stdcall __AllocStdCallThunk(VOID);
VOID __stdcall __FreeStdCallThunk(PVOID);

#define AllocStdCallThunk() __AllocStdCallThunk()
#define FreeStdCallThunk(p) __FreeStdCallThunk(p)

#pragma comment(lib, “atlthunk.lib")
*/
============================================

And now add the following replacement definition:

============================================
// workaround for not having atlthunk.lib in PSDK or VC++ 2005 Express Edition
#define AllocStdCallThunk() HeapAlloc(GetProcessHeap(),0,sizeof(_stdcallthunk))
#define FreeStdCallThunk(p) HeapFree(GetProcessHeap(), 0, p)
============================================

Error fixed: link error missing atlthunk.lib when building PhApi.dll

Explanation: atlthunk.lib is only delivered with the full version of Visual Studio 2005. However, if ATL classes are not used the workaround described above enables to compile and link correctly.

See the following links for more details:

http://forums.microsoft.com/msdn/showpost.aspx?postid=64509&siteid=1
http://resources.kairo.at/mozilla/build/make-win-tinderbox-vc8express.html

**************************************************************
// Modify ctlutil.h because there is an error in its code???
**************************************************************
Taken from (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=63785&SiteID=1)

Edit C:Program FilesMicrosoft Platform SDKSamplesMultimediaDirectShowBaseClasses/ctlutil.h

Go to line 278

============================================
private:
// Prevent bugs from constructing from LONG (which gets
// converted to double and then multiplied by 10000000
COARefTime(LONG);
operator=(LONG);
};
============================================

and change

============================================
operator=(LONG);
============================================

to

============================================
COARefTime& operator=(LONG);
============================================

**************************************************************
// Add the include directories
**************************************************************
Now you need to put a few include directories.

Open up the touchlib solution.sln.  Right click the “touchlib” in the solution explorer, and click properties.  Go to C++ tree and click “general”, then click “additional Include Directories” and add:

DirectX include directory (eg “C:Program FilesMicrosoft DirectX SDK (December 2006)Include")
C:Program FilesMicrosoft Platform SDKSamplesMultimediaDirectShowBaseClasses
C:Program FilesMicrosoft Visual Studio 8VCPlatformSDKIncludeatl

**************************************************************
// Now it should compile!
**************************************************************

Profile
 
 
Posted: 15 February 2007 09:48 PM   [ Ignore ]   [ # 2 ]
New Member
Rank
Total Posts:  2
Joined  2007-02-12

Hi,
I’m fairly new at c++ but I have followed your instructions and experiencing an error when building, “Error 1 fatal error LNK1181: cannot open input file ‘cv.lib’ touchlib”.  I would really appreciate it if you had any advice :D I’m really happy you took the time to write the tutorial or else I would have NEVER even got this far!!! Thank You very much!

Profile
 
 
Posted: 15 February 2007 09:56 PM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  535
Joined  2006-11-09

Hey Jarge,

Please join us to chat, alot easier to troubleshoot.

IRC: #ftir on irc.freenode.net

 Signature 

~

Profile
 
 
Posted: 02 April 2007 10:12 PM   [ Ignore ]   [ # 4 ]
New Member
Rank
Total Posts:  4
Joined  2007-04-02

Hi,

my name is joey,

I am trying following the instruction

and want to build my own multi-touch panel

but I can’t find your “touchlib” source on the internet

only the bin file

google code download link is empty now.

Profile
 
 
Posted: 02 April 2007 11:25 PM   [ Ignore ]   [ # 5 ]
Administrator
RankRankRank
Total Posts:  300
Joined  2007-01-08

Well the bins are the compiled source code… were you planning on editing them?

But the source codes are here i think:
http://touchlib.googlecode.com/svn

Profile
 
 
Posted: 03 April 2007 04:35 PM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRank
Total Posts:  204
Joined  2007-04-03

Ok I just compiled it according to Joobs “Newbie’s Guide to getting Touchlib to compile.”

Since I have the full vs2k5 I only went into the following problems:

(1)
Modifying: ctlutil.h
because of strange errors

(2)
configapp.cpp
you need to add this lib: #pragma comment(lib, “OpenGL32.lib")

so it will look like:
#include “glut.h”
#pragma comment(lib, “OpenGL32.lib")
#pragma comment( lib, “glut32” )
#pragma comment( lib, “user32” )

(3)
configapp
Some weird error about the exit():

error C2381: ‘exit’ : redefinition; __declspec(noreturn) differs
error C3861: ‘exit’: identifier not found, even with argument-dependent lookup

Source:
http://www.cs.tufts.edu/research/graphics/resources/GLUT/GLUT.htm

To fix the error, right click on the project name in the Solution Explorer tab and select Properties -> C/C++ -> Preprocessor -> Preprocessor definitions and append GLUT_BUILDING_LIB to the existing definitions, seperated by semicolons.

 Signature 

My multitouch blog: http://www.multigesture.net
Howto: Compile touchlib on windows XP/Vista
Howto: Compile touchlib on Ubuntu Linux
Downloads: Touchlib SVN builds

Profile
 
 
Posted: 08 April 2007 06:55 AM   [ Ignore ]   [ # 7 ]
Sr. Member
RankRankRank
Total Posts:  317
Joined  2007-03-13

is the windows server 2003 platform sdk really needed? and if so, for what?

(i take it has something to do with one pc doing all the detection and another doing all the application stuff?)

--reason i’m asking - bandwidth is quite expensive down here in south africa… grin

 Signature 

my multitouch blog: http://www.whitespaced.co.za/
those that say it can’t be done shouldn’t interrupt those doing it

Profile
 
 
Posted: 09 April 2007 01:44 PM   [ Ignore ]   [ # 8 ]
Administrator
Avatar
RankRank
Total Posts:  204
Joined  2007-04-03
donovan - 08 April 2007 06:55 AM

is the windows server 2003 platform sdk really needed? and if so, for what?

(i take it has something to do with one pc doing all the detection and another doing all the application stuff?)

--reason i’m asking - bandwidth is quite expensive down here in south africa… grin

Yes it is, the main reason is because Directdraw (header + libs) is no longer part of the DirectX SDK but of the Platform SDK

 Signature 

My multitouch blog: http://www.multigesture.net
Howto: Compile touchlib on windows XP/Vista
Howto: Compile touchlib on Ubuntu Linux
Downloads: Touchlib SVN builds

Profile
 
 
Posted: 10 April 2007 02:58 AM   [ Ignore ]   [ # 9 ]
New Member
Rank
Total Posts:  76
Joined  2007-03-27

Is it neccesary that everyone compiles it themselves? I don’t understand why an exe can be made. On another subject, with the source could compiling it for other platforms such as OS X be possible without modification to the code itself?

 Signature 

Worlds youngest in the multitouch field of research. See my blog.

Profile
 
 
Posted: 10 April 2007 03:56 AM   [ Ignore ]   [ # 10 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1010
Joined  2007-01-08

No it’s not necessary for everyone to compile it themselves. There are binairies (executable files) online available http://www.whitenoiseaudio.com/touchlib/touchlibBins.zip

I’m not entirely sure if these are the latest binairies though.

Some people managed to port touchlib to get it working with Mac OS and Linux, but i’m not familiar with how thats been done

 Signature 

http://www.multitouch.nl / natural-ui.com

Profile
 
 
Posted: 12 May 2007 09:12 AM   [ Ignore ]   [ # 11 ]
Administrator
Avatar
RankRank
Total Posts:  204
Joined  2007-04-03

Remarks:

(1) ctlutil.h
After upgrading VS2K5 with SP1 the header file no longer has to be patched.

(2) After upgrading VS2K5 osc demo won’t build
Its because the osc lib file was build with an older compiler. You can fix it by either rebuilding the lib or do the following
In the project settings of osc, change this (only in release mode):
C/C++ / Optimization / Whole Program Optimization: No

Upgrade VS2K5 SP1
URL: http://msdn2.microsoft.com/en-us/vstudio/bb265237.aspx
note: you need A LOT of space on your harddrive, 4+ GB or smth. Reason for this is the lame installer (caches the files, creates multiple copies).
If you don’t have enough space on C:\ dont even bother installing it or you will end up like me: a screwed window system (missing libs). (I had to reinstall my total rig).

 Signature 

My multitouch blog: http://www.multigesture.net
Howto: Compile touchlib on windows XP/Vista
Howto: Compile touchlib on Ubuntu Linux
Downloads: Touchlib SVN builds

Profile
 
 
Posted: 13 June 2007 01:17 AM   [ Ignore ]   [ # 12 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1345
Joined  2007-04-08

I tried Joobs method, but I can’t seem to get it compiled on windows. I don’t really know anything about compiling so I’m not positive if I’ve done something wrong.

Is it normal to have many warnings when trying to build? I get a bunch of warnings, but am only down to one error “1>LINK : fatal error LNK1104: cannot open file ‘winmm.lib’” I don’t know how to get over the winmm.lib file fata error.

Any thoughts?

NEVERMIND: I believe I have this part working now.

 Signature 

My Multitouch Blog
My Youtube
Multitouch FAQ - Need Help? Click here!

Profile
 
 
Posted: 13 June 2007 01:38 AM   [ Ignore ]   [ # 13 ]
New Member
Rank
Total Posts:  40
Joined  2007-03-16

Are you positive that the file exists somewhere on your computer? if so, you’ve got to link it right.. If you are using Visual Studio you have to right click on the project and click properties. Now you are able to change to link stuff..(and see if you linked to the dir where it is) Actually it’s described pretty decent in Joobs post..

I hope you’ll get it right..

Profile
 
 
Posted: 14 June 2007 04:56 AM   [ Ignore ]   [ # 14 ]
Jr. Member
Avatar
RankRank
Total Posts:  198
Joined  2007-05-05

anyone care to make some binaries for people like me (to stupid to compile themselvessmile)?
I was wondering about which revision the current bins are? current version on google code is 44, I think..
I´m just hoping that the bug with the background subtraction is gone… (I discribe it in the “OSC crashes on startup” thread)

thanks---

 Signature 

Blog: http://iad.projects.zhdk.ch/multitouch/
180 Project: http://www.timroth.de/180/

Profile
 
 
Posted: 14 June 2007 01:00 PM   [ Ignore ]   [ # 15 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1345
Joined  2007-04-08

I finally almost got everything compiled. The only one that won’t compile for me is the Smoke demo. I’m getting 121 errors with it. They’re all in relationship to “atlconv.h” Has anyone else had this problem? I have all the other ones compiled though (Touchlib, configapp, demo pong, mousedriver, and osc). I can post this in a bit if you’d like what I have. I don’t really know how to get the smoke application compiled though.

 Signature 

My Multitouch Blog
My Youtube
Multitouch FAQ - Need Help? Click here!

Profile
 
 
   
1 of 3
1