RunSFM

Don’t forget to check out my new TextureMesh program to texture mesh your point cloud with RunSFM !

Important notice

Please check out VisualSFM at http://www.cs.washington.edu/homes/ccwu/vsfm before trying RunSFM. VisualSFM is much more advance than RunSFM, though it still uses CMVS/PMVS to do the dense reconstruction.


I have put together my own package of Bundler and CMVS, unimaginatively named RunSFM, that will hopefully be easy to get up and running.

Download RunSFM

Last update 21 June 2012

Changes since last version

  • Fixed a race condition in SiftMatcher
  • Turned off my LM optimisation, seems to produce less points on average than the original GSL simplex routine

Download RunSFM-1.4.3.tar.bz2

The following libraries are required, I’ve found them all on Synaptics using Ubuntu 11.04:

  • cmake
  • cblas
  • lapack
  • atlas
  • gsl

Make sure to install the development packages.

Compiling RunSFM

Just type make to compile. Then copy bundler-v0.4-source/lib/libANN_char.so to /usr/local/lib and run ldconfig . By default RunSFM is configured for a 64bit machine. To change this, edit the two files:

graclus1.2/Makefile.in
cmvs/program/main/Makefile

Change occurrences of -DNUMBITS=64 to -DNUMBITS=32.

Using RunSFM

Go to the directory containing all your images. Then type:

cd directory_containing_images
(path to RunSFM)/RunSFM.sh

Grab some coffee …and that’s it!
The 3D model files will be in pmvs/models

RunSFM.sh has optional input arguments, which you can pass:
RunSFM.sh [IMAGES_PER_CLUSTER=100] [CPU_CORES=8] [MAX_MATCHING_SEQ=-1]

The default is 100 images and 8 CPU cores. If you have limited RAM then reduce the images per CMVS cluster.
MAX_MATCHING_SEQ limits the matching of an image to the last N images, useful if the images were captured sequentially eg. video. A value of -1 will do the full permutation and match every image pair possible. This has a time complexity of O(N*N/2), so be careful!

Dataset

  • TreeStump.zip (7MB, I’ve lost the full resolution images, so your results won’t be the same as in the video. There will be a small chunk missing from the trunk.)
  • statue.zip (40MB)
  • my_hand.zip (33MB)

Video Results

Click on the thumbnails to launch the video. I used MeshLab to do the surface reconstruction and tidying up of the model.

Boy statue


Download mesh models

Some mesh models available for download. They can be viewed using Meshlab.

Download simple ply viewer

For those interested, here’s the program that I wrote to generate the image sequences for the animation. It was something I wrote in like an hour so don’t expect it to the a robust program. I assumed the input ply file is a text format outputted from Meshlab, in a very very strict format, the slightest change to the header format will cause the program to fail. You can download one of the mesh models to see what the header file looks like or change the source code to suit you,

SimplePlyViewer Usage

Run the program by passing the ply file as the programs argument eg.

./simple_ply_viewer tee_stump_mesh.ply

Use the mouse to navigate, all three mouse buttons control zoom/pan/rotate. Press ESC to exit the program, it will output a playback.bin file. You must press ESC to save the OpenGL view states to generate the animation frames. Now run the program again as follows

./simple_ply_viewer tree_stump_mesh.ply playback.bin

This will dump a whole bunch of frame-xxxx.png images in the current directory. I use mencoder to generate the video eg.

mencoder mf://*.png -fps 25 -ovc x264 -o video.avi

