Bundler is a tool for processes known as Structure from Motion based on the reconstruction of 3D scenes from 2D images developed by Noah Snavely. Unlike other types of tools that require some planning in image capture, SfM allows working with unordered groups of images through which common points or aspects are sought to obtain a 3D model.
Nowadays these tools are becoming tremendously popular in the fields of archaeology, rock art, and cultural heritage tasks as they are very agile to use in the field and at very low costs, allowing very powerful three-dimensional documentation, since although 3D laser scanners have certain virtues, their costs make them very unaffordable in most processes, with the added drawback that they do not capture colorimetric information of the scenes.
The result of this type of tool will be a dense point cloud with the geometric and colorimetric information of our scene or object. These types of models have the same characteristics as the models resulting from photogrammetry work, except that we will need to apply a scale later with tools like Meshlab to give them a geometric or dimensional value.
In previous articles I spoke about VisualSFM, a tool that shares tools and processes with Bundler but with a visual environment, and with some difficulty in its installation. In this article I will describe the installation and work process with Bundler for Mac OS X, since a version has recently been released by Ivan Rodriguez Murillo perfectly compiled for Mac OS X that considerably simplifies the installation tasks of this tool, since having a good number of dependencies, its compilation on our Macs is usually not especially easy.
Installation of Bundler for Mac OS X
The 64-bit Mac OS X version can be downloaded from this URL:
http://dl.dropbox.com/u/3952686/bundler-v0.4-osx-4.zip
After unzipping the zip file we can place the Bundler directory in the root of our user, although we could place it anywhere else in our OS.
Next, it is necessary to add the path to the Bundler binaries to the PATH. To do this, we edit the .profile file of our user with our favorite editor, in my case:
vim /Users/jpereira/.profile
At the end of this file we must indicate the PATH to our Bundler:
export PATH="~/bundler:~/bundler/bin:$PATH"
We will use ~/ to indicate that bundler is installed in the user’s root, or in my case /Users/jpereira/
With these simple steps Bundler is ready to be used.
Using Bundler
First, we place our terminal in the directory containing the images we are going to use for the 3D model reconstruction.
Next, we execute:
RunBundler.sh
If we have just edited our .profile it is likely that our terminal does not correctly locate the Bundler programs and scripts, so to avoid restarting the session we can paste the export instruction in our terminal:
export PATH="~/bundler:~/bundler/bin:$PATH"
So now RunBundler.sh will be available for the analysis and cataloging of our image bank.
After this command, the following message will be displayed:
@@ Conversion complete, execute "sh pmvs/prep_pmvs.sh" to finalize @@ (you will first need to edit prep_pmvs.sh to specify your bundler path,
This means that we must go to the pmvs directory generated by RunBundler.sh and edit the prep_pmvs.sh script so that line 4, which indicates:
BUNDLER_BIN_PATH= # Edit this line before running
We should specify the path to the Bundler directory so that:
BUNDLER_BIN_PATH=~/bundler/bin # Edit this line before running
Next, we can execute:
sh pmvs/prep_pmvs.sh
cmvs pmvs/
genOption pmvs/
At this point we have a sparse point cloud and to improve the project it is more appropriate to create a dense cloud; for this, Bundler includes the pmvs2 tool by Dr. Yasutaka Furukawa, as follows:
pmvs2 pmvs/ option-0000
If for some reason more than one view or model has been generated, which usually happens when there are sets of images without common points with others, we can execute
sh pmvs/pmvs.sh
This is the entire process necessary for creating a 3D model. To visualize it we can use Meshlab and open the model at the path:
pmvs/models/option-0000.ply
Bundler for Linux
Although Noah Snavely’s initial project can theoretically be compiled on Linux, in practice, in current versions of Ubuntu 12 the process becomes quite complex if not impossible.
Fortunately, more and more versions of this tool are appearing on the web. One of the latest I have encountered is that of Nghia Ho, which compiles and works really well at least on my Ubuntu 12.
The distribution of this Bundler can be downloaded from here:
wget http://nghiaho.com/uploads/code/RunSFM-1.4.3.tar.bz2
Or through the website of Nghia.
The installation has very few requirements, as it incorporates the Sift detector and only some dependencies must be met:
The dependencies Bundler will require when running make are the following:
ImageMagick installed ... YES libXext installed ... YES libX11 installed ... YES libjpeg installed ... YES gfortran installed ... YES minpack installed ... YES lapack installed ... YES blas installed ... YES zlib installed ... YES atlas installed ... YES boost installed ... YES
In my case I only had to install the following libraries:
sudo apt-get install libatlas-base-dev sudo apt-get install minpack-dev sudo apt-get install gfortran-4.6 sudo apt-get install liblapack3gf
It may be that other users need to install some other project.
According to the author, it is also necessary to adjust the type of system we have, either 64 or 32 bits, in the files:
graclus1.2/Makefile.in cmvs/program/main/Makefile
And locate the parameter -DNUMBITS=64 and change it according to our needs; by default it is already set for 64 bits.
After compilation, the LibANN.so library must be moved with the operation:
sudo cp bundler-v0.4-source/lib/libANN_char.so /usr/lib/
The operation of the tool is the usual for these Bundlers; we move with our terminal to the directory where the images are contained and once there we execute RunSFM.sh, either by tracing the path to this script or including its location in the PATH.
I personally have edited the .profile file located in the root of the user’s home
vim .profile
And I have added at the end:
export PATH=$PATH:/opt/RunSFM/
Thus I have RunSFM.sh available from any location without having to trace the path to it.
Other Bundler SfM projects
There are other versions with quite similar operating principles such as:
Or the ArcheOS project by Arc-Team, developed in Python with a small graphical interface made in QT, thus proposed as a good multiplatform solution, oriented towards archaeology and heritage, and which may be explored further in its installation in subsequent articles.
