I am Charmie

メモとログ

PTAM on Ubuntu 14.04

This post is for compiling PTAM (Parallel Tracking and Mapping) on Ubuntu 14.04. As mentioned on the web, a cool guy published a set of script, patch, etc for PTAM easy-compile on Ubuntu and the files are available on this github. However, some of the file contains typo and therefore the compilation with the original files failed on my computer (Ubuntu 14.04).

I wrote a script and a patch file to enable the compilation. Save the following script as PTAM-linux-yuji.bash and the following patch file as YujiPTAM-r114-linux.patch in the same directory as README is saved. Then, type bash PTAM-linux-yuji.bash.

The script file is [code lang="bash"]

!/bin/bash

targettopdir=pwd/PTAM-work pwdinfo=pwd

sudo apt-get update sudo apt-get install build-essential cmake pkg-config sudo apt-get install liblapack-dev freeglut3-dev libdc1394-22-dev sudo apt-get install liblapack-dev libblas-dev sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev libv4l-dev sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libpostproc-dev libswscale-dev libavdevice-dev libsdl-dev sudo apt-get install libgtk2.0-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev

mkdir -p $targettopdir

TooN

pushd $targettopdir git clone git://github.com/edrosten/TooN.git cd TooN ./configure make sudo make install popd

libcvd

pushd $targettopdir git clone git://github.com/edrosten/libcvd.git cd libcvd mv cvd_src/convolution.cc cvd_src/convolution.cc-original cp $pwdinfo/hack/libcvd/convolution.cc cvd_src/convolution.cc export CXXFLAGS=-D_REENTRANT ./configure --without-ffmpeg --without-v4l1buffer --without-dc1394v1 --without-dc1394v2 make sudo make install popd

gvars3

pushd $targettopdir git clone git://github.com/edrosten/gvars.git cd gvars mv gvars/serialize.h gvars/serialize.h-original cp $pwdinfo/hack/gvars3/serialize.h gvars/serialize.h ./configure --disable-widgets make sudo make install popd

before you go further, re-arrange the dynamic libraries

sudo ldconfig

PTAM main

pushd $targettopdir unzip $pwdinfo/PTAM-r114-2010129.zip patch -p0 -d . < $pwdinfo/hack/PTAM/PTAM-r114-linux.patch patch -p0 -d . < $pwdinfo/YujiPTAM-r114-linux.patch cd PTAM cp Build/Linux/* . make

exit 0 [/code]

and the patch file is [code lang="diff"] --- PTAM/Build/LinuxMakefile 2014-09-23 16:44:15.979478461 +0900 +++ /home/charmie/PTAM-work/PTAM/Makefile 2014-09-23 16:41:31.574663222 +0900 @@ -6,8 +6,8 @@ CC = g++ # COMPILEFLAGS = -I MY_CUSTOM_INCLUDE_PATH -D_LINUX -D_REENTRANT -Wall -O3 -march=nocona -msse3 # LINKFLAGS = -L MY_CUSTOM_LINK_PATH -lGVars3 -lcvd -COMPILEFLAGS = -D_LINUX -D_REENTRANT -Wall -O3 -march=nocona -msse3 -I/usr/include/opencv-2.3.1 -LINKFLAGS = -L/usr/local/lib -lGVars3 -lcvd -lopencv_legacy -lopencv_core -lopencv_video -lopencv_highgui +COMPILEFLAGS = -D_LINUX -D_REENTRANT -Wall -O3 -march=nocona -msse3 -I/usr/include +LINKFLAGS = -L/usr/local/lib -lGVars3 -lcvd -lopencv_legacy -lopencv_core -lopencv_video -lopencv_highgui -lGLU -lGL -llapack -lblas -lgfortran

# Edit this line to change video source VIDEOSOURCE = VideoSource_Linux_OpenCV.o --- PTAM/Tracker.cc 2014-09-23 16:44:15.971478422 +0900 +++ /home/charmie/PTAM-work/PTAM/Tracker.cc 2014-09-23 16:06:21.312198996 +0900 @@ -19,6 +19,10 @@ #include <fcntl.h>

+#ifndef WIN32 + #include <unistd.h> +#endif + using namespace CVD; using namespace std; using namespace GVars3; --- PTAM/Build/Linux/VideoSource_Linux_OpenCV.cc 2014-09-23 16:44:15.979478461 +0900 +++ /home/charmie/PTAM-work/PTAM/VideoSource_Linux_OpenCV.cc 2014-09-23 15:02:10.909105878 +0900 @@ -105,3 +105,4 @@ *cap >> frame; conversionNB(frame, imBW); conversionRGB(frame, imRGB); +} \ No newline at end of file [/code]