112 thoughts on “RunSFM

  1. Hi, searching for SfM sw I ran into your article. Can you give some details on how you compiled Bundle and on which platform. Furthermore, did you use Sift for feature detection? As Sift is not open, I’m looking for an open feature detection to use with Bundle.

    Regards,
    Johan

    • Hi,

      I compiled it on Ubuntu 10.04. Unfortunately, I did not document the steps I took, I just remember coming across compiling errors here and there and addressed each one at a time. Few of the libraries don’t come standard with Ubuntu. The Lapack library, which comes with Ubuntu, is out of date and I had to compile that manually. Overall, it was not an easy and smooth process :|

      Bundler uses SIFT by default, though it is easily replaceable by something else. Bundler just calls the SIFT program externally from a shell script. There’s an implementation of GPU SURF out there, but I haven’t used it.

  2. Hi! Wonderful insight. Thanks for the overview! Quick question. To create the image-based surface reconstruction in meshlab, did you go through the web-based ARC3D service or is there another way to combine the .ply mesh profile with the original images; ideally from within Meshlab? Would be great not to have to rely on external servers for my application.

    Thanks!
    Terrence

    • I used only the ply file generated by PMVS2. There is actually no texture mapping in the normal sense. My data just happened to be high res and well textured that I can assign a colour to each vertex and give the impression of texturing :) This can be done in Meshlab by transferring the vertex colour to the surface. Of interest, I have written some code to use the original images for texturing at work. I might re-write it again in the future for public use. Is there a good format that supports UV texture mapping from images?

  3. Hi! I simply cannot get this thing to build on Ubuntu 11. I keep getting the following error:

    ../base/numeric/mylapack.cc:6:25: fatal error: clapack/f2c.h: No such file or directory
    compilation terminated.
    make[1]: *** [mylapack.o] Error 1
    make[1]: *** Waiting for unfinished jobs….
    make[1]: Leaving directory `/home/ubuntu/Documents/RunSFM/cmvs/program/main’
    make: *** [default] Error 2

    I’ve put fc2.h and clapack.h everywhere that it could possibly be referenced. Still no luck. Any ideas how to get this building correctly?

    Thanks,
    Adam

    • Thanks for the feedback. I forgot about those 2 files, which are out of date or missing on Ubuntu. I’ve just updated RunSFM to 1.1. Try downloading that and see if it helps.

      • Thanks a bunch…I was finally able to get it to build! I had to use the fully qualified path to the clapack directory which got it working. I had to do the same thing in the flann project. I think that this is my own lack of knowledge for using makefiles ;-)

        Thanks again for your quick response…

        Adam

          • I just passed in the complete path for each local include file. I think it’s a difference between using -I/ and not in the build script. For me it was just easier to find replace.

            eg: flann.h
            #include “/home/ubuntu/Documents/RunSFM/flann-1.6.11-src/src/cpp/flann/general.h”

            I am now having problems launching genOption. Its claiming that it cannot execute a binary file. I’ve tried rebuilding it several times and have adjusted permissions accordingly. Still nothing…Thoughts?

            Adam

        • It seems the Makefile script for CMVS is incomplete. Will have to update it. Make clean does not remove the binaries. Try deleting cmvs, pmvs, genOptions and typing make again.

        • I’ve updated the package to fix the Flann problem and genOption problem you’ve had. See if the new package (version 1.2) compiles without and fiddling around.

  4. @nghiaho12 Works like a charm! Now I just have to find some overlapping images. Can you tell my why these don’t match up? http://goo.gl/AbhLN It would see that there are at least 3 matching points within each image BUT the perl script can’t seem to find any exif data. I wonder if there is a way to fudge the sensor width or set a default value for unknown camera types?

    Adam

    • This is not a good dataset because the EXIF information is lost, and you probably don’t know the camera info that came with each image. Without this data Bundler won’t be able to work. Even if you did have the EXIF info, I suspect the images will lack significant overlap and SIFT will have trouble finding enough reliable matches. Bundler needs at least 16 matches per image pair from memory.

  5. Hi nghiaho12,

    Nice work – it compiled – but when I run a test on 27 800×600 images, I get all the way to just after SIFT (bundler starts?) and then libANN.so can’t be found.

    I’m currently ‘make clean’ing and will re-make after having installed libANN.

    Thanks!

    • UPDATE: I found libANN_char.so inside your RunSFM folder and sudo copied it over the /lib/ and it worked!

      This is awesome! Very dense point cloud.

      • Thanks for finding a bug in the script! I’ll fix that up and release another version. Glad it’s working for you.

  6. Hi, the siftkey and sift matcher make their output to Bundler as the other toolkits (like Bundlermatcher for instance?)? My bootleneck is the Bundler part of the workflow. With many pictures i have stuff running for weeks! Pmvs being faster is good news, but i run into problems earlier :-(

    • There has been work done on a multi-core/GP bundle adjustment library, that can be dropped in place of Bundler. Search ‘Multicore Bundle Adjustment’ on Google. However, I have yet to find anyone reporting good results from it. Henri at http://www.visual-experiments.com has a short blog entry about using it.

  7. hello,
    i used the bundler with pmvs2, but i don’t have a 360° 3D object reconstruction, can you please tell me why?and bundler and pmvs can make a 360° 3D object reconstruction?.

  8. Yes, i think that we must give another solution to match the features for a set of images like the mine to have a complete 3D object.you think that this possible?

    • You will probably have to resort to some sort of physical solution. Like maybe use a projector and shine a pattern to help with feature matching or draw something on the horse :) Or if you don’t have a projector maybe a powerful lamp and cardboard with random holes in it. I might try this myself when I have free time.

    • Probably needs a new camera entry in RunSFM/bundler-v0.4-source/bin/extract_focal.pl. This does assume the JPEG still retains the EXIF info.

      • I’ve tried more datasets (hall in pmvs2 package, temple and dino in here ). I converted them into JPEG format. And got nothing after run RunSFM (Stills stucking with this notice: “Couldn’t find CCD width for Camera”). Only your dataset works.

      • Dear,
        I’ve tried more datasets (the hall in pmvs2 package, the Temple and Dino in here ) and still getting this notice. These datasets were converted into JPEG. Only your dataset (Tree Stump) works.
        Regards!

        • those PNG files don’t have EXIF information like JPEG. Bundler needs the original information recorded by the camera when taking those photos.

  9. Hi, i compiled the code in Ubuntu 11.10 and encountered an this error: “RunSFM/lmfit-3.2/lib/.libs/liblmmin.so: undefined reference to `sqrt’ collect2: ld returned 1 exit status”. Why ? :)

      • hi nghiaho12,
        thank for reply, i have fixed the problem :) .
        but…there are some new problems :
        graclus.cc:(.text+0x28b): undefined reference to `__ComputePartitionBalance(graphdef*, int, long long*, float*)’
        graclus.cc:(.text+0x2af): undefined reference to `ComputeRAsso(graphdef*, long long*, int)’
        graclus.cc:(.text+0x2e9): undefined reference to `ComputeNCut(graphdef*, long long*, int)’

        • Hmm that’s very strange. That function is defined in rename.h of RunSFM/graclus1.2

          Maybe something broken with Ubuntu 11.10? I don’t have it installed on my system to test :|

          • I’ve had the same compile errors. the “undefined reference to `sqrt’ collect2″ mentioned by alec_c. I still can’t get passed that despite changing the makefile to use LIBS = -lm. I also got the second error message regarding “undefined reference to `__ComputePartitionBalance…” when I was trying to compile cmvs separately from RunSFM (downloaded from the CMVS website and tried to compile in a completely different folder).

            I’ve been trying to just compile these various projects for days now. I’ve managed to get bundle and pmvs to compile separately (finally), but still stuck on RunSFM and CMVS. I’d like to get at least one to compile if they are equivalent.

          • I got passed that first error my self. You have to set LIBS equal to -lm in two make files… one is in lmfit-3.2 and the other is in lmfit-3.2/demo. Then it compiled correctly.

            But, I think the main makefile in the RunSF directory will overwrite the other makefiles. So, you have to go into lmfit-3.2 and call make before calling make in RunSF.

            I also solved the other error mentioned above that contains “undefined reference to `__ComputePartitionBalance…”

            I have a 64 bit computer, but I can’t use 64 bit because it caused errors with the software. So, I have to use all 32 bit. Apparently you will get that error if you don’t set -DNUMBITS to 32 as mentioned at the top of this page.

            Change occurrences of -DNUMBITS=64 to -DNUMBITS=32 in the following files
            graclus1.2/Makefile.in
            cmvs/program/main/Makefile

            Now it compiles :)

  10. Hi nghiaho,
    I tried to compile RunSFM in windows (win 7) with cygwin, When i run “make”, some librarys didn’t install (Minpack and Atlas). How can i install them with cygwin.

    • cygwin is an unknown environment for me and as such I have not tried to compile on it. Your best bet is to install a copy of Ubuntu or if you have time, try and address each compiling error that pops up :|

  11. Hi Nghia Ho
    i can’t install! that’s my erorr:

    /usr/bin/ld: cannot find -lptcblas
    /usr/bin/ld: cannot find -lptf77blas
    collect2: ld returned 1 exit status
    make[2]: *** [bundler] Error 1
    make[2]: Leaving directory `/home/alek/RunSFM/bundler-v0.4-source/src’
    make[1]: *** [default] Error 2
    make[1]: Leaving directory `/home/alek/RunSFM/bundler-v0.4-source’
    make: *** [all] Error 2

    Hope you can help, thanks!

  12. OK I have another problem…

    [Couldn't find CCD width for camera NIKON CORPORATION NIKON D5000]
    [CCD width = 0.000mm]
    [Resolution = 2144 x 1424]
    Program keep works after this error but at the end there is not the model in the folder /pmvs/models there is only an empty file..

    How can i find CCD width for NIKON D5000? in exif file there is not.

  13. Pingback: Omar zuberi | Kilombas

  14. Hi nghiaho12,

    thanks for sharing your code! My problem is: I can not reproduce your TreeStump example with RunFSM1.4 and your TreeStump.zip. It all runs fine (I checked for errors in the console), and it tells me to lookup the generated ply file (3MB), but it seems to be incomplete. MeshLab tells me EOF, your SimplePlyViewer tells me:

    terminate called after throwing an instance of ‘std::length_error’
    what(): vector::_M_fill_insert

    There is a strange message in the console output, though, i t says “unexpected operator”:

    @@ Conversion complete, execute “sh pmvs/prep_pmvs.sh” to finalize
    @@ (you will first need to edit prep_pmvs.sh to specify your bundler path,
    @@ so that the script knows where to find your
    @@ RadialUndistort and Bundle2Vis binaries)
    [: 5: ../RunSFM/bundler-v0.4-source: unexpected operator
    [ReadBundleFile] Bundle version: 0.300
    [ReadBundleFile] Reading 15 images and 6451 points…

    I did not use any arguments for my call. Your prepocessed meshes for the statue and the tree work, however (both in MeshLab and in SimplePlyViewer). Can you verify your version 1.4 with TreeStump? I’m running Ubuntu 11.04, followed all instructions on this page. RunFSM runs for about one minute on Core I7, is that an expected runtime for treestump?

    TreeStump only has 15 images. Maybe you could provide both datasets (statue and tree) in full?

    That would be great!

    Thx,
    S4nchi

    • Hi,

      That error in the script is due to some typo on my behalf that I’ve forgot to fix, but does not affect the process. Can you copy and paste the entire output console and email me? You will probably have to set your terminal to have unlimited scroll back,

      TreeStump only has 15 images, it’s been resized slightly from the original 8MP image. I’ll post the statue set if I can find it :)

      • Hi nghiaho12,

        thanks for your help! I just sent out an email with the console output attached, along with some other things I noticed (Blender imports the ply, but seems to discard the textures). Hope it helps!

        Greetings,
        S4nchi

  15. Hi nghiaho12,

    I’m using 64 Bit Ubuntu, 11.04. You wrote that RunSFM is configured for 64 bit by default, so what I did was the following:

    make clean
    make
    ldconfig with the so library (in /usr/local) that came with your code

    Why do you ask?

    I recompiled the SimplePlyViewer and linked it to OpenCV 2.3.1, by the way.

    S4nchi

    • Hi nghiaho12,

      I just tried on a different Ubuntu 11.04 installation, however, its the same problem with the PLY file. I thought I just rule out the possibility that my custom cminpack library I installed with the prebuild Ubuntu PPA libraries for Point Cloud Library (PCL) a few days ago breaks the RunSFM process… but the problem still maintains. Any progress on your side so far?

      Bye,
      S4nchi

      • I just did a check today. Downloaded and compiled and ran the TreeStump dataset. My model file is ~3MB and works, which is the same as yours. Have a look at the PLY file and see if there is anything weird. It’s a text file, so any text editor will do.

  16. Hi nghiaho12,

    thank your very much for testing it on your system. In order to rule out that my Ubuntu installation is somehow related to the problem, I just installed a new one (64 bit, 11.04) in a virtual machine and tried to compile RunSFM. If you are interested (you mentioned in another post that RunSFM_Large will come soon!), here are the commands to make a shiny-fresh 11.04 64 Bit installation compile RunSFM:

    sudo apt-get install libc6-dev-i386 libhdf5-serial-dev libgtest-dev libgsl0-dev python-dev cmake imagemagick libmagick++-dev gfortran minpack-dev liblapack-dev libatlas-dev libatlas-base-dev libboost-dev

    It is important NOT to forget the libc6-dev-i386 because otherwise any call to jhead and sift in the bundler/lib directory will result in a “File not found” (which of course breaks the RunSFM process). This message is purely misleading (heck of misleading!), the problem lies in the missing 32 bit libc library. This is quite a strange behaviour for a 32 bit binary not finding its 32 bit libc version. Any kernel guys reading this? Took me some time to figure out. By the way, ia32-libs are NOT ENOUGH!

    If you are also building on a 64 bit system, you probably acquired the libc6-dev-i386 libs for jhead and sift on another occasion, as well as libgsl0-dev, but they don’t come with the installer by default.

    Problem’s still the same. I did an analysis and here comes the root of the problem: Meshlab 1.2 (which is available on Synaptic) just doesn’t work with PLY files generated on MY PLATFORM, but it works with your PLY from the zip file! Both my normal Ubuntu and the fresh virtual machine Ubuntu run a RunSFM process which generates PLY files incompatible with Meshlab 1.2. My guess is that it’s a 64bit problem related to library versions. Meshlab 1.3 on a second virtual machine installation (but 32 bit Ubuntu 11.10, I know, it gets complicated now) can import the PLYs I generate.

    I still don’t know why your SimplePlyViewer doesn’t work, it might be a problem of a) 64 bit b) linking against OpenCV2.3.1 or c) both.

    I made a diff on the PLY from your zip and my PLY, and they have different headers, and different data. Data, ok, you probably used the full TreeStump set, but header?? Here are the two headers:

    YOURS:
    ply
    format ascii 1.0
    comment VCGLIB generated
    element vertex 463883
    property float x
    property float y
    property float z
    property uchar red
    property uchar green
    property uchar blue
    property uchar alpha
    element face 666362
    property list uchar int vertex_indices
    end_header
    -2.55889 -0.0342042 0.722332 83 103 116 255
    -1.74701 -0.0586613 0.550618 86 107 129 255
    -1.7606 -0.0580519 0.492769 85 105 129 255

    MINE:
    ply
    format ascii 1.0
    element vertex 53364
    property float x
    property float y
    property float z
    property float nx
    property float ny
    property float nz
    property uchar diffuse_red
    property uchar diffuse_green
    property uchar diffuse_blue
    end_header
    2.06895 0.848633 -5.51827 -0.835326 -0.494819 0.239552 59 68 70
    2.07552 0.839761 -5.50169 -0.943695 -0.182388 0.275996 53 64 70
    2.09854 0.8219 -5.47689 -0.615519 0.168693 0.769857 57 73 80

    My guess is, you compiled the version you used for generating the PLY in the zip against different (older? newer? custom build?) libs I have on my machine. What’s interesting is the comment “VCGLIB generated” in your PLY and the different properties and element statements.

    By the way, Meshlab 1.3 (I compiled it from source) will compile but crash with access violation on a fresh Ubuntu 11.04 system. Whole different story. So I’m stuck with Meshlab 1.2. And bundler 0.4 won’t even compile with the gcc 4.5 on 11.04. You need to correct a constructor call in BundlerApp.h, THEN it compiles. PLY files from MY compiled bundler0.4 work fine in Meshlab 1.2. I will have a closer look tomorrow. I’m surprised that I seem to be the only one trying to compile RunSFM and Bundler0.4 on a fresh Ubuntu 11.04 64 bit installation!

    Thanks again for your time, Nghia Ho, I really appreciate it.

    S4nchi

    • I think there’s an OOPS on my part there :) VCGLIB comes from saving using Meshlab. I must have did some cleaning up of the model in MeshLab. SimplyPlyViewer assumes the header generated by Meshlab. If you add that extra line it should work.

      I might take the plunge and upgrade to Ubuntu 11.10 64bit so I can see all the latest and greatest in compiling error :) I’m surprised your intall fresh of Ubuntu 11.04 doesn’t work like mine, did you install all the latest updates it asks for?

      On a different note, RunSFM_Large is dead at the moment. It was mostly an experimental idea that sounded good in my head, but not so in practice. Instead, you should check out VisualSFM. I’ve generated some pretty large point cloud using it.

      • Hi Nghia Ho,

        just tried, back to a clone of the virtual machine right after ubuntu CD installation, then all updates and the sudo apt-get line I wrote above + sudo apt-get meshlab… then compilation of RunSFM and execution on the TreeStump dataset. Same as before, Meshlab won’t open it and gives EOF. BUT I know now that it is a problem of the viewing, the RunSFM process generates correct data. And that’s the starting point I was looking for!!

        As David says, thank you for your efforts and assembling a zip-package with all dependencies included (so that it compiles out of the box with just some apt-get install calls). This will be my starting point to work into SFM, all the other packages a) didn’t compile b) came with dependency hell c) required Matlab AND didn’t mex-compile d) weren’t open source or e) had no clear instructions on how to setup the whole chain.

        This is definitely a great contribution to the open source world, thank you!

        S4nchi

        • You’re probably better off compiling Meshlab from source, rather than using apt-get. Each revision tends to introduce some major changes.

          Glad I could be of help!

  17. I got it working! Great software! Thanks so much for putting it out there. You did a much better job of making it easier to compile and use than anyone else.

    BTW, I have a question about how to model the points. I wrote graphics software to view the data. It works great, but I noticed that I had to multiple the positions of the points by 30 to get it to display correctly. Otherwise, the points would be so close together they overlap. I figure this is because the images are assumed to come from multiple cameras, so it doesn’t preserve the original pixel sizes. But, how do you know to multiply these pixels by 30? It could easily have been 35, or 40 or 50 and still produce similar models. What is the correct way to do this? I model the data using voxels, representing 3d pixels of size 1x1x1.

    • Glad you got it working! I’l keep a note on the steps you took to get it working.

      One method of scaling 3d points that I would use is:

      1. Find the average (x,y,z) point, call it avg_point
      2. Shift all your points by -avg_point (minus)
      3. Scale points by multipling all value by S (30 in your case)
      4. Shift all your points by avg_point (plus)

  18. Hi, im getting the following error while using make…..

    cd flann-1.6.11-src/build; cmake ..; make -j
    CMake Error at src/cpp/CMakeLists.txt:37 (set_target_properties):
    set_target_properties called with incorrect number of arguments.

    CMake Error at src/cpp/CMakeLists.txt:43 (set_target_properties):
    set_target_properties called with incorrect number of arguments.

    – Install prefix: /usr/local
    – Build type: RelWithDebInfo
    – Building C bindings: ON
    – Building python bindings: OFF
    – Building matlab bindings: OFF
    – Using MPI support: OFF
    – Configuring incomplete, errors occurred!
    make[1]: Entering directory `/root/wrk/RunSFM/flann-1.6.11-src/build’
    make[1]: *** No targets specified and no makefile found. Stop.
    make[1]: Leaving directory `/root/wrk/RunSFM/flann-1.6.11-src/build’
    make: *** [all] Error 2

  19. Hi!
    I got this erro during the compilation.
    Any suggestions?

    thanks
    Riccardo

    g++ -L/usr/lib -L../../../graclus1.2 -lXext -lX11 -ljpeg -lm -lpthread -llapack -fopenmp -lmultilevel -lmetis -lm -o cmvs cmvs.o patch.o camera.o image.o photo.o photoSetS.o bundle.o graclus.o -L/usr/lib -L../../../graclus1.2 -lXext -lX11 -ljpeg -lm -lpthread -llapack -fopenmp -lmultilevel -lmetis -lm
    graclus.o: In function `CMVS::Cgraclus::runSub(graphdef&, int, int, int, std::vector<int, std::allocator >&)’:
    graclus.cc:(.text+0x28a): undefined reference to `__ComputePartitionBalance(graphdef*, int, int*, float*)’
    graclus.cc:(.text+0x2a6): undefined reference to `ComputeRAsso(graphdef*, int*, int)’
    graclus.cc:(.text+0x2e1): undefined reference to `ComputeNCut(graphdef*, int*, int)’
    ../../../graclus1.2/libmultilevel.a(mlkkm.o): In function `MLKKMPartitioning(controldef*, graphdef*, int, int, int*, float*, float)’:
    mlkkm.c:(.text+0x3c): undefined reference to `__idxmalloc(int, char*)’
    mlkkm.c:(.text+0×51): undefined reference to `__idxmalloc(int, char*)’
    mlkkm.c:(.text+0x5d): undefined reference to `__Coarsen2Way(controldef*, graphdef*)’
    mlkkm.c:(.text+0x7f): undefined reference to `__AllocateKWayPartitionMemory(controldef*, graphdef*, int)’
    mlkkm.c:(.text+0xe7): undefined reference to `__ComputePartitionInfo(graphdef*, int, int*)’
    mlkkm.c:(.text+0×149): undefined reference to `__GKfree(void**, …)’
    mlkkm.c:(.text+0x1a2): undefined reference to `__seconds()’
    mlkkm.c:(.text+0x20c): undefined reference to `METIS_WPartGraphRecursive(int*, int*, int*, int*, int*, int*, int*, int*, float*, int*, int*, int*)’
    mlkkm.c:(.text+0×222): undefined reference to `__seconds()’
    ../../../graclus1.2/libmultilevel.a(mlkkm.o): In function `MLKKM_WPartGraphKway(int*, int*, int*, int*, int*, int*, int*, int*, int*, float*, int*, int*, int*, int)’:
    mlkkm.c:(.text+0x2bd): undefined reference to `__SetUpGraph(graphdef*, int, int, int, int*, int*, int*, int*, int)’
    mlkkm.c:(.text+0×324): undefined reference to `__idxsum(int, int*)’
    mlkkm.c:(.text+0x38e): undefined reference to `__InitRandom(int)’
    mlkkm.c:(.text+0x3a9): undefined reference to `__AllocateWorkSpace(controldef*, graphdef*, int)’
    mlkkm.c:(.text+0×410): undefined reference to `__FreeWorkSpace(controldef*, graphdef*)’
    mlkkm.c:(.text+0×475): undefined reference to `__seconds()’
    mlkkm.c:(.text+0x49c): undefined reference to `__PrintTimers(controldef*)’
    mlkkm.c:(.text+0x4b2): undefined reference to `__InitTimers(controldef*)’
    mlkkm.c:(.text+0x4d0): undefined reference to `__seconds()’
    mlkkm.c:(.text+0×503): undefined reference to `__Change2FNumbering(int, int*, int*, int*)’
    mlkkm.c:(.text+0×538): undefined reference to `__Change2CNumbering(int, int*, int*)’
    ../../../graclus1.2/libmultilevel.a(mlkkm.o): In function `MLKKM_PartGraphKway(int*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int)’:
    mlkkm.c:(.text+0×577): undefined reference to `__fmalloc(int, char*)’
    ../../../graclus1.2/libmultilevel.a(wkkm.o): In function `Weighted_kernel_k_means(controldef*, graphdef*, int, int*, float*, float)’:
    wkkm.c:(.text+0×662): undefined reference to `__idxmalloc(int, char*)’
    wkkm.c:(.text+0x6b4): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0x6cc): undefined reference to `__fmalloc(int, char*)’
    wkkm.c:(.text+0x6e4): undefined reference to `__fmalloc(int, char*)’
    wkkm.c:(.text+0×704): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0x87b): undefined reference to `__idxmalloc(int, char*)’
    wkkm.c:(.text+0xcd4): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0xcec): undefined reference to `__fmalloc(int, char*)’
    wkkm.c:(.text+0xd04): undefined reference to `__fmalloc(int, char*)’
    wkkm.c:(.text+0xd24): undefined reference to `__idxsmalloc(int, int, char*)’
    ../../../graclus1.2/libmultilevel.a(wkkm.o): In function `local_search(controldef*, graphdef*, int, int, int*, float*, float)’:
    wkkm.c:(.text+0xd9c): undefined reference to `chainmalloc(int, char*)’
    wkkm.c:(.text+0xdbf): undefined reference to `__ismalloc(int, int, char*)’
    wkkm.c:(.text+0xddf): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0xdff): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0xe1e): undefined reference to `f2malloc(int, int, char*)’
    wkkm.c:(.text+0xe39): undefined reference to `__fmalloc(int, char*)’
    wkkm.c:(.text+0x10c9): undefined reference to `__samin(int, float*)’
    ../../../graclus1.2/libmultilevel.a(wkkm.o): In function `remove_empty_clusters_l1(controldef*, graphdef*, int, int*, float*, float)’:
    wkkm.c:(.text+0x1e85): undefined reference to `__imalloc(int, char*)’
    wkkm.c:(.text+0x1eb1): undefined reference to `clusterSize(graphdef*, int*)’
    wkkm.c:(.text+0x1f20): undefined reference to `clusterSize(graphdef*, int*)’
    ../../../graclus1.2/libmultilevel.a(wkkm.o): In function `remove_empty_clusters_l2(controldef*, graphdef*, int, int*, float*, float)’:
    wkkm.c:(.text+0x1f58): undefined reference to `__imalloc(int, char*)’
    wkkm.c:(.text+0x1f94): undefined reference to `clusterSize(graphdef*, int*)’
    wkkm.c:(.text+0×2014): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0×2034): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0×2054): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0×2073): undefined reference to `i2malloc(int, int, char*)’
    wkkm.c:(.text+0x22e4): undefined reference to `clusterSize(graphdef*, int*)’
    ../../../graclus1.2/libmultilevel.a(wkkm.o): In function `pingpong(controldef*, graphdef*, int, int, float*, float, int)’:
    wkkm.c:(.text+0×2322): undefined reference to `__idxsmalloc(int, int, char*)’
    ../../../graclus1.2/libmultilevel.a(wkkm.o): In function `MLKKMRefine(controldef*, graphdef*, graphdef*, int, int, float*, float)’:
    wkkm.c:(.text+0×2483): undefined reference to `__ComputeKWayPartitionParams(controldef*, graphdef*, int)’
    wkkm.c:(.text+0x24a9): undefined reference to `__seconds()’
    wkkm.c:(.text+0x24e9): undefined reference to `__seconds()’
    wkkm.c:(.text+0×2511): undefined reference to `ComputeNCut(graphdef*, int*, int)’
    wkkm.c:(.text+0×2523): undefined reference to `__GKfree(void**, …)’
    wkkm.c:(.text+0x253a): undefined reference to `__seconds()’
    wkkm.c:(.text+0×2561): undefined reference to `__ProjectKWayPartition(controldef*, graphdef*, int)’
    wkkm.c:(.text+0×2579): undefined reference to `__seconds()’
    wkkm.c:(.text+0×2587): undefined reference to `__seconds()’
    wkkm.c:(.text+0x25de): undefined reference to `__seconds()’
    wkkm.c:(.text+0×2602): undefined reference to `ComputeRAsso(graphdef*, int*, int)’
    wkkm.c:(.text+0×2629): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0×2649): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0×2676): undefined reference to `__GKfree(void**, …)’
    wkkm.c:(.text+0×2687): undefined reference to `__seconds()’
    collect2: ld returned 1 exit status

    • This will happen if graclus1.2 failed to compile. I’m guessing you’re running on a 32bit Ubuntu. Look at the top of the page under “Compiling RunSFM” to configure for 32bit if you haven’t already. And check whether graclus compiled or not.

      • Hi,
        I change from 64 to 32 version.
        I compiled each single library and the error occurs compiling cmvs

        here the beginning part of the error:
        g++ -c -O2 -Wall -Wno-deprecated -DNUMBITS=32 -I/usr/include -I../../../lmfit-3.2/lib -I../../../graclus1.2/metisLib/ -fopenmp -DNUMBITS=32 ../base/cmvs/graclus.cc
        g++ -L/usr/lib -L../../../graclus1.2 -lXext -lX11 -ljpeg -lm -lpthread -llapack -fopenmp -lmultilevel -lmetis -lm -o cmvs cmvs.o patch.o camera.o image.o photo.o photoSetS.o bundle.o graclus.o -L/usr/lib -L../../../graclus1.2 -lXext -lX11 -ljpeg -lm -lpthread -llapack -fopenmp -lmultilevel -lmetis -lm
        graclus.o: In function `CMVS::Cgraclus::runSub(graphdef&, int, int, int, std::vector<int, std::allocator >&)’:
        graclus.cc:(.text+0x28a): undefined reference to `__ComputePartitionBalance(graphdef*, int, int*, float*)’

  20. Hello,
    I use sygwin to compile the runsfm in win7-32bits system.after day’s work, I have managed to finish the bundler,but it tells me that the bunder2Vis can’t work!
    the RadialUndistort used to have the same question ,while i successed come across by replace it by
    RadialUndistort .exe . However, I don’t have the source code of bunder2Vis ,so I can’t solve the problem.
    I wonder if you can tell me the conditions that bunder2Vis can run with, I think that the direction is right. If you can surply the source code of bunder2Vis,that can be better.
    thank you very much !

  21. Thanks for the awesome work.

    Which Meshlab surface reconstruction filter did you use to have smooth surface like that?

    • I use Poisson Reconstruction. It works well if you have a dense point cloud. But has this side effect of making the surface appear balloon/bubble like.

  22. Great software! This is exactly what I wanted. I tried VisualSFM on my ubuntu laptop, but it didn’t work (I don’t have any GPU accelerated stuff). Your RunSFM is exactly what I think this software should do “Here’s some images, make a model”.

    I have experience packing ubuntu software, I might try to that with RunSFM, it might save you having to answer compilation questions! I’ll keep you informed

    I tried your tree stump demo, and it works, but I didn’t get the same results as you. Firstly I have a hole on one side (as you can see in this image: ( http://i.imgur.com/Gehez.png) ). I also just got a set of coloured points, rather than a smooth surface like you have in your youtube video. Did you do any special processing to get that smooth textured surface?

    • The tree stump in the video uses the original high res images, the one I have on my website is lower resolution. I also get the hole in trunk. For the smooth surface I used Meshlab with Poisson Reconstruction + vertex coloring. Hope that helps!

  23. I have it compiled and working.. now I get these errors with sift:

    Finding keypoints…
    Finding keypoints…
    sift: util.c:330: ConvHorizontal: Assertion `cols + ksize < 8000' failed.
    sh: line 1: 8453 Aborted (core dumped) /root/src/RunSFM/bundler-v0.4-source/bin/sift ./DSC00199.key

    Can you please give me some hints? Is it a problem with my libraries
    thanks in advance

  24. mogrify -resize 50% *.jpg

    did the trick. thanks for the hint and amazing work!

    [Extracting exif tags from image ./DSC00209.jpg]
    [Focal length = 16.000mm]
    [CCD width = 23.400mm]
    [Resolution = 2296 x 1528]
    [Focal length (pixels) = 1569.915
    [Found 19 good images]
    Finding keypoints…
    Finding keypoints…
    Finding keypoints…
    Finding keypoints…
    27616 keypoints found.
    Finding keypoints…
    34779 keypoints found.

  25. 24gb on my dev box with dual i7 970. I hope it works. I have another process which generates over 19million points for a small aerial area. Much appreciated. :)

    load average: 30.66, 29.25, 27.34

    hah!

  26. hi,
    i can’t compile on Ubuntu 12.04 64 bit, cMake 2.8.7.
    I don’t understand where is the problem so I’ve uploaded my terminal’s output here:
    http://www.pasteall.org/31892/text

    “Could NOT find GTest (missing: GTEST_LIBRARY GTEST_MAIN_LIBRARY)”
    i’ve installed libgtest-dev 1.6 is it the right package?

    Hope you can help me.
    Thankyou

    • Hi,

      GTest is not actually required to compile RunSFM. You’re actually missing libgsl development packages.

  27. Hi Nghia,

    When I tried to compile RunSFM, I got the following error message. Please point out the reasons. I doubt whether the versions of the development libs are incorrect or some necessary libs are missing. Many thanks!

    peng@ubuntu:~/sFM/RunSFM$ make
    cd scripts; sh checkdep.sh
    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
    cd flann-1.6.11-src/build; cmake ..; make -j
    – The C compiler identification is GNU
    – The CXX compiler identification is unknown
    – Check for working C compiler: /usr/bin/gcc
    – Check for working C compiler: /usr/bin/gcc — works
    – Detecting C compiler ABI info
    – Detecting C compiler ABI info – done
    CMake Error: your CXX compiler: “CMAKE_CXX_COMPILER-NOTFOUND” was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
    – Found PythonInterp: /usr/bin/python (found version “2.7.3″)
    – Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
    CMake Warning at CMakeLists.txt:60 (message):
    hdf5 library not found, some tests will not be run

    – Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
    CMake Warning at CMakeLists.txt:88 (message):
    gtest library not found, some tests will not be run

    CMake Error at src/cpp/CMakeLists.txt:37 (set_target_properties):
    set_target_properties called with incorrect number of arguments.

    CMake Error at src/cpp/CMakeLists.txt:43 (set_target_properties):
    set_target_properties called with incorrect number of arguments.

    hdf5 library not found, not compiling flann_example.cpp
    – Install prefix: /usr/local
    – Build type: RelWithDebInfo
    – Building C bindings: ON
    – Building python bindings: OFF
    – Building matlab bindings: OFF
    – Using MPI support: OFF
    – Configuring incomplete, errors occurred!
    make[1]: Entering directory `/home/peng/sFM/RunSFM/flann-1.6.11-src/build’
    make[1]: *** No targets specified and no makefile found. Stop.
    make[1]: Leaving directory `/home/peng/sFM/RunSFM/flann-1.6.11-src/build’
    make: *** [all] Error 2
    peng@ubuntu:~/sFM/RunSFM$

  28. Hi Nghia, many thanks for your immediate response! I installed the libs as you mentioned, but stil got two errors (see below). It is strange that I installed libgtest-dev, but still got the message “gtest library not found, some tests will not be run”. Kindly reply. Thanks in advance.

    peng@ubuntu:~/sFM/RunSFM$ make
    cd scripts; sh checkdep.sh
    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
    cd flann-1.6.11-src/build; cmake ..; make -j
    – Could NOT find GTest (missing: GTEST_LIBRARY GTEST_MAIN_LIBRARY)
    CMake Warning at CMakeLists.txt:88 (message):
    gtest library not found, some tests will not be run

    CMake Error at src/cpp/CMakeLists.txt:37 (set_target_properties):
    set_target_properties called with incorrect number of arguments.

    CMake Error at src/cpp/CMakeLists.txt:43 (set_target_properties):
    set_target_properties called with incorrect number of arguments.

    – Install prefix: /usr/local
    – Build type: RelWithDebInfo
    – Building C bindings: ON
    – Building python bindings: OFF
    – Building matlab bindings: OFF
    – Using MPI support: OFF
    – Configuring incomplete, errors occurred!
    make[1]: Entering directory `/home/peng/sFM/RunSFM/flann-1.6.11-src/build’
    make[1]: *** No targets specified and no makefile found. Stop.
    make[1]: Leaving directory `/home/peng/sFM/RunSFM/flann-1.6.11-src/build’
    make: *** [all] Error 2
    peng@ubuntu:~/sFM/RunSFM$

    • Turns out I don’t even have gtest installed, must be optional. Can you delete the RunSFM folder and try again. I suspect it might be remembering old values.

  29. Many thanks! You are always helpful. I delivered what you mentioned, and the compiling was disrupted by the following errors:


    main.cpp:319:1: instantiated from here
    ../flann-1.6.11-src/src/cpp/flann/nn/index_testing.h:158:11: warning: variable ‘p1’ set but not used [-Wunused-but-set-variable]
    g++ obj/Debug/Timing.o obj/Debug/keys2a.o obj/Debug/main.o -lz -lgomp -lboost_filesystem-mt -lboost_system ../flann-1.6.11-src/build/lib/libflann_cpp_s.a -o bin/Debug/SiftMatcher
    /usr/bin/ld: cannot find -lboost_filesystem-mt
    /usr/bin/ld: cannot find -lboost_system
    collect2: ld returned 1 exit status
    make[1]: *** [out_debug] Error 1
    make[1]: Leaving directory `/home/peng/sFM/RunSFM/SiftMatcher’
    make: *** [all] Error 2

  30. Hi,
    Thank you for putting this package together. I’m trying to get it install on Xubuntu 12.04.2 and the make file shows all dependencies installed except “atlas.”

    Can you tell me what version number and/or instance of atlas that you used? I have *some* version of atlas installed :

    2013-03-10 14:53:01 configure libatlas-dev 3.8.4-3build1
    2013-03-10 14:53:01 status unpacked libatlas-dev 3.8.4-3build1
    2013-03-10 14:53:01 status half-configured libatlas-dev 3.8.4-3build1
    2013-03-10 14:53:01 status installed libatlas-dev 3.8.4-3build1
    2013-03-10 14:53:01 configure libatlas-base-dev 3.8.4-3build1
    2013-03-10 14:53:01 status unpacked libatlas-base-dev 3.8.4-3build1
    2013-03-10 14:53:01 status half-configured libatlas-base-dev 3.8.4-3build1
    2013-03-10 14:53:02 status installed libatlas-base-dev 3.8.4-3build1

    But this doesn’t seem to be getting recognized by the install script. Any thoughts you could share would be appreciated!
    Thank you!

    • Hi,

      My version is 3.8.4-8, I’ve also got libatlas3-base, libatlas3gf-base installed. Not sure if the latter two is required. Give it a try. I’ve got this file on my system /usr/lib/atlas-base/libatlas.so.

  31. I run into these Make errors, how to solve this problem?

    ../base/pmvs/optim.h:6:30: fatal error: gsl/gsl_multimin.h: No such file or directory
    compilation terminated.
    make[1]: *** [optim.o] Error 1
    make[1]: *** Waiting for unfinished jobs….
    In file included from ../base/pmvs/findMatch.h:19:0,
    from ../base/pmvs/patchOrganizerS.cc:3:
    ../base/pmvs/optim.h:6:30: fatal error: gsl/gsl_multimin.h: No such file or directory
    compilation terminated.
    make[1]: *** [findMatch.o] Error 1
    make[1]: *** [expand.o] Error 1
    make[1]: *** [seed.o] Error 1
    make[1]: *** [pmvs2.o] Error 1
    make[1]: *** [filter.o] Error 1
    make[1]: *** [patchOrganizerS.o] Error 1
    make[1]: Leaving directory `/home/eglxiang/Development/RunSFM/cmvs/program/main’
    make: *** [all] Error 2

Leave a 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>