Building VisualSFM on Ubuntu 12.04 (Precise Pangolin) Desktop 64-bit

Updated: Check out my paper on parallelizing SfM across a compute cluster

VisualSFM by Changchang Wu is a great tool for creating 3D reconstructions of photos. It’s really easy to use, but really hard to install. This guide will take you through getting it working on a clean installation of Ubuntu 12.04 Desktop 64-bit. I’ll warn you: you’ll need to install packages, download academic software, and edit and compile source code. This will also require more than 2 GB of hard drive space. If you run into any trouble, be sure to leave me a reply at the bottom of the post.

Getting Started

Start by creating a working directory for this procedure. I’m working in “~/vsfm”, which I’ll also refer to as “/home/scott/vsfm” when instructions require an absolute path. So, open a terminal and get started:

$ mkdir vsfm
$ cd vsfm

(Note, whenever you see a line beginning with “$”, that means you should type that line in your terminal.)

Setup NVIDIA CUDA (Optional)

VisualSFM supports acceleration on CUDA-enabled NVIDIA GPUs. It is also possible to set up VisualSFM to use ATI/AMD GPUs via OpenCL or to simply not use GPU acceleration. However, since I have an CUDA-enabled NVIDIA GPU, these instructions assume you do, too. (Coincidentally, the process should be easier without CUDA support, but you’ll have to figure out the details on your own.)

Grab the Linux 64-bit driver and the CUDA toolkit from the CUDA Downloads page. NVIDIA provides decent installation instructions here, but I’ll offer some quick tips for Ubuntu users:

  • Be sure to update your Ubuntu system before installation the CUDA software because if Ubuntu pushes you new Linux kernel, you’ll need to re-install the CUDA driver from scratch.
  • Install the driver first (i.e. devdriver_4.2_linux_64_295.41.run) per NVIDIA’s instructions; to shutdown Ubuntu’s graphical desktop press Ctrl+Alt+F1 to get a terminal, login, then run “sudo /etc/init.d/lightdm stop”
  • You can safely ignore the warning about the setup script failing.
  • Reboot from the command line after driver installation completes (“sudo reboot”).
  • Then install the CUDA toolkit after a reboot.

Download the Necessary Software

Let’s get started by getting the major pieces of software that comprise VisualSFM: SiftGPU, Multicore Bundle Adjustment, PMVS-2, CMVS, Graclus 1.2, and, of course, VisualSFM. You’ll also need to refer to certain installation instructions. You can find these applications and documentation pages at the following locations:

8/20/12: New link to PMVS-2 download, which points to an older version. This older archive contains compiled object files which are necessary to get PMVS/CMVS working. Alternatively, you can download the newest release and then grab mylapack.o here, which you’ll need for later steps in this tutorial.

5/9/13: Also note, CMVS and PMVS-2 are now hosted at http://www.di.ens.fr/. All links have been updated.

Install Dependency Packages

Next, you need to install a number of dependencies available through Ubuntu’s package manager. I’m sure you can these elsewhere on the web, but I highly recommend installing through Aptitude. To get all the required packages, just run this line (which might take a few minutes to download and install… also, be sure to copy and paste the full line below, which scrolls horizontally!):

$ sudo apt-get install libgtk2.0-dev libglew1.6-dev libglew1.6 libdevil-dev libboost-all-dev libatlas-cpp-0.6-dev libatlas-dev imagemagick libatlas3gf-base libcminpack-dev libgfortran3 libmetis-edf-dev libparmetis-dev freeglut3-dev libgsl0-dev

8/20/12: Added freeglut3-dev, libgsl0-dev

Build VisualSFM

Start by building VisualSFM, which should go smoothly.

$ unzip VisualSFM_linux_64bit.zip 
$ cd vsfm
$ make

Now the VisualSFM GUI is built, but it can’t actually generate 3D reconstructions yet.

8/20/12: If you run into errors with the GTK libraries, see Shyam Nambiar’s comments below on using pkg-config.

Build SiftGPU

Next, build SiftGPU with CUDA support. Like VisualSFM, this should also “just work” if CUDA is setup properly. When you’re done, copy the shared library into the “vsfm/bin” folder.

$ unzip SiftGPU-V382.zip 
$ cd SiftGPU
$ make
$ cp bin/libsiftgpu.so ../vsfm/bin

Build Multicore Bundle Adjustment (a.k.a. “pba”)

Now things start getting tricky. Unzip (“unzip pba_v1.0.4.zip”), and then you’ll need to edit two source code files. In “pba/src/pba”, edit “SparseBundleCU.h” and “pba.h” by adding this one line to the top of each file:

#include <stdlib.h>

Now you can compile if you simply type “make” in the “~/vsfm/pba” directory.

Hack PMVS-2

You don’t actually have to install Bundler in order to use PMVS-2 with VisualSFM (the installation instructions are a little unclear). There’s a 64-bit Linux binary distrubtion of PMVS-2 available, but it won’t run on Ubuntu 12.04 64-bit without some hacking. If you try running the binary, you’ll get an error similar to this:

./pmvs2: error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory

This is because the package was compiled in an older version of Red Hat, and the binary can’t find two of the required shared libraries (even though they are, in fact, installed). Unfortunately, you also can’t just run “make” to compile your own binary because you’ll get an error with the “mylapack” library. Here’s a work-around that lets you use the compiled mylapack object file but re-compiles the rest of PMVS-2 to produce a working binary.

$ tar xf pmvs-2.tar.gz
$ cd pmvs-2/program/main/
$ cp mylapack.o mylapack.o.backup
$ make clean
$ cp mylapack.o.backup mylapack.o
$ make depend
$ make

Build Graclus 1.2

The Graclus instructions actually work. After you untar graclus1.2.tar.gz, as promised, you do need to edit “Makefile.in” to set “-DNUMBITS=64″ so that the library works with your 64-bit VisualSFM installation. After making that change to the makefile, just type “make”, and it should work.

Hack CMVS

OK, now the hard part. First, unzip CMVS and grab that mylapack.o file from the PMVS-2 binary distribution:

$ cd ~/vsfm
$ tar xf cmvs-fix2.tar.gz
$ cp pmvs-2/program/main/mylapack.o cmvs/program/main/

Next, edit the source file “cmvs/program/base/cmvs/bundle.cc” by adding these includes at the top of the file:

#include <vector>
#include <numeric>

And now edit “cmvs/program/main/genOption.cc” by adding this include statement at the top:

#include <stdlib.h>

OK, almost there! Now edit the CMVS Makefile (in cmvs/program/main) so that lines 10-17 read as follows (but be sure to replace “/home/scott/vsfm/” with the path to your installation):

#Your INCLUDE path (e.g., -I/usr/include)
YOUR_INCLUDE_PATH =

#Your metis directory (contains header files under graclus1.2/metisLib/)
YOUR_INCLUDE_METIS_PATH = -I/home/scott/vsfm/graclus1.2/metisLib

#Your LDLIBRARY path (e.g., -L/usr/lib)
YOUR_LDLIB_PATH = -L/home/scott/vsfm/graclus1.2

OK, now go ahead and build the thing, and then copy the three binaries into the VisualSFM binary directory.

$ cd ~/vsfm/cmvs/program/main
$ make
$ cp cmvs ~/vsfm/vsfm/bin
$ cp pmvs2 ~/vsfm/vsfm/bin
$ cp genOption ~/vsfm/vsfm/bin

