Doing some research I stumble upon PTAM libraries developed by Georg Klein. It´s a camera tracking system for augmented reality that don´t requires markers, pre-made maps, known templates, or inertial sensors. Nice isn´t it?
In order to install on MacOSX you need to following the next steps.
Start by geting some basic stuff you are going to need.
sudo port install cvs git-core libpng lib3ds libdc1394 +universal
Then let´s get a copy of the last TooN, libcvd and gvars3 libraries.
cvs -z3 -d:pserver:anoncvs@cvs.savannah.nongnu.org:/cvsroot/toon co TooN
git clone git://git.savannah.nongnu.org/libcvd.git
cvs -z3 -d:pserver:anoncvs@cvs.savannah.nongnu.org:/cvsroot/libcvd co gvars3
Then download the PTAM libraries from http://www.robots.ox.ac.uk/~gk/PTAM/ and unzip it on the same directory you are using for the other three libraries.
On your libcvd directory you will find a script call
configure_osx_32bit . Copy it on gvars3 directory
cd libcvd
cp configure_osx_32bit ../gvars3
Install TooN by:
cd ../TooN
./configure
sudo make install
Open
libcvd/progs/video_play_source.cc with an editor. In line 173 change GL_TEXTURE_RECTANGLE_NV for texTarget . It should look like this:
// ... bla bla
new_frame=1;
glTexImage2D(*frame, 0, texTarget);
}
// ... bla bla
Open
PTAM/Build/OSX/Makefile with an editor and change you COMPILEFLAGS an LINKFLAGS to look like this ones:
COMPILEFLAGS = -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -L /usr/local/include -m32 -D_OSX -D_REENTRANT
LINKFLAGS = -arch i386 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -L /usr/local/lib -m32 -framework OpenGL -framework VecLib -lGVars3 -lcvd
Configure and libcvd, gvars3 and PTAM directory.
cd libcvd
./configure-10.5-32bit
make -j3
sudo make install
cd ../gvars3
./configure-10.5-32bit
make -j3
sudo make install
cd ../PTAM
cp Build/OSX/* .
make -j3
Before runing
./PTAM you probably want to calibrate te camera. In order to that print the calibration pattern, run the ./CameraCalibrator. Take some sanpshoots, optimize and save.
That will see that a file call
camera.cfg it´s going to apear. That will le you run PTAM correctly and smoothly.
Once you start playing with PTAM you probably want more stuff. What´s next? Robert Castle make some nice advances to PTAM on a librarie call PTAMM. The sources and nice videos could be found at http://www.robots.ox.ac.uk/~bob/software/index.html .
Once you download and unzip ptamm.zip you have to open once againg PTAMM/Build/OSX/Makefile with an editor and change you COMPILEFLAGS an LINKFLAGS to look like this ones:
COMPILEFLAGS = -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -L /usr/local/include -D_OSX -D_REENTRANT -m32
LINKFLAGS = -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -L /usr/local/lib -framework OpenGL -framework VecLib -lGVars3 -lcvd $(3DSLIB) -m32
Then copy the
Makefile to the main directory of PTAMM and compile
cd ../PTAM
cp Build/OSX/* .
make -j3
