Augmented Reality Junkie

AR Developer | Postgraduate Research Student |

Posts Tagged ‘10.5

Compiling PTAM on OSX Leopard

with 17 comments

**NOTE: THIS IS TO GET PTAM RUNNING ON LEOPARD (10.5.8) NOT ON SNOW LEOPARD. WHILE MUCH OF THIS INFORMATION WILL BE USEFUL FOR SNOW LEOPARD, YOU WILL NEED TO COMPILE THE LIBRARIES FOR 32-bit as PTAM DOES NOT SUPPORT 64-BIT LIBRARIES **

**SNOW LEOPARD NOTES CAN NOW BE FOUND HERE FROM MY COLLEAGUE ANDREW HATCH**

Parallel Tracking and Mapping is a solution developed by Georg Klein et al. at the Robotics Lab in Oxford University. It addresses the problem of markerless Augmented Reality by using the features which already exist within the environment, rather than having to add special markers to the scene.

It is officially supported by OSX in the downloadable files, however I ran into a couple of issues, and it seems a few other people on the net have had similar issues too. So here are my solutions to the problems I had:

Firstly you need to make sure that you have the X11 libraries for OSX installed. These can be found on your leopard CD or on the XQuartz project website. You will also need to install fink in order to grab some packages. Let’s do that first. Fire up your terminal and:

sudo fink install readline5 

That will take care of one of the problems before you even get to it. Also you will need to compile the libc1394 sources which area available here. Now I’m going to assume you’ve downloaded PTAM and the required libraries as explained in the PTAM README.txt

The order of compilation is:

  1. TooN
  2. libcvd
  3. gvars3
  4. PTAM

TooN is a straightfoward ./configure make sudo make install – that should work first time for you

libcvd isn’t that easy. In your libcvd source directory, edit the file ./cvd/gl_helpers.h

You need to change:

#include <GL/gl.h>
#include <GL/glu.h>

To:

#include <OpenGL/gl.h>
#include <OpenGL/glu.h>

Which makes sure that the OSX X11 libraries are found and used for this. Save and exit.

Now you can go for a configure, the README file suggests that you use the options

 ./configure --without-ffmpeg 

However, I found that the configure script still has difficulty finding the X libraries resulting in a compilation line:

 Checking for X.... no 

In order to explicitly tell the compiler where to find it:

./configure --without-ffmpeg --x-libraries=/usr/X11/lib --x-includes=/usr/X11/include

Moving swiftly onwards to the next error:

Undefined symbols:
"_png_set_gray_1_2_4_to_8", referenced from:
CVD::PNG::png_reader::png_reader(std::basic_istream<char, std::char_traits<char> >&)in png.o</div>
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libcvd.dylib] Error 1

This is caused by a conflict between libcvd and the newer version of libpng. In order to remedy it edit (in your libcvd source folder still) ./pnm_src/png.cc

Find the line which makes a function call to:

 png_set_gray_1_2_4_to_8 

and replace the call with

 png_set_expand_gray_1_2_4_to_8

That should resolve that error.

You should now be able to go to PTAM source folder, run the makefile and all should go OK.

Written by Adam Clarkson

August 17, 2010 at 3:57 pm