8/20/12: corrected filenames above

Running VisualSFM

Finally, add VisualSFM to your path and LD_LIBRARY_PATH. You can do this by adding lines to your ~/.bashrc file. Here’s what I added to the bottom of mine:

export PATH=$PATH:/home/scott/vsfm/vsfm/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/scott/vsfm/vsfm/bin

And you can now run VisualSFM by opening a terminal and typing “VisualSFM&”. Easy, right?

108 thoughts on “Building VisualSFM on Ubuntu 12.04 (Precise Pangolin) Desktop 64-bit

  1. Hi Scott,
    Thanks for the helpful post! However I am getting stuck with the following error(s) at make for vsfm

    GlobalTasks.cpp:(.text+0xf51): undefined reference to `gtk_box_pack_end’
    build/GlobalTasks.o: In function `GlobalTasks::TerminateTaskViewer()’:
    GlobalTasks.cpp:(.text+0x10f3): undefined reference to `gtk_widget_destroy’
    collect2: ld returned 1 exit status
    make: *** [VisualSFM] Error 1

    I think its got to do something with gtk but I dont know exactly what it is.

    Any help greatly appreciated!

    Regards,
    Shyam

  2. Hello Scott,

    This is a very helpful tutorial. Thanks a lot.
    I was able to compile everything seemingly fine but when I start pairwise matching on vsfm, I get an error ERROR: unable to load libsiftgpu.so even though siftgpu compiled fine and the SimpleSIFT binary in SiftGPU/bin runs successfully. Am I missing something?

    Thanks a lot.

  3. Scott,

    I tried the command line interface of VisualSFM and that seems to be working fine. For some reason, the gui version of VisualSFM can’t load libsiftgpu.so. Any help with that?

    Thanks a lot.

  4. Kossi,

    You just need to make sure libsiftgpu.so is on your LD_LIBRARY_PATH. I assume you’re launching the GUI from a terminal (i.e. typing “VisualSFM &”)? If that’s the case, edit set your LD_LIBRARY_PATH in your ~/.bashrc. After changing your .bashrc you need to close/open the terminal or “source ~/.bashrc”. If you can’t get that to work, you could also symlink the library to /usr/lib, which is a little hacky, but it would work.

    $ sudo ln -s /path/to/libsiftgpu.so /usr/lib/libsiftgpu.so

    Hope that helps.

    -Scott

  5. Hi Scott,
    I do have both GTK2 and GTK3 installed so your install command returns
    “libgtk2.0-dev is already the newest version.”

    After looking at VSfM’s makefile, I thought it’s because the gtk path is not added to the pkg-config path because when I ran

    $ pkg-config –modversion gtk+-2.0

    I got-
    “pkg-config –modversion gtk+-2.0
    Package gtk+-2.0 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `gtk+-2.0.pc’
    to the PKG_CONFIG_PATH environment variable
    No package ‘gtk+-2.0′ found”

    So, I edited the PKG_CONFIG_PATH according to
    $ export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/lib/x86_64-linux-gnu/pkgconfig/

    and then when I tried the make, it worked!

    I also had to do
    $ sudo apt-get install freeglut3-dev
    (just in case any beginner like me gets stuck)

    I have now gotten stuck at the PMVS hack because I am unable to find the ‘mylapack.o’ file in pmvs-2/program/main/

    I tried the make but I get:
    “g++ -O2 -Wall -Wno-deprecated -c -o pmvs2.o pmvs2.cc
    In file included from ../base/pmvs/findMatch.h:19:0,
    from pmvs2.cc:3:
    ../base/pmvs/optim.h:6:30: fatal error: gsl/gsl_multimin.h: No such file or directory
    compilation terminated.
    make: *** [pmvs2.o] Error 1

    Any suggestions?

    Regards,
    Shyam

  6. Scott,

    It worked great. Thanks for your help. I hope you will keep this page active for the long term. It is a great resource.

    Thanks again.

  7. Scott,
    I was finally able to get VisualSfM to work!

    I had the same issue as Kossi when it came to doing the matching. Why is it that when the program is launched from the terminal, it works (after editing ~/.bashrc) and not when I double-click the file through gnome?

    Here are a few edits that you can make to your post to make it comprehensive:

    1) Installation of dependency packages-
    For those missing freeglut and gsl

    $ sudo apt-get install freeglut3-dev libgsl0-dev

    2) Slight naming mistake in the last part of ‘Hack CMVS’ section while copying binaries; it should have been

    $ cd ~/vsfm/cmvs/program/main
    $ make
    $ cp cmvs ~/vsfm/vsfm/bin
    $ cp pmvs2 ~/vsfm/vsfm/bin
    $ cp genOption ~/vsfm/vsfm/bin

    Thanks again for the tutorial!

    -Shyam

  8. Hi Scott,

    First off, thanks for posting this guide. This is easy to follow and will be a great resource for Ubuntu users. I finished the installation but am experiencing a problem similar to what Kossi described. When I try to do the pairwise matching form the GUI I get “ERROR: unable to load libsiftgpu.so” displayed in the GUI and “/home/nedhorning/vsfm/bin/sift: not found” in the terminal window. I added the following lines in my .bashrc:
    export PATH=$PATH:/home/nedhorning/vsfm/bin
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/nedhorning/vsfm/bin

    and I also have the symbolic link set using:
    ln -s /home/nedhorning/vsfm/bin/libsiftgpu.so /usr/lib/libsiftgpu.so

    I used “cp bin/libsiftgpu.so ../bin” to copy libsiftgpu.so to /home/nedhorning/vsfm/bin

    Any idea what I’m doing wrong?

    All the best,

    Ned

  9. Hi Ned,
    Just asking but did you try running vsfm from the terminal?

    $ VisualSFM&

    I also had problems similar to Kossi’s but the export statements in .bashrc followed by source worked for me ie. I didn’t have to use the symlink.

    -Shyam

  10. Ned, no obvious solution comes to mind. Could you print some information that might be helpful for debugging?

    $ which VisualSFM
    $ echo $PATH
    $ echo $LD_LIBRARY_PATH
    $ locate libsiftgpu.so

  11. Scott – Here is the output:

    nedhorning@ubuntu-desktop:~$ which VisualSFM
    /home/nedhorning/vsfm/bin/VisualSFM

    nedhorning@ubuntu-desktop:~$ echo $PATH
    /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/nedhorning/vsfm/bin

    nedhorning@ubuntu-desktop:~$ echo $LD_LIBRARY_PATH
    :/home/nedhorning/vsfm/bin

    nedhorning@ubuntu-desktop:~$ locate libsiftgpu.so
    /home/nedhorning/vsfm/SiftGPU/bin/libsiftgpu.so
    /home/nedhorning/vsfm/bin/libsiftgpu.so
    /usr/lib/libsiftgpu.so

  12. Thank for the tip Changchang. I copied libcudart.so.4 to ~/vsfm/bin [cp /usr/local/cuda/lib64/libcudart.so.4 libcudart.so.4] and that fixed the “unable to load libsiftgpu.so” error. I also had to copy libpba.so from ~/vsfm/pba/bin to ~/vsfm/bin for the dense reconstruction to work.

    To fix the “/home/nedhorning/vsfm/bin/sift: not found” error I reinstalled the CUDA driver and Toolkit.

    Thanks to everyone for your help. It’s nice to be running this under Ubuntu.

    Ned

  13. Hi Scott,
    Thank you very much for the helpful post! However I am getting stuck with the following error(s) at make for vsfm.

    /usr/bin/ld: error: cannot find -lmultilevel
    /usr/bin/ld: error: cannot find -lmultilevel
    graclus.o:graclus.cc:function CMVS::Cgraclus::runSub(graphdef&, int, int, int, std::vector<long long, std::allocator >&): error: undefined reference to ‘MLKKM_PartGraphKway(int*, long long*, long long*, long long*, long long*, int*, int*, int*, int*, int*, int*, long long*, int)’
    graclus.o:graclus.cc:function CMVS::Cgraclus::runSub(graphdef&, int, int, int, std::vector<long long, std::allocator >&): error: undefined reference to ‘__ComputePartitionBalance(graphdef*, int, long long*, float*)’
    graclus.o:graclus.cc:function CMVS::Cgraclus::runSub(graphdef&, int, int, int, std::vector<long long, std::allocator >&): error: undefined reference to ‘ComputeRAsso(graphdef*, long long*, int)’
    graclus.o:graclus.cc:function CMVS::Cgraclus::runSub(graphdef&, int, int, int, std::vector<long long, std::allocator >&): error: undefined reference to ‘ComputeNCut(graphdef*, long long*, int)’
    collect2: ld returned 1 exit status
    make: *** [cmvs] Error 1

    Am I missing something?
    Any help greatly appreciated!

    Best regards,
    Belle

  14. Hi Belle,

    I didn’t encounter that problem, but someone mentions something similar on Nghia Ho’s site:
    http://nghiaho.com/?page_id=253

    Based on the comments on that site, there might be a problem with Ubuntu’s 32-bit libraries. Which version of Ubuntu are you using? 64- or 32-bit?

    -Scott

  15. to compile SiftGPU v400 you may need to add next lines to /src/ProgramCU.cu:
    #ifndef min
    #define min(a,b) (((a) (b)) ? (a) : (b))
    #endif

  16. To solve

    undefined reference to ‘MLKKM_PartGraphKway(int*, long long*, long long*, long long*, long long*, int*, int*, int*, int*, int*, int*, long long*, int)’

    I had to set

    COPTIONS = -DNUMBITS=64

    in the graclus Makefile.in

  17. Hi,

    I has having problems with the error message “I get an error ERROR: unable to load libsiftgpu.so” which is kind of deceiving because after running “ldd libsiftgpu.so” I was able to notice that “libcudart.so.5.0 => not found” was the real issue.
    To fix this issue you will need to run “ldconfig /usr/local/cuda-5.0/lib64″ … in my case 64 because I am running under 64 bits… Hope this saves you hours of frustration and confusion.

    Probably a permanent fix would be to add it to your LD_LIBRARY_PATH inside .bashrc

    Thanks for the wonderful tutorial.

  18. Regarding __ComputePartitionBalance(graphdef*, int, long long*, float*)

    I hit that problem. It turns out I somehow set -DNUMBITS=32 rather than 64 in graclus. I could swear I had set it to 64, so of course it was a pain to track down.

    But if they don’t match between graclus and cmvs, the signatures won’t match, and you’ll get these errors.

  19. Hi Scott,

    Thanks for such a helpful post.

    I was able to build VisualSFM without CUDA support successfully. I followed all the steps mentioned above except I used sift binary instead of siftGPU. But When I run VisualSFM by opening a terminal and typing “VisualSFM&”, the GUI window appears with the following errors in the terminal:

    ERROR: glXChooseVisual returns NULL
    Xlib: extension “RANDR” missing on display “:14.0″.
    setenv LIBGL_ALWAYS_INDIRECT=yes
    ERROR: glXChooseVisual returns NULL

    (VisualSFM:7837): Gdk-CRITICAL **: gdk_window_move_resize_internal: assertion `GDK_IS_WINDOW (window)’ failed

    (VisualSFM:7837): Gdk-CRITICAL **: gdk_window_move_resize_internal: assertion `GDK_IS_WINDOW (window)’ failed

    (VisualSFM:7837): Gdk-CRITICAL **: gdk_window_show_internal: assertion `GDK_IS_WINDOW (window)’ failed

    (VisualSFM:7837): Gdk-CRITICAL **: gdk_window_move_resize_internal: assertion `GDK_IS_WINDOW (window)’ failed

    Also, when I add the images in the VisualSFM and click open, VisualSFM GUI disappears.

    Did I miss anything during installation?
    Any help will be appreciated.

    Regards
    Mukesh

  20. I’ve come across a problem is the installation of the Multicore Bundle Adjustment. First, the link takes me to version 1.0.5 not 1.0.4. Is this going to be a problem? Next, should the line added be #include or #include “stdlib.h” or will it work either way? Next, where (as in what directory) should this be unzipped or compiled. “~/vsfm/pba”? Am I to unzip and compile this package inside the vsfm directory I created earlier? This would all be more clear if you had included the command lines exactly as they are to be executed. I hope to hear back form you soon. Thanks.

  21. Phillip,

    I installed using pba 1.0.4. The link must now point to a newer version. Hopefully it will work, but I haven’t tested it. I placed pba_v1.0.4.zip in my ~/vsfm folder. It then unzipped to ~/vsfm/pba/.

    I had to add the line “#include <stdlib.h>” to files I mentioned to get it to compile. It’s possible that’s been fixed in the newer version — you might want to try compiling before making changes first.

    -Scott

  22. this is a great tutorial, i used vsfm on windows but trying to get my head round in in linux is tricky, documentation has been thin. but i end up with the same problem as Mukesh

    the gui appears and then i get these errors in the command line:
    ERROR: glXChooseVisual returns NULL
    Xlib: extension “RANDR” missing on display “:1.0″.
    setenv LIBGL_ALWAYS_INDIRECT=yes
    ERROR: glXChooseVisual returns NULL

    (VisualSFM:3745): Gdk-CRITICAL **: gdk_window_move_resize_internal: assertion `GDK_IS_WINDOW (window)’ failed

    (VisualSFM:3745): Gdk-CRITICAL **: gdk_window_move_resize_internal: assertion `GDK_IS_WINDOW (window)’ failed

    (VisualSFM:3745): Gdk-CRITICAL **: gdk_window_show_internal: assertion `GDK_IS_WINDOW (window)’ failed

    and when i try to load images the gui vanishes
    my system:
    $ uname -a
    Linux #hostname# 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux

    i followed the tutorial using a clean install of debian wheezy with xfce instead of gnome

    i skipped the cuda bit as the card in the machine is a Radeon 9600

    $lspci
    01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI RV350 AP [Radeon 9600]

    i also had to install clapack (http://www.netlib.org/clapack/) to get pmvs to compile, which wasn’t mentioned and wasn’t in the debian repos

    any ideas where I’m going wrong?
    Mukesh did you figure it out?
    I’m on the verge of starting again from a clean install

    cheers
    pedro

  23. I was getting some errors when installing SiftGPU

    /usr/bin/ld: cannot find -lGLEW
    /usr/bin/ld: cannot find -lIL

    And need to run
    apt-get install libglew-dev libdevil-dev

    Now having trouble on the CMVS hack, getting a:
    Makefile:10: *** missing separator. Stop.
    error after modifying the Makefile

    Linux Mint 14

  24. In order to run the 3D Reconstruction in VisualSFM, I had to copy libpba.so into vsfm’s bin directory. Adding the pba/bin to my PATH didn’t work:

    cp /home/scott/vsfm/pba/bin/libpba.so /home/scott/vsfm/vsfm/bin/

  25. Dear Dr. Sawyer,

    I am new to VisualSFM and I got stuck when doing the PSVS step. As Shyam C. Nambiar mentioned, there was no ‘mylapack.o’ file in pmvs-2/program/main/ in the original folder. I noticed that you gave another link http://grail.cs.washington.edu/software/pmvs/pmvs-2.tar.gz but it is now failed. Could you please give another link? Or could you please just email it to me? Thank you very much.
    I am using Ubuntu 10.04(32 bit). Hope that there would be little differences between these steps.

  26. Hi Swayer,
    First, i must thanks for your detailed instructions to build vsfm on Ubuntu 12.04.

    I’ve performed a couple of installations on 32 bit systems, however now i’m trying in a 64 bit machine and i’m experiencing similar problems as Belle, while compiling CMVS:

    /usr/bin/ld: error: cannot find -lmultilevel

    As i suspected there was some problem in the library path, i copied the libmultilevel.a file from graclus directory into /usr/lib. It “solves” the problem but prompts another one while linking:

    graclus.o:graclus.cc:function CMVS::Cgraclus::runSub(graphdef&, int, int, int, std::vector&): error: undefined reference to ‘MLKKM_PartGraphKway(int*, long long*, long long*, long long*, long long*, int*, int*, int*, int*, int*, int*, long long*, int)’

    I’ve checked the solution proposed in Nghia Ho’s site, switching DNUMBITS between 32 and 64 for graclus and cmvs, without any success.

    Thanks in advance for your time,
    J.C.

  27. Not sure if anyone else had this issue, but I also had to add CFLAGS=”-mno-avx” to get pba to build (and likewise had to copy libpba.so over to vsfm/bin).

    Thanks for the helpful guide.

    Cheers,

    Ziang

  28. Hi
    This is a great Tutorial. I have bulit VisualSFM on my 32-bit Ubuntu 12.04, in this detailed tutorial guidance. However, I was getting error when running VisualSFM.

    Runing Yasutaka Furukawa’s CMVS/PMVS tool…
    cmvs /home/liuwei/result/test.nvm.cmvs/00/ 50 4
    genOption /home/liuwei/result/test.nvm.cmvs/00/ 1 2 0.700000 7 3 4
    1 cluster is generated for pmvs reconstruction.
    pmvs2 /home/liuwei/result/test.nvm.cmvs/00/ option-0000
    This may take a little more time, wating…
    Yasutaka Furukawa’s CMVS cannot be located!
    Please go download or compile them and
    place them where VisualSFM is or in your PATH
    —————————————————————-
    Run dense reconstruction, finished
    Totally 26.483 minutes used

    Can you guys give me some advice please? Thanks in advance for any help.谢谢!

  29. Thanks for the great tutorial.
    I was getting error :
    /usr/bin/ld: error: cannot find -llapack

    Fixed by installing another dependency:
    sudo apt-get install liblapack-dev

  30. I’m running Arch Linux, Gnome 3, and an ATI FirePro V7900.

    So I’ve finally completed the step by step in this tutorial, impressively complete. Not sure how you figured this out, but well done.

    I attempted to repeat this youtube tutorial:
    http://www.youtube.com/watch?v=SHa_LBIzDac

    I’m still having a few issues:

    In the output window it says:

    Compute Missing Pairwise Matching, begin…
    Match image sequence within range 3 (0)
    —————————————-
    Compute Missing Pairwise Matching, finished
    Totally 0.000 seconds used

    Also I run missing pairwise matching:

    Compute Missing Pairwise Matching, begin…
    0 pairs to compute match
    ————————-
    Compute Missing Pairwise Matching, finished
    Totally 0.000 seconds used

    I compute a 3D reconstruction, and it only uses two photos.

    I also get the following error:
    Run full 3D reconstruction, begin…
    95(74) pairs have essential matrices
    102(0) pairs have fundamental matrices
    Initialization: Th = 0.400, Ti = 30.
    Initialize with DSC_0504 and DSC_0503
    199 3D points initialized from two images

    libpba.so: cannot open shared object file: No such file or directory

    ERROR: unable to Load libpba.so (Multicore Bundle

    When I compiled pba, I ran the make -f makefile_no_gpu

    I then copied and renamed the libpba_no_pgu.so into the vsfm/bin as libpba.so

    I have run sudo ln -s (directory)/vsfm/bin/libpba.so /usr/lib64/libpba.so

    Any thoughts?

  31. I was able to compile CMVS, and when I run it, it says:

    Run dense reconstruction, begin…

    #############################
    Undistorting 2 images in model #0
    param_undistortion_thread_num = 0
    NOTE: using 8 threads…
    #00: DSC_0504 -> 00000000.jpg, 0.989 sec
    #00: DSC_0503 -> 00000001.jpg, 0.959 sec
    —————————————————————-
    Running Yasutaka Furukawa’s CMVS/PMVS tool…
    cmvs /home/barrett/Pictures/test/workspace/test.nvm.cmvs/00/ 50 8
    genOption /home/barrett/Pictures/test/workspace/test.nvm.cmvs/00/ 1 2 0.700000 7 2 8
    1 cluster is generated for pmvs reconstruction.
    pmvs2 /home/barrett/Pictures/test/workspace/test.nvm.cmvs/00/ option-0000
    This may take a little more time, waiting…
    Yasutaka Furukawa’s CMVS cannot be located!
    Please go download or compile them and
    place them where VisualSFM is or in your PATH
    —————————————-
    Run dense reconstruction, finished
    Totally 10.000 seconds used

  32. Hey this tutorial is really handy and my install went cleanly with no problems. I am using Ubuntu 12.04 with an Intel graphics card (no CUDA support).

    My only problem now is that VSFM keeps freezing up on me. even if I only use 2 image files, In can load them in but if I try doing more than that it freezes. Could be a RAM problem but I close everything else and have a little over 3.5 GiB free. If anyone else is hitting this problem, please post.

    One small suggestion too: for people like me, whose cards don’t have CUDA support, maybe specify that for the “Build Multicore Bundle” section, they use

    $ make -f makefile_no_gpu

    instead of plain old $ make.

  33. Hi there!

    Thanks for all this info.

    I am however hung up on the step where I make pba. I get the following error:

    mkdir -p ./bin/out
    mkdir -p ./bin
    g++ -o bin/out/CuTexImage.o src/pba/CuTexImage.cpp -I/usr/local/cuda/include -L/usr/local/cuda/lib64 -fPIC -L/usr/lib64 -L/usr/lib -L./bin -O2 -Wall -Wno-deprecated -pthread -march=native -mfpmath=sse -fpermissive -c
    src/pba/CuTexImage.cpp:29:18: fatal error: cuda.h: No such file or directory
    compilation terminated.
    make: *** [bin/out/CuTexImage.o] Error 1

    Does anyone have any thoughts on what’s going on?

    Cheers :-)

  34. I’m trying the hack for pmvs, and I get this error when compiling:

    /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/liblapack.so: undefined reference to `ATL_zrotg’
    /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/liblapack.so: undefined reference to `ATL_strsv’
    collect2: ld returned 1 exit status
    make: *** [pmvs2] Error 1

    I have liblapack installed. Any suggestions? Thank you so much!

  35. Thankyou for your Document, It help me alot.Now I;m facing error in the instalation (make) step of pmvs-2.
    Following lise are error.

    /usr/bin/ld: cannot find -llapack
    collect2: ld returned 1 exit status
    make: *** [pmvs2] Error 1

    Please help me.

  36. perfect tutorial!! easy to follow but at the end of the tutorial watch the path

    /home/user/vsfm/vsfm/bin are false
    is
    /home/user/vsfm/bin

    but big thank’s for you bro !

  37. I had to also do a make clean; make depends; for CMVS to make it work, just like described to make it work for PMVS.
    I am on Arch Linux.

  38. Hi Scott,

    This suggestion seems to not work for me. The VSFM program keeps warning “unable to load libsiftgpu.so”. I follow most cmake steps and get most parts working except PMVS having some libraries not successfully installed.

    For your suggestions, I do not fully understand how LD_LIBRARY_PATH is set.

    I searched a lot online, and seems people have similar issue. But the suggestions online are so ambiguous that could you give some ellaboration?

    Best,
    Xiang Xiang

    Scott Sawyer
    on August 17, 2012 at 2:07 pm said:
    Kossi,
    You just need to make sure libsiftgpu.so is on your LD_LIBRARY_PATH. I assume you’re launching the GUI from a terminal (i.e. typing “VisualSFM &”)? If that’s the case, edit set your LD_LIBRARY_PATH in your ~/.bashrc. After changing your .bashrc you need to close/open the terminal or “source ~/.bashrc”. If you can’t get that to work, you could also symlink the library to /usr/lib, which is a little hacky, but it would work.
    $ sudo ln -s /path/to/libsiftgpu.so /usr/lib/libsiftgpu.so
    Hope that helps.
    -Scott

  39. @Barret @Wei Liu

    If you run VisualSFM from the terminal, keep that terminal open and look at the error that appears there. This will explain why cmvs is not working for you.

    For example, the terminal may say something like:
    “pmvs2: error while loading shared libraries: libblas.so.3: wrong ELF class: ELFCLASS32″

    As far as I understand, it’s because my 64-bit system is trying to use a 32-bit library.

    In this case, you would have to do this:

    $ sudo apt-get purge libc6:i386
    $ sudo apt-get install libc6-dev

    This is what worked for me.

  40. For anyone using Ctrl+F to search for this problem, I include the error message:

    This may take a little more time, waiting…
    Yasutaka Furukawa’s CMVS cannot be located!
    Please go download or compile them and
    place them where VisualSFM is or in your PATH

    Now see the comment above. It might work for you. It worked for me.

  41. I was able to compile and run everything on Ubuntu 12.04 64 bit.

    I copied everything to a Ubuntu 14.04 64 bit machine. sift was missing.

    The package “autopano-sift” fixes this or the sift executable from http://www.cs.ubc.ca/~lowe/keypoints/ (put the “sift” binary in your $PATH).

    I tried to compile on Ubuntu 14.04 64 bit but failed to compile CMVS with:

    g++ -c -O2 -Wall -Wno-deprecated ../base/numeric/mylapack.cc
    ../base/numeric/mylapack.cc:6:25: fatal error: clapack/f2c.h: No such file or directory
    #include

    Any Idea?

  42. I get the following error when trying to make PMVS-2

    /usr/bin/ld: cannot find -llapack

    So I fixed it by installing it like this:

    sudo apt-get install liblapack-dev

    Maybe this will help someone else with the same difficulty.

  43. Hi Scott,

    Thanks for this great job.
    The file libsiftgpu.so isn’t in the directory, but I found libsiftgpu.a

    Could you tell me what is wrong?

    Thanks a lot,
    Marcos

  44. The section “Download Necessary Software” is a little bit outdated. It says:

    “Graclus 1.2: Home Page contains a form that asks for an email address prior to download”

    I have downloaded Graclus a few minutes ago and didn’t get any form asking for an email address.

  45. I meet error when I make pba like this

    src/pba/CuTexImage.cpp:29:18: fatal error: cuda.h: No such file or directory
    #include
    ^
    compilation terminated.
    make: *** [bin/out/CuTexImage.o] Error 1

  46. For the installation of pba I’m getting those error messages :

    /tmp/ccikKFDV.s: Assembler messages:
    /tmp/ccikKFDV.s:1157: Error: no such instruction: `vfmsub312ss 4(%rcx),%xmm12,%xmm10′
    /tmp/ccikKFDV.s:1159: Error: no such instruction: `vfmsub312ss (%rcx),%xmm12,%xmm11′
    /tmp/ccikKFDV.s:1329: Error: no such instruction: `vfmsub312ss 4(%rcx),%xmm15,%xmm10′
    /tmp/ccikKFDV.s:1331: Error: no such instruction: `vfmsub312ss (%rcx),%xmm15,%xmm11′
    make: *** [bin/out/SparseBundleCU.o] Error 1

  47. Great step-by-step guide, Scott… There was not even a chance that I could install VSMF without it.
    By carefully following it I succeeded in installing it on Ubuntu 14.04 without big problems.
    Just a couple of comments/tips that might help someone else.
    * When compiling PMVS-2 I got this error:
    make: *** [pmvs2] Error 1.
    It was caused by the make command not finding llapack. I followed Phillip Toones advice and installed it with:

    sudo apt-get install liblapack-dev

    I then tried again with make and this time everything went ok.

    * After installing VSMF I run it. It loaded the images without problem, but I got an error message when computing missing matches, telling me to check if I had libpa.so in the VSMF folder. I simply copied it from PBA/bin into vsmf/bin and now it’s running OK.

    Thanks a lot!!!
    Asier

  48. Hi all, I got the same errors as Mariem El Afrit posted, when I was installing the pba-v1.0.5. I am using Ubuntu 12.04 64bit Precise Pangolin LTS, Nvidia uadro K2100M Graphics. Does anyone meet and solve this problem?

    /tmp/ccJQLVuS.s:1157: Error: no such instruction: `vfmsub312ss 4(%rcx),%xmm12,%xmm10′
    /tmp/ccJQLVuS.s:1159: Error: no such instruction: `vfmsub312ss (%rcx),%xmm12,%xmm11′
    /tmp/ccJQLVuS.s:1329: Error: no such instruction: `vfmsub312ss 4(%rcx),%xmm15,%xmm10′
    /tmp/ccJQLVuS.s:1331: Error: no such instruction: `vfmsub312ss (%rcx),%xmm15,%xmm11′

    Thanks!
    Cansen

  49. Hi, in case some people get the same errors as Mariem El Afrit, you could modify the makefile: open makefile, change native to core2. You could find the solution from Changchang Wu’s reply on Google group.

  50. Hi,
    very interesting guide and easy to follow!
    I’ve tried the installation on Ubuntu 14.04 64bit, and I’ve only changed the libglew dependences to go on. At the end of the process, building cmvs I’ve got this error:

    /usr/bin/ld: error: cannot find -lmultilevel

    It is linked to graclus, I suppose, and I can’t finish the installation.

    Anyone could help me?
    Thank you in advance

  51. I’m hoping some of you could share the outcome of your results with me. I ran the “Poker Flats Research Range” from this website (just the raw photos): http://dronemapper.com/sample_data

    I’ve successfully compiled everything with CUDA and have tested it. However, this photo set exhibits strange behavior. When PMVS is finally finished, I have folders “00″ thru “31″ in my output directory. What’s strange is that each one of the “options-00000.ply” files seem to have a different coordinate system. I had planned on opening them in Meshlab and merging them together. I find this to be very strange and haven’t had this problem in the past. I ran another large photo set (not nearly this large) and it worked fine. I can say I ran the problematic set through Agisoft Photoscan and gave up after 3 days of waiting. It claims to be using GPU (yes I’ve enabled it and selected in the preferences), but wow it’s slow with this set. Maybe this set is bad? Can someone verify??

  52. @Francesco: I don’t know that you’ll have the same problem I did, but it was a goofy type…

    #Your metis directory (contains header files under graclus1.2/metisLib/)
    YOUR_INCLUDE_METIS_PATH = -I/home/scott/vsfm/graclus1.2/metisLib

    #Your LDLIBRARY path (e.g., -L/usr/lib)
    YOUR_LDLIB_PATH = -L/home/scott/vsfm/graclus1.2

    From his instructions… When I first installed I accidentally used -I for the LDLIB_PATH… make sure you use -I for your Metis path and -L for your LDLIB path. And of course change -DNUMBITS to 64… hope this helps

  53. I’m stuck on the pba stage. Error occurred as follow, any idea about it?
    Ubuntu 14.04LTS/64bit

    /usr/local/cuda/bin/nvcc -I/usr/local/cuda/include -O2 -Xcompiler -fPIC -o bin/out/ProgramCU.o src/pba/ProgramCU.cu -c
    make: /usr/local/cuda/bin/nvcc: Command not found
    make: *** [bin/out/ProgramCU.o] Error 127

  54. @OP ; Thanks for this, works pretty much as stated with minor tweaks on Linux Mint 17 with 3.13.0-37 64bit kernel.

    @muzo583 : Your path to Nvidia Cuda Compiler (nvcc) is not being detected by pba. Edit the makefile in ~/vsfm/pba/ to point at your cuda install, something like this;

    CUDA_INSTALL_PATH = /usr/
    CUDA_LIB_PATH = $(CUDA_INSTALL_PATH)/lib64
    ifdef CUDA_BIN_PATH
    NVCC = /usr/bin/nvcc
    else
    NVCC = /usr/bin/nvcc
    endif
    ifndef CUDA_INC_PATH
    CUDA_INC_PATH = $(CUDA_INSTALL_PATH)/include

  55. Scott,

    Your instructions work beautifully on Ubuntu 14.04 with a minor addition to get pmvs-2 to build. On my system that required adding a symlink to liblapack.so via:
    >cd /usr/lib
    >sudo ln -s ./liblapack.so.3 liblapack.so

    Thanks for making this so easy!

  56. If you’re getting:
    *Wrong JPEG library version: library is 80, caller expects 62

    install:
    sudo apt-get install libjpeg62-dev

    then recompile CMVS:
    cd cmvs/program/main
    make clean
    cp ../../pmvs-2/program/main/mylapack.o .
    make
    cp pmvs-2/program/main/mylapack.o cmvs/program/main/

  57. Hi Scott and VisualSFM users,

    an error was occurred while CMVS was building.

    When make, the error was occurred as below.

    root@SURVEY-C2:/opt/vsfm/cmvs/program/main# make
    Makefile:10: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.

    Though googling, I can not solve it.
    For example, “Insert spaces instead of tabs” on preferences of gedit were confirmed.

    Have you ever had the same error?

    Let me know how to solve it.

    Sincerely yours,
    Yoshiyuki

  58. I’m having a bit of a problem with the dense reconstruction. When I try to run it I get “libpba.so: cannot open shared object file: No such file or directory”. But I have the libpba.so file in the bin folder of vsfm… I don’t understand why it can’t find it… Any help would be greatly appreciated.

  59. Continuation: Here is the relevant log output

    Compute Missing Pairwise Matching, begin…
    0 pairs to compute match
    —————————————————————-
    Compute Missing Pairwise Matching, finished
    Totally 0.000 seconds used

    Run full 3D reconstruction, begin…
    88 pairs have two-view models
    178 pairs have fundamental matrices
    Initialize with IMG_7475 and IMG_7460
    321 3D points initialized from two images
    libpba.so: cannot open shared object file: No such file or directory
    ERROR: unable to Load libpba.so (Multicore Bundle
    Adjustment). Make sure you have libpba.so in the VisualSFM
    bin folder; Run to check its dependencies.
    —————————————————————-
    Run full 3D reconstruction, finished
    Totally 0.000 seconds used

  60. I installed VisualSFM step-by-step as described, also with some adjustments found in the comments. However when I try to compute missing matches I get
    “ERROR: unable to execute sift binary.”
    in the log window, and
    “//VisualSFM/vsfm/bin/sift: Permission denied”
    The sift folder contains all sift binaries, I gave also chmod 777 to the folder and all the contained files, but the problem persists.

    Does anybody have a solution for this problem?

  61. make error cmvs

    when editing cmvs make sure you dont forget to comment out the top lines so mine looks like this seems like a silly error but for someone that is getting the error
    ps4@ps4 ~/vsfm/cmvs/program/main $ make
    Makefile:10: *** missing separator. Stop.
    here is mine just change the ps4 part to your pc name :)

    #Your INCLUDE path (e.g., -I/usr/include)
    YOUR_INCLUDE_PATH = -I/home/ps4/vsfm

    #Your metis directory (contains header files under graclus1.2/metisLib/)
    YOUR_INCLUDE_METIS_PATH = -I/home/ps4/vsfm/graclus1.2/metisLib

    #Your LDLIBRARY path (e.g., -L/usr/lib)
    YOUR_LDLIB_PATH = -L/home/ps4/vsfm/graclus1.2

  62. I can’t install siftgpu using this makefile. It throws an error : “/usr/bin/ld: cannot find -lIL
    collect2: error: ld returned 1 exit status”. How can I solve this error?

  63. Scott,

    I have a problem when I make the CMVS,the error as follows:

    Makefile:10: *** missing separator. Stop.

    I tried some means to solove it,but failed.Hope your reply.

    Thanks!

  64. I change DNUMBITS value and set paths in cmvs makefile. Then I run mae command under cmvs/program/main. It throws below error :

    g++ -c -O2 -Wall -Wno-deprecated -DNUMBITS=64 -I/home/myuser/vsfm/graclus1.2/metisLib -fopenmp -DNUMBITS=64 ../base/cmvs/bundle.cc

    In file included from ../base/cmvs/bundle.cc:10:0:
    ../base/cmvs/graclus.h:5:19: fatal error: metis.h: No such file or directory
    #include
    ^
    compilation terminated.

    How can I solve it?

  65. Hi,

    Greetings!!!!

    I am trying to build Visual SFM. When I am compiling cmvs I got stuck in the below issue:

    graclus.o: In function `CMVS::Cgraclus::run(std::vector<long long, std::allocator >&, std::vector<long long, std::allocator >&, int, int, std::vector<long long, std::allocator >&)’:
    graclus.cc:(.text+0x2a6): undefined reference to `MLKKM_PartGraphKway(int*, long long*, long long*, long long*, long long*, int*, int*, int*, int*, int*, int*, long long*, int)’
    graclus.cc:(.text+0x2c6): undefined reference to `__ComputePartitionBalance(graphdef*, int, long long*, float*)’
    graclus.cc:(.text+0x2df): undefined reference to `ComputeNCut(graphdef*, long long*, int)’
    graclus.cc:(.text+0×318): undefined reference to `ComputeRAsso(graphdef*, long long*, int)’
    graclus.o: In function `CMVS::Cgraclus::runV(std::vector<long long, std::allocator >&, std::vector<long long, std::allocator >&, std::vector<long long, std::allocator >&, int, int, std::vector<long long, std::allocator >&)’:

    I have even checked that graclus is build by using -DNUMBITS=64 option.

    Kindly suggest something!!!!

  66. Well that was fun to get through with a few gotchas. I started using older versions which were outdated. I finally found the latest version here but the last one (CMVS) couldn’t find lapack so I appended the line in the Makefile with: -L/usr/lib/lapack/
    which is extra to the recommended fix.
    ————–snip———-
    ## Your metis directory (contains header files under graclus1.2/metisLib/)
    YOUR_INCLUDE_METIS_PATH = -I/home/eric/vsfm/graclus1.2/metisLib

    ## Your LDLIBRARY path (e.g., -L/usr/lib)
    YOUR_LDLIB_PATH = -L/home/eric/vsfm/graclus1.2 -L/usr/lib/lapack/
    ————–snip———-
    I am running Mint 17.1 64bit but without Cuda first.

    It wasn’t explained that a folder vsfm needed to be created and all the program are extracted into it. I did figure it out and not sure if this affects the final outcome. Once I did the little fix everything worked in cmvs.
    make depend
    make
    I then copied everything into the common directory and voila it ran but complained about enabling Cuda so I will have to do that too.
    cheers

  67. Hi.

    So, I am stuck at the pvms step:

    /vsfm/pmvs-2/program/main$ make
    g++ -O2 -Wall -Wno-deprecated -I/usr/include -c -o pmvs2.o pmvs2.cc
    In file included from ../base/pmvs/findMatch.h:10:0,
    from pmvs2.cc:3:
    ../base/pmvs/patch.h:6:32: fatal error: boost/shared_ptr.hpp: Datei oder Verzeichnis nicht gefunden
    #include
    ^
    compilation terminated.
    make: *** [pmvs2.o] Fehler 1

    Please Help!

  68. If you got the error:
    /usr/bin/ld: cannot find -lGL
    collect2: error: ld returned 1 exit status

    The solution is:
    $ locate libGL.so
    /usr/lib/x86_64-linux-gnu/libGL.so
    /usr/lib/x86_64-linux-gnu/libGL.so.1
    /usr/lib/x86_64-linux-gnu/libGL.so.xxx.xx

    $ sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.xxx.xx /usr/lib/libGL.so

  69. Hi, I’m trying to compute 3D reconstruction with VisualSFM, but every time I run it, I get the the following output:

    Failed to initialize with the chosen pair
    Initialize with DSC_0436 and DSC_0440
    670 3D points initialized from two images
    libcudart.so.7.5: error cannot open shared object file: No such file or directory

    I’ve change my environment variables with:

    $ export PATH=/usr/local/cuda-7.0/bin:$PATH
    $ export LD_LIBRARY_PATH=/usr/local/cuda-7.0/lib64:$LD_LIBRARY_PATH

    but nothing changes. Can some one help me a little?

    Thanks, in advance
    José Soto

  70. Any have an issue getting the mylapack.o error while compiling CMVS:

    ../base/numeric/mylapack.cc:6:25: fatal error: clapack/f2c.h: No such file or directory
    #include
    ^
    compilation terminated.
    make: *** [mylapack.o] Error 1

    Thanks for the help.

  71. Thank you very much!
    It works well with this tutorial on Ubuntu14.04(x64, GT force 970) as well.
    I just copy the libpba.so from /vsfm/pba/bin/ to vsfm/vsfm/bin.

    But I recommend there maybe someone(maybe me another day) could wrote a shell to automatically run this installation procedure.

    And I want to know if anyone tried to do this reconstruction from video to 3D module automatically. Maybe there are several problems needs to be solved:
    - Using ffmpeg or other library to change the mp4 to jpeg
    - Robust and good algorithm for Possion Reconstruction
    - ?

  72. When building cmvs on ubuntu xenial 16.04, I get the following errors:

    cmvs.cc:(.text.startup+0xb4): undefined reference to `CMVS::Cbundle::run(std::string, int, int, float, float, int, int)’
    collect2: error: ld returned 1 exit status
    Makefile:49: recipe for target ‘cmvs’ failed
    make: *** [cmvs] Error 1

    Thanks for your help.
    Randy

  73. Hi Valentin,

    I was suffering the exact same error as you.
    I solved it by installing libboost-dev and libboost1.58-dev.
    I am on Ubuntu 16.04.
    Hope this helps.

    Arthur

  74. Could you please provide a pre-built package with and without cuda?
    This building process is like a punishment for linux users – why do windows users get a build which is ready to run while linux users have to go through this only to try the software…
    Thanks

  75. Thank you very much, it really works!
    I followed your instructions here on Debian Stable (Jessie), and everything works just fine!

    If anyone get the same error of sunny, and recieve this message:
    Makefile:10: *** missing separator. Stop.

    Just remember to comment these lines in in cmvs/program/main/Makefile (notice the # in the beginning)

    #Your INCLUDE path (e.g., -I/usr/include)
    #Your metis directory (contains header files under graclus1.2/metisLib/)
    #Your metis directory (contains header files under graclus1.2/metisLib/)

  76. Thanks for the great tutorial.
    I needed to knock out a few of these for ubuntu 16.04 LTS so i have jsut got the commands to copy and paste in or to be run as script.
    this does all the file edits for you so you dont need to worry about changing any files

    #based upon http://www.10flow.com/2012/08/15/building-visualsfm-on-ubuntu-12-04-precise-pangolin-desktop-64-bit/
    sudo apt-get update
    sudo mkdir /install
    sudo chmod 777 /install
    cd /install

    #install the Nvidia CUDA drivers
    wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    sudo apt-get update
    sudo apt-get -y install cuda
    sudo reboot

    #download all the stuff we need
    wget http://ccwu.me/vsfm/download/VisualSFM_linux_64bit.zip
    git clone https://github.com/pitzer/SiftGPU.git
    wget http://grail.cs.washington.edu/projects/mcba/pba_v1.0.5.zip
    wget http://www.di.ens.fr/pmvs/pmvs-2.tar.gz
    wget http://www.di.ens.fr/cmvs/cmvs-fix2.tar.gz
    wget http://www.cs.utexas.edu/users/dml/Software/graclus1.2.tar.gz

    #download dependencies
    sudo apt-get -y install unzip libblas-dev liblapack-dev libgtk2.0-dev libglew-dev glew-utils libdevil-dev libboost-all-dev libatlas-cpp-0.6-dev libatlas-dev imagemagick libatlas3-base libcminpack-dev libgfortran3 libmetis-edf-dev libparmetis-dev freeglut3-dev libgsl-dev

    #setup visualsfm
    unzip VisualSFM_linux_64bit.zip
    cd vsfm
    make
    cd /install

    #setup SiftGPU
    cd SiftGPU
    make
    cp bin/libsiftgpu.so /install/vsfm/bin
    cd /install

    #setup pba
    unzip pba_v1.0.5.zip
    cd pba
    #update the files
    sed -i ’1s/^/#include \n/’ src/pba/SparseBundleCU.h
    sed -i ’1s/^/#include \n/’ src/pba/pba.h
    make
    cp /install/pba/bin/libpba.so /install/vsfm/bin/
    cd /install

    #setup pmvs
    tar -vzxf pmvs-2.tar.gz
    cd pmvs-2/program/main/
    cp mylapack.o mylapack.o.backup
    make clean
    cp mylapack.o.backup mylapack.o
    make depend
    make
    cd /install

    #setup graclus
    tar -xzvf graclus1.2.tar.gz
    cd graclus1.2/
    sed -i ‘s/-DNUMBITS=32/-DNUMBITS=64/g’ Makefile.in
    make
    cd ..

    #build cmvs
    tar -zxvf cmvs-fix2.tar.gz
    cd cmvs
    sed -i ’1s/^/#include \n/’ program/base/cmvs/bundle.cc
    sed -i ’2s/^/#include \n/’ program/base/cmvs/bundle.cc
    sed -i ’1s/^/#include \n/’ program/main/genOption.cc
    cp /install/pmvs-2/program/main/mylapack.o /install/cmvs/program/main/
    sed -i ‘s/YOUR_INCLUDE_METIS_PATH =/YOUR_INCLUDE_METIS_PATH = -I\/install\/graclus1.2\/metisLib/g’ /install/cmvs/program/main/Makefile
    sed -i ‘s/YOUR_LDLIB_PATH =/YOUR_LDLIB_PATH = -L\/install\/graclus1.2/g’ /install/cmvs/program/main/Makefile
    sed -i ‘s/Your/#Your/g’ /install/cmvs/program/main/Makefile
    cd /install/cmvs/program/main
    make
    #copy the files
    cp cmvs /install/vsfm/bin/
    cp pmvs2 /install/vsfm/bin/
    cp genOption /install/vsfm/bin/

    #upda the path info, for you and any new accounts
    export PATH=$PATH:/install/vsfm/vsfm/bin
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/install/vsfm/bin

    echo “export PATH=$PATH:/install/vsfm/vsfm/bin” >> ~/.bashrc
    echo “export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/install/vsfm/bin” >> ~/.bashrc

    sudo echo “export PATH=$PATH:/install/vsfm/vsfm/bin” >> /etc/skel/.bashrc
    echo “export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/install/vsfm/bin” >> /etc/skel/.bashrc

  77. edit to my last post, with better paths in case people dont cd to install after the reboot

    #based upon http://www.10flow.com/2012/08/15/building-visualsfm-on-ubuntu-12-04-precise-pangolin-desktop-64-bit/
    sudo apt-get update
    sudo mkdir /install
    sudo chmod 777 /install
    cd /install

    #install the Nvidia CUDA drivers
    wget https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    sudo dpkg -i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64-deb
    sudo apt-get update
    sudo apt-get -y install cuda
    sudo reboot

    #download all the stuff we need
    wget http://ccwu.me/vsfm/download/VisualSFM_linux_64bit.zip
    git clone https://github.com/pitzer/SiftGPU.git
    wget http://grail.cs.washington.edu/projects/mcba/pba_v1.0.5.zip
    wget http://www.di.ens.fr/pmvs/pmvs-2.tar.gz
    wget http://www.di.ens.fr/cmvs/cmvs-fix2.tar.gz
    wget http://www.cs.utexas.edu/users/dml/Software/graclus1.2.tar.gz

    #download dependencies
    sudo apt-get -y install unzip libblas-dev liblapack-dev libgtk2.0-dev libglew-dev glew-utils libdevil-dev libboost-all-dev libatlas-cpp-0.6-dev libatlas-dev imagemagick libatlas3-base libcminpack-dev libgfortran3 libmetis-edf-dev libparmetis-dev freeglut3-dev libgsl-dev

    #setup visualsfm
    unzip VisualSFM_linux_64bit.zip
    cd /install/vsfm
    make
    cd ..

    #setup SiftGPU
    cd /install/SiftGPU
    make
    cp bin/libsiftgpu.so /install/vsfm/bin
    cd /install

    #setup pba
    unzip pba_v1.0.5.zip
    cd /install/pba
    #update the files
    sed -i ’1s/^/#include \n/’ src/pba/SparseBundleCU.h
    sed -i ’1s/^/#include \n/’ src/pba/pba.h
    make
    cp /install/pba/bin/libpba.so /install/vsfm/bin/
    cd /install

    #setup pmvs
    tar -vzxf pmvs-2.tar.gz
    cd /install/pmvs-2/program/main/
    cp mylapack.o mylapack.o.backup
    make clean
    cp mylapack.o.backup mylapack.o
    make depend
    make
    cd /install

    #setup graclus
    tar -xzvf graclus1.2.tar.gz
    cd /install/graclus1.2/
    sed -i ‘s/-DNUMBITS=32/-DNUMBITS=64/g’ Makefile.in
    make
    cd /install

    #build cmvs
    tar -zxvf cmvs-fix2.tar.gz
    cd /install/cmvs
    sed -i ’1s/^/#include \n/’ program/base/cmvs/bundle.cc
    sed -i ’2s/^/#include \n/’ program/base/cmvs/bundle.cc
    sed -i ’1s/^/#include \n/’ program/main/genOption.cc
    cp /install/pmvs-2/program/main/mylapack.o /install/cmvs/program/main/
    sed -i ‘s/YOUR_INCLUDE_METIS_PATH =/YOUR_INCLUDE_METIS_PATH = -I\/install\/graclus1.2\/metisLib/g’ /install/cmvs/program/main/Makefile
    sed -i ‘s/YOUR_LDLIB_PATH =/YOUR_LDLIB_PATH = -L\/install\/graclus1.2/g’ /install/cmvs/program/main/Makefile
    sed -i ‘s/Your/#Your/g’ /install/cmvs/program/main/Makefile
    cd /install/cmvs/program/main
    make
    #copy the files
    cp /install/cmvs/program/main/cmvs /install/vsfm/bin/
    cp /install/cmvs/program/main/pmvs2 /install/vsfm/bin/
    cp /install/cmvs/program/main/genOption /install/vsfm/bin/

    #update the path info, for you and any new accounts
    export PATH=$PATH:/install/vsfm/vsfm/bin
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/install/vsfm/bin

    echo “export PATH=$PATH:/install/vsfm/vsfm/bin” >> ~/.bashrc
    echo “export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/install/vsfm/bin” >> ~/.bashrc

    sudo echo “export PATH=$PATH:/install/vsfm/vsfm/bin” >> /etc/skel/.bashrc
    echo “export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/install/vsfm/bin” >> /etc/skel/.bashrc

  78. I’m not understanding the sed lines. These commands add empty #include’s to the top of the files and causes errors when compiling.

    For example, bundle.cc file starts out:

    #include
    #include

    #ifdef _OPENMP
    #include
    #endif

    #include “graclus.h”
    #include “bundle.h”

    And when I run the following sed command,

    sed -i ’1s/^/#include \n/’ program/base/cmvs/bundle.cc

    i get,

    #include
    #include
    #include

    #ifdef _OPENMP
    #include
    #endif

    #include “graclus.h”
    #include “bundle.h”

    Am I missing something?

    Thanks,

  79. @Willie, I’m sorry, I didn’t realize the comments seem get passed through a filter that rids them of html tags before they are posted, which means that the sed #includes get all messed up. Follow the instructions at the above link and you should be okay.

Leave a Reply to Alisson Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>