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

Thanks a lot for the article!
I tried to compile PTAM on mac 10.6 but I keep getting this error.
Tried to rebuild libcvd as in this troubleshoot guide, but still no luck.
Any idea on how to solve this?
Thanks!!
Hola Patricio como andas? Te hago una consulta, estoy compilando las librerias PTAM & PTAMM en osx 10.6 y cuando estoy en el paso de:
cd libcvd
./configure-10.5-32bit
make -j3
no logra terminar el proceso y me tira este error:
cvd_src/OSX/qtbuffer.cpp:148: error: ‘vector’ was not declared in this scope
cvd_src/OSX/qtbuffer.cpp:148: error: expected primary-expression before ‘int’
cvd_src/OSX/qtbuffer.cpp:148: error: expected `;’ before ‘int’
cvd_src/OSX/qtbuffer.cpp:151: error: ‘allowedDevices’ was not declared in this scope
cvd_src/OSX/qtbuffer.cpp:156: error: ‘allowedDevices’ was not declared in this scope
cvd_src/OSX/qtbuffer.cpp:159: error: ‘allowedDevices’ was not declared in this scope
cvd_src/OSX/qtbuffer.cpp:191: warning: array subscript has type ‘char’
make: *** [cvd_src/OSX/qtbuffer.o] Error 1
make: *** Waiting for unfinished jobs….
Tenes idea que puede ser?
Sebas, si no el tipo “vector” q es una de las STL es quizá x q le esta pifiando a los directorios de compilación. Fijate que este buscando en los directorios “include” correctos de tu compu.
También chequeá el SDK q esta usando, la arquitectura y q sea 32bits
I’m running into the exact same errors:
cvd_src/OSX/qtbuffer.cpp: In constructor ‘CVD::QT::RawQT::RawQT(const CVD::ImageRef&, unsigned int, unsigned int, bool, bool)’:
cvd_src/OSX/qtbuffer.cpp:148: error: ‘vector’ was not declared in this scope
cvd_src/OSX/qtbuffer.cpp:148: error: expected primary-expression before ‘int’
cvd_src/OSX/qtbuffer.cpp:148: error: expected `;’ before ‘int’
cvd_src/OSX/qtbuffer.cpp:151: error: ‘allowedDevices’ was not declared in this scope
cvd_src/OSX/qtbuffer.cpp:156: error: ‘allowedDevices’ was not declared in this scope
cvd_src/OSX/qtbuffer.cpp:159: error: ‘allowedDevices’ was not declared in this scope
cvd_src/OSX/qtbuffer.cpp:191: warning: array subscript has type ‘char’
make: *** [cvd_src/OSX/qtbuffer.o] Error 1
Was there any resolution/fix that you had found?
For anyone else that finds this, I ended up downloading an older libcvd at : http://git.savannah.gnu.org/cgit/libcvd.git/commit/?id=d7d7f2fa0ea5a0fdc3aba640ecd21257e5a8eb38
leading me to find out that I had missed the +universal when installing my libdc1394 via port.
and I had to make the edits to play_video_source.cc mentioned here: http://ewokrampage.wordpress.com/2011/09/30/how-to-get-ptam-and-ptamm-running-on-osx-10-6-and-probably-10-7/
One of the above caused/fixed my problem here?!
Can you try adding #include somewhere around the beginning?
Patricio,
Great guide! It’s working perfectly.
There’s something wrong though: there is an error in the makefile’s COMPILEFLAGS edition… should be like this:
COMPILEFLAGS = -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -I /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
Also, after doing this, camera calibrator was not working yet. I had to open VideoSource_OSX.cc and edit line 24 in order to make it work:
pvb= new QTBuffer(ImageRef(640,480), 0, true);
this line should be like:
pvb= new QTBuffer(ImageRef(640,480), 0, false);
Thanks and I hope you all get lucky and make it work!!!
This tutorial is really helpful. However, I am using Lion 10.7.4. Following the steps I got the error
ignoring file /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib/libstdc++.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Seems there is no i386 support in 10.7.0 in libstdc++.dylib. Has anybody built PTAM on 10.7 already? How to fix this?
Thank you!
Ben