Virtualizing VisualSFM for Windows on Mac OS X

0
737

One of the problems I am encountering at work with SfM on Mac OsX is finding tools like VisualSFM that work properly on my Macbook, since I usually use them on my workstation with Ubuntu.

Since compiling VisualSFM on MacOsX is proving to be quite complicated, I have decided to try virtualization on a virtual machine with Windows XP, as the installation of VisualSFM is very simple.

Remember that VisualSFM is a Structure from Motion tool, which allows us to create 3D models in the form of point clouds from unordered collections of 2D images. VisualSFM can be used as a free photogrammetry tool, since the created models can be georeferenced and thus endowed with precise dimensions and context. These tools are increasingly used in the field of graphic documentation of heritage, whether in processes of cultural heritage conservation, archaeological excavations, or documentation of rock shelters. The workflow with this tool does not require planning or camera calibration as is necessary in other photogrammetry tools, making the work very agile. Unfortunately, the installation of VisualSFM is very Windows-oriented, although it is possible to install it on Linux as I explained in another article, but on Mac Os X, despite the efforts of Iván R. Murillo to create a compilable distribution for Mac Os X, I have personally had quite a few difficulties installing it and for now I have opted for virtualization of VisualSFM in a Windows environment to have it available on my Macbook.

Installing VisualSFM on Windows

The installation is very simple, you just have to download the executable from Changchang’s website and additionally download the PMVS and CMVS tools from Yasutaka, already compiled; for this we can go to the website of Pierre Moulon, choose the system type, and download cmvs.exe, genOption.exe, pmvs2.exe, and pthread.dll which must simply be placed alongside the VisualSFM.exe executable.

Virtualizing VisualSFM

However, there is a rather serious problem for using VisualSFM in a virtualized environment, which derives from the use of the processor of our graphics card, since VisualSFM uses SiftGPU which, as its name indicates, uses the GPU (graphics processing unit) for the process of detecting common points, keypoints or common features between images, and the problem is that the GPU features of our graphics card are usually not accessible from virtualized environments.

This situation is difficult to solve, so the only alternative is to abandon the use of the GPU and switch to the CPU, that is, to load the graphic process onto our processor, a rather suboptimal situation, but it is the only alternative. For this, we need the tool Siftwin32.exe which we can download already compiled from various projects on the web such as SFMH1 or PYMOSAICK. Once downloaded, simply place the executable alongside VisualSFM.exe and disable SiftGPU in Tools->Enable GPU->Disable SiftGPU and Tools->Enable GPU->Match Using GLSL. To make it permanent, we can go to the .ini configuration file and define:

param_use_siftgpu 0
param_use_siftmatchgpu 0

It is very important that the directory where we have saved the VisualSFM executables does not contain spaces as is usual with “Program Files” because otherwise the location of Siftwin32.exe will not be done correctly and VisualSFM will try to use the GPU.

In this way, we can use VisualSFM in an environment without GPU, although the process of detecting common points between images will be extremely slow.

However, there is an alternative to this process by which we will run SiftGPU on Mac Os X as a server, to be able to access this service from the virtual machine, thus allowing us to take advantage of the GPU capabilities of the host machine from the virtual environment.

For this, the following steps must be followed:

Installing SiftGPU on Mac Os X

Before installing SiftGPU we need to install the DevIL image library, GLEW, and optionally GLUT and Libjpeg on which DevIL depends:

To install GLEW we can do it using Darwin Ports so that:

sudo port install glew

To install Libjpeg

http://www.ijg.org/files/jpegsrc.v8d.tar.gz

Once decompressed, we simply do:

./configure
  make
  sudo make install

Next, we can download and compile DevIL

http://downloads.sourceforge.net/project/openil/DevIL/1.7.8/DevIL-1.7.8.tar.gz

After decompressing, we must go to the file:

devil-1.7.8/src-ILU/ilur/ilur.c

And adjust the path:

#include <malloc.h>

a

#include <sys/malloc.h>

Once this operation is done, we proceed to compile with the ILU and ILUT options:

./configure --enable-ILU --enable-ILUT
  make
  sudo make install

Now we can download and install SiftGPU:

http://wwwx.cs.unc.edu/~ccwu/cgi-bin/siftgpu.cgi

But before compiling, we need to make some adjustments that I have partially taken from the makesiftgpu file of the aforementioned project by Iván

For this, we open the makefile in the root directory of SiftGPU and activate:

  siftgpu_enable_server = 1
  siftgpu_prefer_glut = 1

And in “siftgpu_sse_options” we change “-march=native” to “-march=core2”, and finally in CFLAGS we can delete “-L/usr/lib64” although it does not matter, because it will give us a warning but will compile anyway.

After compiling with a simple make, the binary server_siftgpu is available in the /SiftGPU/bin directory which we can start with, for example:

./server_siftgpu -server 7777

In this way, we have started the SiftGPU server.

Configuring VisualSFM with SiftGPU server

SiftGPU server visualSFMOnce SiftGPU is correctly compiled on Mac Os X, we go to our virtual machine, start VisualSFM and access the option Tools > Enable GPU > Remote SiftGPU, thus a small dialog will open where we must specify the IP of our SiftGPU server, port, and certain parameters, so that for example we have:

192.168.1.5 7777 -fo -1

In the latest version of VisualSFM V0.5.21 there is a bug with connections to the SiftGPU server; after reporting it to Changchang Wu, author of VisualSFM, he has fixed the error, which will be resolved in future versions. To access the corrected version (Windows only) we must do so through the following URL

http://homes.cs.washington.edu/~ccwu/vsfm/test/