Augmented Reality Junkie

AR Developer | Postgraduate Research Student |

PTAMM porting to OSX Leopard

with one comment

PTAMM is an extension of the work by Georg Klein on the PTAM project, which adds multiple map support, you can read about it at the project’s website. I would advise that you download and compile PTAM first, it comes with great instructions and I have some troubleshooting notes here as you will need all the same libraries.

Now, unlike PTAM, PTAMM doesn’t come with a tailored makefile for OSX or a VideoSource_OSX.cc file. Luckily the codebases are very similar and so, with some editing it is possible to compile to OSX.

I will assume PTAM is stored in PTAM_src/ and PTAMM in PTAMM_src/ for ease.

Copy your VideoSource_OSX.cc from PTAM_src/ to PTAMM_src/

Then copy /PTAMM_src/Builds/Linux/Makefile to PTAMM_src/

Changes to VideoSource_OSX.cc first:

Beneath the includes section add the line:

 using namespace PTAMM { 

And then add the closing } at the end of the file (so the braces surround everything but the includes)

Save and exit. Then the Makefile

First locate the COMPILEFLAGS arguments, and you should see -D_LINUX. Replace this with -D_OSX

Now change your LINKFLAGS so that it matches the following:

LINKFLAGS = -framework OpenGL -framework VecLib -lGVars3 -lcvd $(3DSLIB)

It is vitally important that the reference to the OpenGL framework is there otherwise nothing will compile. Now you should be able to follow the standard install instructions and everything should go OK.

These instructions were made on a leopard (10.5.8) box. Snow Leopard instructions to follow from Andrew Hatch. I’ll link here when they are ready.

Written by Adam Clarkson

August 17, 2010 at 4:22 pm

Compiling PTAM on OSX Leopard

with 16 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

Follow

Get every new post delivered to your Inbox.