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

https://github.com/nghiaho12/RunSFM

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

188 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

    1. 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

    1. 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

    1. 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.

      1. 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

          1. 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

        1. 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.

        2. 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

    1. 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!

    1. 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.

      1. 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 🙁

    1. 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?.

    1. Hi,

      Make sure the object is well textured and you have taken a LOT of photos with overlap. I would try taking around 72 images.

      1. hello nghiaho12,
        thank you for your replay,
        the the object is well textured and i habe 30 images.can you please give me a set of images that can make 360° 3D object modelisation?i

          1. My one is highly textured and high resolution, makes it easier. Maybe you can upload your images so I can see?

      1. You need way more overlaps than what you have. The texture on the horse looks a bit smooth and specular reflection doesn’t help either (flash?). Keep in mind that a feature needs to be visible in at least 3 images for reconstruction. So I would try taking way more pictures and the higher the resolution the better.

        1. hello again,
          do you have any other proposition to extract the features points and matching it to have a complete 360° model with an exemple that i gave it to you?or can we make any changes on bundler ?

          1. Hmm I can’t think of anything at the moment. You probably have reached a limitation with the software :p

  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?

    1. 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.

    1. 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.

      1. 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.

      2. 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!

        1. 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 ? 🙂

    1. Looks like a picky compiler. Go to the Makefile in lmfit-3.2. Search for LIBS = and change it to this

      LIBS = -lm

      1. 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)’

        1. 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 😐

          1. 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.

          2. 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.

    1. 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. 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

    1. 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 🙂

      1. 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

  14. 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

    1. 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

      1. 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.

  15. 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

    1. 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.

      1. 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

        1. 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!

    2. I am trying to compile RunSFM on 64-bit Ubuntu 12.04 and after doing a fresh install I ran the apt-get line you supplied but I’m getting the following error when I run make.

      /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

      I’m guessing I just need to get the boost_system package, but I just wanted to be sure there wasn’t something else going wrong here.

  16. 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.

    1. 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)

  17. 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

        1. Try editing the Makefile in the root directory, look for the line

          cd flann-1.6.11-src/build; cmake ..; make -j

          get rid of “-j” to become

          cd flann-1.6.11-src/build; cmake ..; make

          see if it helps. You might need to do a make clean and start again.

  18. 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+0x51): 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+0x149): 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+0x222): 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+0x324): 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+0x410): undefined reference to `__FreeWorkSpace(controldef*, graphdef*)’
    mlkkm.c:(.text+0x475): 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+0x503): undefined reference to `__Change2FNumbering(int, int*, int*, int*)’
    mlkkm.c:(.text+0x538): 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+0x577): 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+0x662): 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+0x704): 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+0x2014): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0x2034): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0x2054): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0x2073): 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+0x2322): 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+0x2483): 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+0x2511): undefined reference to `ComputeNCut(graphdef*, int*, int)’
    wkkm.c:(.text+0x2523): undefined reference to `__GKfree(void**, …)’
    wkkm.c:(.text+0x253a): undefined reference to `__seconds()’
    wkkm.c:(.text+0x2561): undefined reference to `__ProjectKWayPartition(controldef*, graphdef*, int)’
    wkkm.c:(.text+0x2579): undefined reference to `__seconds()’
    wkkm.c:(.text+0x2587): undefined reference to `__seconds()’
    wkkm.c:(.text+0x25de): undefined reference to `__seconds()’
    wkkm.c:(.text+0x2602): undefined reference to `ComputeRAsso(graphdef*, int*, int)’
    wkkm.c:(.text+0x2629): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0x2649): undefined reference to `__idxsmalloc(int, int, char*)’
    wkkm.c:(.text+0x2676): undefined reference to `__GKfree(void**, …)’
    wkkm.c:(.text+0x2687): undefined reference to `__seconds()’
    collect2: ld returned 1 exit status

    1. 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.

      1. 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*)’

  19. 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 !

    1. You can but it’s a bit of a hack. Edit RunSFM/bundler-v0.4-source/bin/extract_focal.pl. At line 400 you can replace the focal length with your own one.

  20. Thanks for the awesome work.

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

    1. 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.

  21. 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?

    1. 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!

  22. 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

        1. The image is too big. The maximum size currently support is 4000 pixels width/height. Just shrink the image a bit and it should work.

  23. 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.

  24. 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!

  25. 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

    1. Hi,

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

  26. 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$

  27. 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$

    1. 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.

  28. 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

  29. 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!

    1. 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.

      1. Hi,

        Since the script to check packages said that i don’t have Atlas package (and so that I cannot do ‘make’ successfully), i tried a few things:

        Tried to install “libatlas3-base_3.8.4-8ubuntu1_i386” but an error message appears (Package operation failed):

        dpkg: considering removing libatlas3gf-base in favour of libatlas3-base …
        dpkg: no, cannot proceed with removal of libatlas3gf-base (–auto-deconfigure will help):
        libatlas-base-dev depends on libatlas3gf-base (= 3.8.4-3build1)
        libatlas3gf-base is to be removed.
        dpkg: regarding …/libatlas3-base_3.8.4-8ubuntu1_i386.deb containing libatlas3-base:
        libatlas3-base conflicts with libatlas3gf-base (<< 3.8.4-4)
        libatlas3gf-base (version 3.8.4-3build1) is present and installed.
        dpkg: error processing /home/kuerdaz/Downloads/libatlas3-base_3.8.4-8ubuntu1_i386.deb (–install):
        conflicting packages – not installing libatlas3-base

        Tried to install "libatlas-base-dev_3.8.4-8ubuntu1_i386", the Ubuntu Software Center said that:

        Breaks existing package 'liblapack-dev' that conflict: 'liblapack-3.so'. But the '/home/kuerdaz/Downloads/libatlas-base-dev_3.8.4-8ubuntu1_i386.deb' provides it via 'libatlas-3.so, libatlas-3gf.so.liblapack-3.so,liblapack-3gf.so'

        Any solutions? Thanks very much.

        1. I have these packages installed on my Ubuntu 13.04, when searching for “atlas”

          libatlas-base-dev
          libatlas-dev
          libatlas3-base

          all are version 3.8.4-9. See if you can get those 3 installed.

  30. 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

  31. It appears that there may be a solution to this in the comments above, but I’m having difficulties in extracting this from what seems to be a mix of different issues in one thread. The issue specifically is with the error:

    ../base/cmvs/graclus.cc: In static member function ‘static void CMVS::Cgraclus::runSub(GraphType&, int, int, int, std::vector&)’:
    ../base/cmvs/graclus.cc:160:73: error: ‘MLKKM_PartGraphKway’ was not declared in this scope
    ../base/cmvs/graclus.cc:167:50: error: ‘ComputeNCut’ was not declared in this scope
    ../base/cmvs/graclus.cc:171:51: error: ‘ComputeRAsso’ was not declared in this scope
    make: *** [graclus.o] Error 1

    uname -a gives:
    3.5.0-28-generic #48~precise1-Ubuntu SMP Wed Apr 24 21:42:24 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

    is there some incompatible library somewhere in the compile chain?

  32. Thank you for putting this all together!

    I was wondering if you have tips on taking pictures for better models? Currently I am getting a lot of holes and gaps in my models and am thinking it could be due to the pictures.

  33. im trying to run your program on my ubuntu and im get different errors each time! (specially in installing atlas!!)
    would you pls help me! does the error refer to bad installtion of atlas?

    cd runsfm
    make:
    ———————————————————————–
    dormbr.f:(.text+0x2cc): undefined reference to `_gfortran_concat_string’
    dormbr.f:(.text+0x357): undefined reference to `_gfortran_concat_string’
    dormbr.f:(.text+0x3ec): undefined reference to `_gfortran_concat_string’
    dormbr.f:(.text+0x477): undefined reference to `_gfortran_concat_string/usr/lib/liblapack.so(dgebd2.o): In function `dgebd2_’:
    dgebd2.f:(.text+0x9f): undefined reference to `xerbla_’
    /usr/lib/liblapack.so(dlarf.o): In function `dlarf_’:
    dlarf.f:(.text+0x3c): undefined reference to `lsame_’
    dlarf.f:(.text+0x1be): undefined reference to `dgemv_’
    dlarf.f:(.text+0x212): undefined reference to `dger_’
    dlarf.f:(.text+0x285): undefined reference to `dgemv_’
    dlarf.f:(.text+0x2d9): undefined reference to `dger_’
    /usr/lib/liblapack.so(sgebd2.o): In function `sgebd2_’:
    sgebd2.f:(.text+0x9f): undefined reference to `xerbla_’
    /usr/lib/liblapack.so(slarf.o): In function `slarf_’:
    slarf.f:(.text+0x3c): undefined reference to `lsame_’
    slarf.f:(.text+0x1b8): undefined reference to `sgemv_’
    slarf.f:(.text+0x20b): undefined reference to `sger_’
    slarf.f:(.text+0x27e): undefined reference to `sgemv_’
    slarf.f:(.text+0x2d1): undefined reference to `sger_’
    collect2: ld returned 1 exit

    1. I found the problem. it was about my broken lapack package. i fix it.
      when i run:
      make clean
      make

      I get following errors: I HAVE 64 BIT SYSTEM!

      graclus.cc:(.text+0x2f9): undefined reference to `ComputeNCut(graphdef*, long long*, int)’
      ../../../graclus1.2/libmultilevel.a(mlkkm.o): In function `MLKKMPartitioning(controldef*, graphdef*, int, int, long long*, float*, float)’:
      mlkkm.c:(.text+0x5f): undefined reference to `__idxmalloc(int, char*)’
      mlkkm.c:(.text+0x6e): undefined reference to `__idxmalloc(int, char*)’
      mlkkm.c:(.text+0x79): undefined reference to `__Coarsen2Way(controldef*, graphdef*)’
      mlkkm.c:(.text+0x95): undefined reference to `__AllocateKWayPartitionMemory(controldef*, graphdef*, int)’
      mlkkm.c:(.text+0xf6): undefined reference to `__ComputePartitionInfo(graphdef*, int, long long*)’
      …………………..

          1. Hi, as others libraries compile well and i’m not going to modify cmvs yet, would pls give me a link to its 64 bit linux executable files (binary) to put them in runsfm package.

            it seems that i need cmvs,pmvs2,genOption (i cant find their 64 bit binary)

            thanks a lot

      1. Can you try a “make clean” and make again, if you haven’t already, since you mentioned you fixed an issue with Atlas.

  34. Hi,
    i have a set of images (red skirt data set) when i run visualsfm (dense reconstruction) it makes a good ply.
    but with runsfm, the ply file doesnt have any points! why?

    ——————————————————————————————————————————–
    [ComputeEpipolarGeometry]: 10 12
    [ComputeEpipolarGeometry]: 10 13
    [ComputeEpipolarGeometry]: 10 14
    [ComputeEpipolarGeometry]: 10 15
    [ComputeEpipolarGeometry]: 10 16
    [ComputeEpipolarGeometry]: 10 17
    [ComputeEpipolarGeometry]: 10 18
    [ComputeEpipolarGeometry]: 10 19
    [ComputeEpipolarGeometry]: 11 12
    [ComputeEpipolarGeometry]: 11 13
    [ComputeEpipolarGeometry]: 11 14
    [ComputeEpipolarGeometry]: 11 15
    [ComputeEpipolarGeometry]: 11 16
    [ComputeEpipolarGeometry]: 11 17
    [ComputeEpipolarGeometry]: 11 18
    [ComputeEpipolarGeometry]: 11 19
    [ComputeEpipolarGeometry]: 12 13
    [ComputeEpipolarGeometry]: 12 14
    [ComputeEpipolarGeometry]: 12 15
    [ComputeEpipolarGeometry]: 12 16
    [ComputeEpipolarGeometry]: 12 17
    [ComputeEpipolarGeometry]: 12 18
    [ComputeEpipolarGeometry]: 12 19
    [ComputeEpipolarGeometry]: 13 14
    [ComputeEpipolarGeometry]: 13 15
    [ComputeEpipolarGeometry]: 13 16
    [ComputeEpipolarGeometry]: 13 17
    [ComputeEpipolarGeometry]: 13 18
    [ComputeEpipolarGeometry]: 13 19
    [ComputeEpipolarGeometry]: 14 15
    [ComputeEpipolarGeometry]: 14 16
    [ComputeEpipolarGeometry]: 14 17
    [ComputeEpipolarGeometry]: 14 18
    [ComputeEpipolarGeometry]: 14 19
    [ComputeEpipolarGeometry]: 15 16
    [ComputeEpipolarGeometry]: 15 17
    [ComputeEpipolarGeometry]: 15 18
    [ComputeEpipolarGeometry]: 15 19
    [ComputeEpipolarGeometry]: 16 17
    [ComputeEpipolarGeometry]: 16 18
    [ComputeEpipolarGeometry]: 16 19
    [ComputeEpipolarGeometry]: 17 18
    [ComputeEpipolarGeometry]: 17 19
    [ComputeEpipolarGeometry]: 18 19
    [- Done -]
    [ReadBundleFile] Bundle version: 0.300
    [ReadBundleFile] Reading 20 images and 171 points…
    [GetJPEGDimensions] File ./lybe14_40.jpg: ( 1024 , 768 )
    [GetJPEGDimensions] File ./lybe15_40.jpg: ( 1024 , 768 )
    [GetJPEGDimensions] File ./lybe16_40.jpg: ( 1024 , 768 )
    [GetJPEGDimensions] File ./lybe17_40.jpg: ( 1024 , 768 )
    [GetJPEGDimensions] File ./lybe18_40.jpg: ( 1024 , 768 )
    [GetJPEGDimensions] File ./lybe19_40.jpg: ( 1024 , 768 )

    @@ 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)
    [ReadBundleFile] Bundle version: 0.300
    [ReadBundleFile] Reading 20 images and 171 points…
    Undistorting image ./lybe14_40.jpg
    Undistorting image ./lybe15_40.jpg
    Undistorting image ./lybe16_40.jpg
    Undistorting image ./lybe17_40.jpg
    Undistorting image ./lybe18_40.jpg
    Undistorting image ./lybe19_40.jpg
    [WriteBundleFile] Writing 6 images and 171 points…
    Running Bundle2Vis to generate vis.dat

    [ReadBundleFile] Bundle version: 0.300
    [ReadBundleFile] Reading 6 images and 171 points…
    Num visible: 423
    Num cameras: 6
    @@ Sample command for running pmvs:
    pmvs2 pmvs/ pmvs_options.txt
    – or –
    use Dr. Yasutaka Furukawa’s view clustering algorithm to generate a set of options files.
    The clustering software is available at http://grail.cs.washington.edu/software/cmvs
    Reading bundle…6 cameras — 171 points in bundle file
    ***********
    6 cameras — 171 points
    Reading images: ******
    Set widths/heights…done 0 secs
    done 0 secs
    slimNeighborsSetLinks…done 0 secs
    mergeSFM…***********resetPoints…done
    Rep counts: 171 -> 23 0 secs
    setScoreThresholds…done 0 secs
    sRemoveImages… ******
    Kept: 1 2 3 5

    Removed: 0 4
    sRemoveImages: 6 -> 4 0 secs
    slimNeighborsSetLinks…done 0 secs

    Cluster sizes:
    4
    Adding images:
    0
    Image nums: 6 -> 4 -> 4
    Divide:
    done 0 secs
    3 images in vis on the average

    /home/sony/Desktop/RunSFM/cmvs/program/main/pmvs2
    pmvs/
    option-0000————————————————–
    — Summary of specified options —
    # of timages: 4 (enumeration)
    # of oimages: 0 (enumeration)
    level: 1 csize: 2
    threshold: 0.7 wsize: 7
    minImageNum: 3 CPU: 8
    useVisData: 1 sequence: -1
    ————————————————–
    Reading images: ****
    1 2 3 5 Harris running …Harris running …Harris running …Harris running …546 harris done
    DoG running…535 harris done
    DoG running…518 harris done
    DoG running…555 harris done
    DoG running…768 dog done
    768 dog done
    768 dog done
    768 dog done
    done
    adding seeds
    (1,0)(2,0)(3,0)(0,0)done
    —- Initial: 0 secs —-
    Total pass fail0 fail1 refinepatch: 4182 0 4174 8 8
    Total pass fail0 fail1 refinepatch: 100 0 99.8087 0.191296 0.191296
    Expanding patches…
    —- EXPANSION: 0 secs —-
    Total pass fail0 fail1 refinepatch: 0 0 0 0 0
    Total pass fail0 fail1 refinepatch: -nan -nan -nan -nan -nan
    FilterOutside
    mainbody:
    Gain (ave/var): 0 0
    0 -> 0 (-nan%) 0 secs
    Filter Exact: ****
    0 -> 0 (-nan%) 0 secs
    FilterNeighbor: FilterGroups: STATUS: 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0
    Expanding patches…
    —- EXPANSION: 0 secs —-
    Total pass fail0 fail1 refinepatch: 0 0 0 0 0
    Total pass fail0 fail1 refinepatch: -nan -nan -nan -nan -nan
    FilterOutside
    mainbody:
    Gain (ave/var): 0 0
    0 -> 0 (-nan%) 0 secs
    Filter Exact: ****
    0 -> 0 (-nan%) 0 secs
    FilterNeighbor: FilterGroups: STATUS: 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0
    Expanding patches…
    —- EXPANSION: 0 secs —-
    Total pass fail0 fail1 refinepatch: 0 0 0 0 0
    Total pass fail0 fail1 refinepatch: -nan -nan -nan -nan -nan
    FilterOutside
    mainbody:
    Gain (ave/var): 0 0
    0 -> 0 (-nan%) 0 secs
    Filter Exact: ****
    0 -> 0 (-nan%) 0 secs
    FilterNeighbor: FilterGroups: STATUS: 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0
    —- Total: 0 secs —-

    1. It uses a perl script with hard coded camera info, found in RunSFM/bundler-v0.4-source/bin/extract_focal.pl. You can either add an entry for your camera or skip to around line 400 and hard code the focal length.

      1. thanks.
        if our photo doesnt have any exif tags (camera model ,ccd width, focal length , …) , is there any wait to calculate these values?

          1. what values does run code need? only f and ccd width?

            isnt possibe to calculate focal length using fundemental matrix?
            and what about ccd with? what is it?

          2. I asked Changchang Wu the problem, he answered:

            when EXIF is not available, VisualSFM assumes the focal length to be param_default_focal_ratio * max(image_width, image_height), where param_default_focal_ratio is 1.2 by default.

          3. That’s an interesting approach, basically defaults to ~45 degree FOV. I suspect even if the guess is a way off the optimization process will re-adjust this value to be closer to the correct one.

  35. Hi Nghia,

    It is really a great software and easy to use. Thanks for your contribution first !
    Currently I came across a little problem. Bundler output provides the camera parameters(focal length, k1, k2) as well as the point coordinates and colors but it seems like the scaling factor is unclear.
    I know that the focal length is represented in pixels. But how about the point clouds? To be more specific, I would like to project every point back to the images to do further processing. So the scaling should be consistent.
    In one word, how can I figure out the scaling factor for the results of bundler?

    Thanks for your help!!
    LG ZHANG

    1. Hi,

      The scaling factor is not needed to project a point back to the image. You just simply take the point, apply the 3×4 Projection matrix, then apply the 3×3 camera matrix, divide by z, then test to see if that point is visible in the current camera view or not. Just be careful that negative “z” is in front of the camera, due to the co-ordinate system used. Here’s a peice of code I’ve used in the past:


      cv::Point2f Project(float x, float y, float z, float *ret_depth = NULL) const
      {
      cv::Matx31f X, new_pt;

      X(0) = x;
      X(1) = y;
      X(2) = z;

      new_pt = m_R*X + m_t;

      if (ret_depth) {
      *ret_depth = -new_pt(2);
      }

      new_pt(0) /= -new_pt(2);
      new_pt(1) /= -new_pt(2);
      new_pt(2) = 1.0f;

      new_pt = m_K*new_pt;

      return cv::Point2f(new_pt(0), new_pt(1));
      }

      m_K is the 3×3 camera matrix, m_R is the rotation matrix from P (first 3×3), t is the translation vector (last column of P).

      1. Thanks for your reply! Yes, I understand the geometry part, which is also well described in the user’s manual of Bundler. However, after I have figure out the “new_pt”, which is a 2d vector, how can I figure out the corresponding pixel index? For example, if I project a 3d point (1.0, 2.0, 3.0) back to one of the input image, geometrically, I can only get a 2d vector(usually in float). But the corresponding pixel index on the image plane is unknown.

        Thanks for your time,
        LG ZHANG

        1. By pixel index do you mean (x,y) in int? I just cast my floats to int and get the index from there, after making sure it’s valid.

          1. My image has a resolution of 3456*2304.
            Here’s some real data:
            bundle.out shows that the camera focal length is 3.2809293114e+03 (as described, the unit is ‘pixels’),

            and take one output 3d point:
            -3.4688154143e+00 1.4755551129e+00 -1.0833239302e+01 (i don’t know the unit)

            When applying the formulas, I think the unit should be consistent. So in your ‘m_K’, which unit do you use to represent focal length, ‘pixels’ or ‘mm’?

            Another question is: when I visualize the output points cloud of pmvs as well as bundler, I found that their positions, orientations and scaling are different. So the camera matrices generated by bundler seems useless to the output of pmvs.

          2. The m_K is read straight from bundle.out, units are in pixels for focal. The 3D points are actually dimensionless units because in reality there is no way to determine it. All that matters is the 3d point cloud is consistent and complete.

            When you apply the formula correctly it’ll return a 2D value. I think it’s mapped such that (0,0) is the centre of the image. You need to re-map this to the image dimension (translation + scale), it’s a one to one mapping. This is documented on the Bundler site.

  36. Hi nghiaho, I’m implementing Snavely SFM thesis.
    As he said in his paper he uses five point algorithm to find projection matrix.
    I’ve 2 basic question and I will be grateful if you answer me.

    1. As I read in wikipedia, because E (F) has five degree of freedom it’s possible to determine it using five point by solving various non-linear equations.
    so why we should use 5 point algorithm instead of 8 point algorithm?

    2. computing projection matrix using fundemental matrix has distortion and final result is multiple of T?
    How can I solve this problem and find exact value for projection matrix.

    thank you very much

    1. Hi,

      1. The 5 point algorithm has two main advantages over the 8 that I can think of. The first is that the 5 point can handle pure planar motion, which is a degenerate case with the 8 point. Second, in a RANSAC framework it means you can use less iterations and still maintain the same confidence. This can be significant because the number of RANSAC iterations is exponentially proportional to the model parameters, the less parameters the better.

      The biggest disadvantage I’ve found is the difficulty in implementation and the multiple solution it returns, even after depth testing.

      2. What is T? You can extract the projection matrix from E. If you have a look at my 5 point code it does this. Do a search for 5 point on my site.

  37. Hi
    I would like to know where exactly are you using the SiftGPU for feature extraction in the code and how are u storing it

  38. I had issues as well compiling cmvs on 64-bit linux. This one with many more, as if none of the functions in graclus could be resolved.

    graclus.cc:(.text+0x28a): undefined reference to `__ComputePartitionBalance(graphdef*, int, int*, float*)’
    graclus.cc:(.text+0x2a6): undefined reference to `ComputeRAsso(graphdef*, int*, int)’

    I definitely had NUMBITS=64 in both makefiles (Makefile.in for graclus and Makefile of cmvs in program/main), but this still occurred.

    I eventually figured out I had libraries in /usr/lib from a package install of libmetis. I removed those packages and then the compile worked out.

    Intermediately I also tried to use “extern “C” ” linking in the graclus.h file inside cmvs/base, but since the graclus static lib itself uses g++ linking, that gave me an undefined reference to 4 functions instead, making it worse.

    > apt-cache search libparmetis
    > apt-cache search libmetis

    Remove the libmetis / parmetis libs for the above and things should start to work. Verify in /usr/lib that you don’t get any metis stuff:

    /usr/lib > ls -al *metis*

  39. Hi,
    I’m using bundler for one of my projects. But facing some problems. Error occuring is : could not open file xyz.key.
    Can you just tell me the steps which i have to follow so that i can come to know where i’m getting wrong ?

    Thank you!
    Apoorva

      1. No..that is not the exact error.
        Meanwhile, I tried working with it. I’m getting some bundle_nn.out and pointsnn.ply files but not for all the images. They are hardly for 10 images out of hundreds.
        Moreover, as soon as the the feature extraction and matching is done…it shows the message :
        RUNNING BUNDLER

        and asks to press any key. When I press enter, the window closes.

  40. Hi Nghiaho,

    Thank you for all the great links/resources. Your page has already helped me a lot!!

    I am mainly looking to generate PLY out of time sequenced images. Besides, pmvs-2, I looked into VisualSFM, BigSFM, RunSFM, Bundler etc. – tools with internal dependencies to CMVS and PMVS.

    I suspect I am missing some steps in getting the PLY using PMVS-2. So, I have several questions before I go any deeper.

    Are there tools to auto-generate txt/*.txt files ( camera parameter file set) for pmvs-2?

    Your recommendations are greately appreciated. Thanks in advance!

    Cevher Dogan

  41. Hi,

    I am doing some experiment with surface reconstruction, I used to use osm-bundler in windows, now I shifted to ubuntu and lucky for me that I found your package.

    Few things I need from the output of PMVS, in the case of osm-bundler, they are:

    – ply file in “pmvs/model”.
    – Camera parameter files in “pmvs/txt”.
    – Images in “pmvs/visualize” selected by PMVS. Each image has a corresponding
    camera parameter file.

    Im just wondering will your package also produce these files?

    Thank you!

  42. Hi,

    I am doing some experiments based on 3D structure reconstructed from images. When i run SFM for images with meta data having aperture value everything works fine. For the images with aperture value being absent in meta data, output does not have any information. How to resolve this issue? Does the bundler uses this information somewhere? Can i run in a different way so as to get 3D structure even for images with no aperture value in meta data?

    1. That’s odd because aperture should have no zero impact on the SFM process. It should be an absent of focal length that could problematic. In such case I think it effectively assumes something like a 45 or 60 degree FOV.

      1. Hi,

        Okay, so source of error is not meta data then because focal length information is available. Now when i compare processing sequence as compared to the sequence which produced successful output i see the following as problems happening. Please go through the following sequences showing because of which i assume that the resulting ply file do not have any information,

        Reading images: ***
        0 2 1 Harris running …Harris running …Harris running …962 harris done
        DoG running…1013 harris done
        DoG running…1004 harris done
        DoG running…1321 dog done
        1442 dog done
        1457 dog done
        done
        adding seeds
        (1,0)(2,0)done
        —- Initial: 0 secs —-
        Total pass fail0 fail1 refinepatch: 4148 0 4148 0 0
        Total pass fail0 fail1 refinepatch: 100 0 100 0 0
        Expanding patches…
        —- EXPANSION: 0 secs —-
        Total pass fail0 fail1 refinepatch: 0 0 0 0 0
        Total pass fail0 fail1 refinepatch: -nan -nan -nan -nan -nan
        FilterOutside
        mainbody:
        Gain (ave/var): 0 0
        0 -> 0 (-nan%) 0 secs
        Filter Exact: ***
        0 -> 0 (-nan%) 0 secs
        FilterNeighbor: FilterGroups: STATUS: 0 0 0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0 0 0
        0 0 0 0 0
        Expanding patches…
        —- EXPANSION: 0 secs —-
        Total pass fail0 fail1 refinepatch: 0 0 0 0 0
        Total pass fail0 fail1 refinepatch: -nan -nan -nan -nan -nan
        FilterOutside
        mainbody:
        Gain (ave/var): 0 0
        0 -> 0 (-nan%) 0 secs
        Filter Exact: ***
        0 -> 0 (-nan%) 0 secs
        FilterNeighbor: FilterGroups: STATUS: 0 0 0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0 0 0
        0 0 0 0 0
        Expanding patches…
        —- EXPANSION: 0 secs —-
        Total pass fail0 fail1 refinepatch: 0 0 0 0 0
        Total pass fail0 fail1 refinepatch: -nan -nan -nan -nan -nan
        FilterOutside
        mainbody:
        Gain (ave/var): 0 0
        0 -> 0 (-nan%) 0 secs
        Filter Exact: ***
        0 -> 0 (-nan%) 0 secs
        FilterNeighbor: FilterGroups: STATUS: 0 0 0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0 0 0
        0 0 0 0 0 0 0 0 0 0

  43. Hi Nghia,

    I get an error when trying to use RunSFM on my own image set.
    I’m extracting frames from a video and then attempting to use RunSFM to build a model from those images.
    The feature detection and matching seems to work, but when it starts to run bundler I get this error:


    [- Running Bundler -]
    ProcessOptions: 3 c=122 optarg=216343171
    ProcessOptions: 3 c=364 optarg=17515744
    ProcessOptions: 5 c=111 optarg=17515808
    ProcessOptions: 7 c=97 optarg=17515872
    ProcessOptions: 9 c=117 optarg=17515936
    ProcessOptions: 10 c=118 optarg=0
    ProcessOptions: 11 c=85 optarg=0
    ProcessOptions: 12 c=36 optarg=0
    ProcessOptions: 14 c=74 optarg=17516064
    ProcessOptions: 15 c=347 optarg=0
    ProcessOptions: 16 c=114 optarg=0
    ProcessOptions: 16 c=-1 optarg=0
    ProcessOptions: 3 c=-1 optarg=0
    bundler: BundleIO.cpp:170: void BaseApp::LoadMatchTable(const char*): Assertion `ret == 1' failed.
    /home/jeff/FYP/RunSFM/bundler-v0.4-source/RunBundler.sh: line 97: 19929 Aborted (core dumped) $BUNDLER list.txt --options_file options.txt > bundle/out
    [- Done -]
    Error opening file bundle/bundle.out for reading

    Any advice on this would be amazing.

    Thanks

    1. There could be a bug in SiftMatcher that I thought I fixed. Try this, in SiftMatcher/Makefile, remove -fopenmp on line 15, make clean and rebuild. And see if you get the same error.

  44. here are packages I had to install in ubuntu 12.04.5

    227 sudo apt-get install cmake
    230 sudo apt-get install libblas-dev
    233 sudo atp-get install liblapack-dev libatlas-devlibatlas-base-dev
    234 sudo apt-get install liblapack-dev libatlas-devlibatlas-base-dev
    235 sudo apt-get install liblapack-dev libatlas-dev libatlas-base-dev
    237 sudo apt-get install libgsl0-dev
    240 sudo apt-get install imagemagick
    243 sudo apt-get install libxext-dev
    245 sudo apt-get install libjpeg-dev
    246 sudo apt-get install gfortran
    249 sudo apt-get install minpack-dev
    251 sudo apt-get install zlib-dev
    254 sudo apt-get install zlib1g-dev
    256 sudo apt-get install build-essential -y
    260 sudo apt-get install libboost-dev
    268 sudo apt-get install libboost-filesystem-dev libboost-system-dev

  45. Thanks for your nice work. I have run it successfully in my ubuntu 14.04. But I met some problems. The dataset you provided on the website can come out very nice results. But when I use my own dataset, 97 images in taotal, I can not even the model in pmsv/model. No error happened during processing. Then I try to decease the number of dataset. I use only 5 images. I can get the model file .ply. But there is no information shown when I grab it into Meshlab. Following is the output. Hope you can help me! Thanks!
    [Extracting exif tags from image ./GOPR2677.MP4_20141002_180656.861_pt.jpg]
    [Focal length = 0.000mm]
    [Couldn’t find CCD width for camera ]
    [CCD width = 0.000mm]
    [Resolution = 3840 x 2160]
    [Extracting exif tags from image ./GOPR2677.MP4_20141002_180849.368_pt.jpg]
    [Focal length = 0.000mm]
    [Couldn’t find CCD width for camera ]
    [CCD width = 0.000mm]
    [Resolution = 3840 x 2160]
    [Extracting exif tags from image ./GOPR2677.MP4_20141002_180852.815_pt.jpg]
    [Focal length = 0.000mm]
    [Couldn’t find CCD width for camera ]
    [CCD width = 0.000mm]
    [Resolution = 3840 x 2160]
    [Extracting exif tags from image ./GOPR2677.MP4_20141002_180858.385_pt.jpg]
    [Focal length = 0.000mm]
    [Couldn’t find CCD width for camera ]
    [CCD width = 0.000mm]
    [Resolution = 3840 x 2160]
    [Extracting exif tags from image ./GOPR2677.MP4_20141002_180901.146_pt.jpg]
    [Focal length = 0.000mm]
    [Couldn’t find CCD width for camera ]
    [CCD width = 0.000mm]
    [Resolution = 3840 x 2160]
    [Found 5 good images]
    Finding keypoints…
    72766 keypoints found.
    Finding keypoints…
    71835 keypoints found.
    Finding keypoints…
    72390 keypoints found.
    Finding keypoints…
    72142 keypoints found.
    Finding keypoints…
    73294 keypoints found.
    [- Matching keypoints (this can take a while) -]
    /home/ikenapple/Downloads/RunSFM/bundler-v0.4-source/../SiftMatcher/bin/Release/SiftMatcher -s -1 list_keys.txt matches.init.txt
    [SiftMatcher] Using all images for matching
    [SiftMatcher] Creating directory: 000000
    [SiftMatcher] Creating directory: 000001
    [SiftMatcher] Matching image 1 to 0
    [SiftMatcher] Creating directory: 000002
    [SiftMatcher] Matching image 2 to 0
    [SiftMatcher] Matching image 2 to 1
    [SiftMatcher] Creating directory: 000003
    [SiftMatcher] Matching image 3 to 0
    [SiftMatcher] Matching image 3 to 1
    [SiftMatcher] Matching image 3 to 2
    [SiftMatcher] Creating directory: 000004
    [SiftMatcher] Matching image 4 to 0
    [SiftMatcher] Matching image 4 to 1
    [SiftMatcher] Matching image 4 to 2
    [SiftMatcher] Matching image 4 to 3
    [- Running Bundler -]
    ProcessOptions: 3 c=122 optarg=719708931
    ProcessOptions: 3 c=364 optarg=15242464
    ProcessOptions: 5 c=111 optarg=15242528
    ProcessOptions: 7 c=97 optarg=15242592
    ProcessOptions: 9 c=117 optarg=15242656
    ProcessOptions: 10 c=118 optarg=0
    ProcessOptions: 11 c=85 optarg=0
    ProcessOptions: 12 c=36 optarg=0
    ProcessOptions: 14 c=74 optarg=15242784
    ProcessOptions: 15 c=347 optarg=0
    ProcessOptions: 16 c=114 optarg=0
    ProcessOptions: 16 c=-1 optarg=0
    ProcessOptions: 3 c=-1 optarg=0
    Done
    [ComputeEpipolarGeometry]: 0 1
    [ComputeEpipolarGeometry]: 0 2
    [ComputeEpipolarGeometry]: 0 3
    [ComputeEpipolarGeometry]: 0 4
    [ComputeEpipolarGeometry]: 1 2
    [ComputeEpipolarGeometry]: 1 3
    [ComputeEpipolarGeometry]: 1 4
    [ComputeEpipolarGeometry]: 2 3
    [ComputeEpipolarGeometry]: 2 4
    [ComputeEpipolarGeometry]: 3 4
    [- Done -]
    [ReadBundleFile] Bundle version: 0.300
    [ReadBundleFile] Reading 5 images and 9295 points…
    [GetJPEGDimensions] File ./GOPR2677.MP4_20141002_180656.861_pt.jpg: ( 3840 , 2160 )
    [GetJPEGDimensions] File ./GOPR2677.MP4_20141002_180849.368_pt.jpg: ( 3840 , 2160 )
    [GetJPEGDimensions] File ./GOPR2677.MP4_20141002_180852.815_pt.jpg: ( 3840 , 2160 )
    [GetJPEGDimensions] File ./GOPR2677.MP4_20141002_180858.385_pt.jpg: ( 3840 , 2160 )
    [GetJPEGDimensions] File ./GOPR2677.MP4_20141002_180901.146_pt.jpg: ( 3840 , 2160 )

    @@ 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)
    [ReadBundleFile] Bundle version: 0.300
    [ReadBundleFile] Reading 5 images and 9295 points…
    Undistorting image ./GOPR2677.MP4_20141002_180656.861_pt.jpg
    Undistorting image ./GOPR2677.MP4_20141002_180849.368_pt.jpg
    Undistorting image ./GOPR2677.MP4_20141002_180852.815_pt.jpg
    Undistorting image ./GOPR2677.MP4_20141002_180858.385_pt.jpg
    Undistorting image ./GOPR2677.MP4_20141002_180901.146_pt.jpg
    [WriteBundleFile] Writing 5 images and 9295 points…
    Running Bundle2Vis to generate vis.dat

    [ReadBundleFile] Bundle version: 0.300
    [ReadBundleFile] Reading 5 images and 9295 points…
    Num visible: 25951
    Num cameras: 5
    @@ Sample command for running pmvs:
    pmvs2 pmvs/ pmvs_options.txt
    – or –
    use Dr. Yasutaka Furukawa’s view clustering algorithm to generate a set of options files.
    The clustering software is available at http://grail.cs.washington.edu/software/cmvs
    Reading bundle…5 cameras — 9295 points in bundle file
    ***********
    5 cameras — 9295 points
    Reading images: *****
    Set widths/heights…done 0 secs
    done 0 secs
    slimNeighborsSetLinks…done 0 secs
    mergeSFM…***********resetPoints…done
    Rep counts: 9295 -> 650 1 secs
    setScoreThresholds…done 0 secs
    sRemoveImages… *****
    Kept: 0 1 3 4

    Removed: 2
    sRemoveImages: 5 -> 4 0 secs
    slimNeighborsSetLinks…done 0 secs
    Cluster sizes:
    4
    Adding images:
    0
    Image nums: 5 -> 4 -> 4
    Divide:
    done 0 secs
    3 images in vis on the average
    ————————————————–
    — Summary of specified options —
    # of timages: 4 (enumeration)
    # of oimages: 0 (enumeration)
    level: 1 csize: 2
    threshold: 0.7 wsize: 7
    minImageNum: 3 CPU: 8
    useVisData: 1 sequence: -1
    ————————————————–
    Reading images: ****
    0 1 Harris running …Harris running …3 Harris running …4 Harris running …5836 harris done
    5718 harris done
    DoG running…DoG running…5903 harris done
    DoG running…5810 harris done
    DoG running…8160 dog done
    8157 dog done
    8160 dog done
    8160 dog done
    done
    adding seeds
    (3,373)(2,98)(0,276)(1,114)done
    —- Initial: 0 secs —-
    Total pass fail0 fail1 refinepatch: 85025 1102 81240 2683 3785
    Total pass fail0 fail1 refinepatch: 100 1.29609 95.5484 3.15554 4.45163
    Expanding patches…
    —- EXPANSION: 1 secs —-
    Total pass fail0 fail1 refinepatch: 5978 266 5203 509 775
    Total pass fail0 fail1 refinepatch: 100 4.44965 87.0358 8.51455 12.9642
    FilterOutside
    mainbody:
    Gain (ave/var): 0.588589 0.254676
    1118 -> 1114 (99.6422%) 0 secs
    Filter Exact: ****
    1114 -> 1112 (99.8205%) 0 secs
    FilterNeighbor: 1112 -> 8 (0.719424%) 0 secs
    FilterGroups: 20
    8 -> 0 (0%) 0 secs
    STATUS: 256 0 4304 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0
    Expanding patches…
    —- EXPANSION: 0 secs —-
    Total pass fail0 fail1 refinepatch: 0 0 0 0 0
    Total pass fail0 fail1 refinepatch: -nan -nan -nan -nan -nan
    FilterOutside
    mainbody:
    Gain (ave/var): 0 0
    0 -> 0 (-nan%) 0 secs
    Filter Exact: ****
    0 -> 0 (-nan%) 0 secs
    FilterNeighbor: FilterGroups: STATUS: 256 0 4304 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0
    Expanding patches…
    —- EXPANSION: 0 secs —-
    Total pass fail0 fail1 refinepatch: 0 0 0 0 0
    Total pass fail0 fail1 refinepatch: -nan -nan -nan -nan -nan
    FilterOutside
    mainbody:
    Gain (ave/var): 0 0
    0 -> 0 (-nan%) 0 secs
    Filter Exact: ****
    0 -> 0 (-nan%) 0 secs
    FilterNeighbor: FilterGroups: STATUS: 256 0 4304 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0
    —- Total: 0 secs —-
    ——————————————-
    The models can be found in pmvs/models
    Enjoy!

      1. Thanks for your reply. Yeah, it’s GoPro. But I have already corrected the images before inputing. Then I changed the picture size from 3840 x 2160 to 640×480. I can get the model. But the point cloud is very sparse. The .ply file is only 324KB. I don’t know why.

        1. I’ve found the GoPro correction to be rather rough. I’ve taken pictures of a checkerboard and it never seems to correct it perfectly. I would avoid using the GoPro for any SFM work, it’ll make life harder.

          1. Thanks for your reply. I have get some results after using some other images. Could you tell me that does your software output intrinsic and extrinsic parameter after processing?Because I want to use such parameter to draw the camera moving path. I cannot find the output of the intrinsic and extrinsic parameter. Hope you can tell me. Thanks a lot!

          2. Bundler outputs intrinsics/extrinsics for each camera in a text file. You just have to parse the bundler.out file.

  46. Hi,

    I’m running this software on Ubuntu 14.10 on a small batch of images, which can be found here http://imgur.com/a/Qbb5X

    RunSFM appears to run fine (no errors) but the resulting point cloud is 0 bytes long and has no points in it.

    I tried running MVE (https://github.com/simonfuhrmann/mve ) with the same images and got some basic output http://imgur.com/CyZ3A96

    When I run RunSFM on your example images it works. Am I doing something wrong? Anything I can do to debug?

    Also, is this osftwaer on a bug tracker like github? Might be easier to keep track of bugs there.

    1. I would try with more images and more overlap. RunSFM relies on Bundler and PMVS, both of which haven’t been updated since 2010/2011.

  47. Hey Nghia,

    Thank you for sharing these scripts! I’ve been having one issue, it appears that SiftMatcher only uses a single thread under linux. Is there some way to make SiftMatcher utilize more than a single core?

  48. I managed to resolve the last issue by re-enabling openMP. The problem is that enabling OpenMP causes the bug that another person experienced above:

    ProcessOptions: 3 c=122 optarg=-1604871987
    ProcessOptions: 3 c=364 optarg=25777376
    ProcessOptions: 5 c=111 optarg=25777440
    ProcessOptions: 7 c=97 optarg=25777504
    ProcessOptions: 9 c=117 optarg=25777568
    ProcessOptions: 10 c=118 optarg=0
    ProcessOptions: 11 c=85 optarg=0
    ProcessOptions: 12 c=36 optarg=0
    ProcessOptions: 14 c=74 optarg=25777696
    ProcessOptions: 15 c=347 optarg=0
    ProcessOptions: 16 c=114 optarg=0
    ProcessOptions: 16 c=-1 optarg=0
    ProcessOptions: 3 c=-1 optarg=0
    2366 2603, line 48643
    2366 2603

    bundler: BundleIO.cpp:157: void BaseApp::LoadMatchTable(const char*): Assertion `i2 >= 0 && i2 < 1430' failed.
    /home/testuser/RunSFM/bundler-v0.4-source/RunBundler.sh: line 97: 26968 Aborted

    What can be done to get OpenMP support working in SiftMatcher?

    1. I never got around to fixing the bug. I’ve checked many times in SiftMatcher to find threading problems without much luck.

  49. My options.txt contains:

    –match_table matches.init.txt
    –output bundle.out
    –output_all bundle_
    –output_dir bundle
    –variable_focal_length
    –use_focal_estimate
    –constrain_focal
    –constrain_focal_weight 0.0001
    –estimate_distortion
    –run_bundle

  50. The issue is in SiftMatcher’s main.cpp. Using:

    #pragma omp critical(dataupdate)
    {
    num_keys_j = ReadKeyFile(key_files[j].c_str(), &keys_j);
    }

    This actually makes it work again but it’s not much faster than a single thread. It seems that your file operations are not thread safe when OpenMP is enabled.

  51. I seem to have fully resolved this for SiftMatcher, and now am moving on to trying to add openMP to ComputeEpipolarGeometry. Could you email me so I can submit my code to you?

  52. I’ve got 2 of problem. 1st one is when i enter ‘make’ for making binary files, i got these meseges.
    /usr/bin/ld: bundler(.pdata): relocation “.text+0x0 (type rva32)” goes out of range
    /usr/bin/ld: final link failed: Invalid operation
    collect2: error: ld returned 1 exit status
    make[2]: *** [bundler] Error 1
    make[2]: Leaving directory `/home/curtis/RunSFM/bundler-v0.4-source/src’
    make[1]: *** [default] Error 2
    make[1]: Leaving directory `/home/curtis/RunSFM/bundler-v0.4-source’
    make: *** [all] Error 2

    ——— 2nd one is when i typed ‘(path)/RunSFM.sh

    i got these error messages > (It extract something wrong output files , No information) , My images has focal length and Camera model and CCD width , as well as ‘extract_focal.pl’ file

    [Focal length = 0.000mm]
    [Couldn’t find CCD width for camera ]
    sh: 1: ../bundler-v0.4-source/bin/jhead: not found
    [CCD width = 0.000mm]
    sh: 1: ../bundler-v0.4-source/bin/jhead: not found
    [Resolution = 0 x 0]
    [Extracting exif tags from image ./009.jpg]
    sh: 1: ../bundler-v0.4-source/bin/jhead: not found

    ../bundler-v0.4-source/bin/Bundle2PMVS: error while loading shared libraries: liblapack.so.3: cannot open shared object file: No such file or directory
    bash: pmvs/prep_pmvs.sh: No such file or directory

    Could you give me hand?

    1. First one I don’t know how to solve. The 2nd ones are missing program and libraries. You need jhead and liblapack installed on your system.

  53. hi, thanks for your excellent program!
    I got the errors:

    ./bundler-v0.4-source/RunBundler.sh: line 98: 12215 Segmentation fault (core dumped) $BUNDLER list.txt –options_file options.txt > bundle/out
    [- Done -]
    Error opening file bundle/bundle.out for reading

    @@ 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)
    Error opening file bundle/bundle.out for reading
    RadialUndistort: RadialUndistort.cpp:344: void UndistortImages(const char*, const std::vector<std::basic_string >&, const std::vector&): Assertion `files.size() == cameras.size()’ failed.
    pmvs/prep_pmvs.sh: line 7: 12225 Aborted (core dumped) $BUNDLER_BIN_PATH/bin/RadialUndistort list.txt bundle/bundle.out pmvs
    Running Bundle2Vis to generate vis.dat

    Error opening file pmvs/bundle.rd.out for reading
    Num cameras: 0
    @@ Sample command for running pmvs:
    pmvs2 pmvs/ pmvs_options.txt
    – or –
    use Dr. Yasutaka Furukawa’s view clustering algorithm to generate a set of options files.
    The clustering software is available at http://grail.cs.washington.edu/software/cmvs
    Reading bundle…Bundle file not found: pmvs/bundle.rd.out

    1. Hi,

      Bundler has been known to crash, even for me. But I’ve never gotten around to figuring out why. It tends to happen on bad images. By bad I mean those with little overlap between them. So check that first.

  54. Dear Sir
    I have met this problem when I run the direction ../RunBundler.sh ../examples/ET
    I could not get the file:bundle.out , I could only get these information ,could please help me? Thank you!
    [Found in EXIF tags]
    [CCD width = 5.230mm]
    [Resolution = 640 x 480]
    [Focal length (pixels) = 660.803
    [Extracting exif tags from image ../examples/ET/et006.jpg]
    [Focal length = 5.400mm]
    [Couldn’t find CCD width for camera Canon Canon PowerShot A10]
    [Found in EXIF tags]

    1. Have a look at the file extract_focal.pl in bundler-0.4-source. At around like 348 is where it fails. Maybe the jpeg is missing this information. You can try and hard code the value by looking up the manufacturer specifications for the camera.

  55. In Bundler, there is an option to input an initial focal length. But it remains a constant throughout the bundle adjustment process. Is there any way to use it just as a starting point?

Leave a Reply to abhi Cancel reply

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